資源簡介
包含了OpenGL開發環境的配置庫,和親自實現的配置教程,還附帶代碼實現了一個例子
代碼片段和文件信息
/*?$URL$
???$Rev$
???$Author$
???$Date$
???$Id$
?*/
#include?“vapp.h“
#include?“vutils.h“
#include?“vmath.h“
#include?“LoadShaders.h“
#include?
using?namespace?vmath;
//?Define?USE_PRIMITIVE_RESTART?to?0?to?use?two?separate?draw?commands
#define?USE_PRIMITIVE_RESTART?1
BEGIN_APP_DECLARATION(DrawCommandExample)
????//?Override?functions?from?base?class
????virtual?void?Initialize(const?char?*?title);
????virtual?void?Display(bool?auto_redraw);
????virtual?void?Finalize(void);
????virtual?void?Reshape(int?width?int?height);
????//?Member?variables
????float?aspect;
????GLuint?render_prog;
????GLuint?vao[1];
????GLuint?vbo[1];
????GLuint?ebo[1];
????GLint?render_model_matrix_loc;
????GLint?render_projection_matrix_loc;
END_APP_DECLARATION()
DEFINE_APP(DrawCommandExample?“Drawing?Commands?Example“)
void?DrawCommandExample::Initialize(const?char?*?title)
{
????base::Initialize(title);
????static?const?ShaderInfo?shader_info[]?=
????{
????????{?GL_VERTEX_SHADER?“../../03/ch03_primitive_restart/primitive_restart.vs.glsl“?}
????????{?GL_FRAGMENT_SHADER?“../../03/ch03_primitive_restart/primitive_restart.fs.glsl“?}
????????{?GL_NONE?NULL?}
????};
????render_prog?=?LoadShaders(shader_info);
????glUseProgram(render_prog);
????//?“model_matrix“?is?actually?an?array?of?4?matrices
????render_model_matrix_loc?=?glGetUniformLocation(render_prog?“model_matrix“);
????render_projection_matrix_loc?=?glGetUniformLocation(render_prog?“projection_matrix“);
????//?A?single?triangle
????static?const?GLfloat?vertex_positions[]?=
????{
????????-1.0f?-1.0f??0.0f?1.0f
?????????1.0f?-1.0f??0.0f?1.0f
????????-1.0f??1.0f??0.0f?1.0f
????????-1.0f?-1.0f??0.0f?1.0f
????};
????//?Color?for?each?vertex
????static?const?GLfloat?vertex_colors[]?=
????{
????????1.0f?1.0f?1.0f?1.0f
????????1.0f?1.0f?0.0f?1.0f
????????1.0f?0.0f?1.0f?1.0f
????????0.0f?1.0f?1.0f?1.0f
????};
????//?Indices?for?the?triangle?strips
????static?const?GLushort?vertex_indices[]?=
????{
????????0?1?2
????};
????//?Set?up?the?element?array?buffer
????glGenBuffers(1?ebo);
????glBindBuffer(GL_ELEMENT_ARRAY_BUFFER?ebo[0]);
????glBufferData(GL_ELEMENT_ARRAY_BUFFER?sizeof(vertex_indices)?vertex_indices?GL_STATIC_DRAW);
????//?Set?up?the?vertex?attributes
????glGenVertexArrays(1?vao);
????glBindVertexArray(vao[0]);
????glGenBuffers(1?vbo);
????glBindBuffer(GL_ARRAY_BUFFER?vbo[0]);
????glBufferData(GL_ARRAY_BUFFER?sizeof(vertex_positions)?+?sizeof(vertex_colors)?NULL?GL_STATIC_DRAW);
????glBufferSubData(GL_ARRAY_BUFFER?0?sizeof(vertex_positions)?vertex_positions);
????glBufferSubData(GL_ARRAY_BUFFER?sizeof(vertex_positions)?sizeof(vertex_colors)?vertex_colors);
????glVertexAttribPointer(0?4?GL_FLOAT?GL_FALSE?0?NULL);
????glVertexAttribPointer(1?4?GL_FLOAT?GL_FALSE?0?(const?GLvoid?*)sizeof(vertex_positions));
????glEnableVerte
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-01-02?15:35??Opengl配置庫與教程\
?????文件??????555651??2017-03-10?17:16??Opengl配置庫與教程\VS2013配置Opengl開發環境.docx
?????文件??????169984??1998-08-18?16:25??Opengl配置庫與教程\glut.dll
?????文件???????21440??1998-08-18?16:24??Opengl配置庫與教程\glut.h
?????文件???????79654??1998-08-18?16:25??Opengl配置庫與教程\glut.lib
?????文件??????169984??1998-08-18?16:25??Opengl配置庫與教程\glut32.dll
?????文件???????79898??1998-08-18?16:25??Opengl配置庫與教程\glut32.lib
?????目錄???????????0??2017-06-20?10:26??Opengl配置庫與教程\oglpg-8th-edition\
?????目錄???????????0??2017-11-20?17:42??Opengl配置庫與教程\oglpg-8th-edition\03\
?????目錄???????????0??2017-06-20?10:26??Opengl配置庫與教程\oglpg-8th-edition\03\ch03_drawcommands\
?????文件????????5230??2011-02-22?13:20??Opengl配置庫與教程\oglpg-8th-edition\03\ch03_drawcommands\ch03_drawcommands.cpp
?????文件????????3687??2011-08-25?13:25??Opengl配置庫與教程\oglpg-8th-edition\03\ch03_drawcommands\ch03_drawcommands.vcproj
?????文件????????4490??2011-02-22?13:20??Opengl配置庫與教程\oglpg-8th-edition\03\ch03_drawcommands\ch03_drawcommands.vcxproj
?????目錄???????????0??2017-06-20?10:26??Opengl配置庫與教程\oglpg-8th-edition\03\ch03_instancing\
?????文件????????8693??2011-01-25?18:46??Opengl配置庫與教程\oglpg-8th-edition\03\ch03_instancing\ch03_instancing.cpp
?????文件????????3541??2011-01-25?18:46??Opengl配置庫與教程\oglpg-8th-edition\03\ch03_instancing\ch03_instancing.vcproj
?????文件????????4201??2011-01-25?18:46??Opengl配置庫與教程\oglpg-8th-edition\03\ch03_instancing\vbm.cpp
?????文件????????1707??2011-01-25?18:46??Opengl配置庫與教程\oglpg-8th-edition\03\ch03_instancing\vbm.h
?????目錄???????????0??2017-06-20?10:26??Opengl配置庫與教程\oglpg-8th-edition\03\ch03_instancing2\
?????文件????????9966??2011-03-08?03:25??Opengl配置庫與教程\oglpg-8th-edition\03\ch03_instancing2\ch03_instancing2.cpp
?????文件????????3544??2011-02-06?18:59??Opengl配置庫與教程\oglpg-8th-edition\03\ch03_instancing2\ch03_instancing2.vcproj
?????文件????????4371??2011-08-25?13:25??Opengl配置庫與教程\oglpg-8th-edition\03\ch03_instancing2\ch03_instancing2.vcxproj
?????文件????????4201??2011-02-06?18:59??Opengl配置庫與教程\oglpg-8th-edition\03\ch03_instancing2\vbm.cpp
?????文件????????1707??2011-02-06?18:59??Opengl配置庫與教程\oglpg-8th-edition\03\ch03_instancing2\vbm.h
?????目錄???????????0??2017-06-20?10:26??Opengl配置庫與教程\oglpg-8th-edition\03\ch03_instancing3\
?????文件???????10381??2011-02-18?19:33??Opengl配置庫與教程\oglpg-8th-edition\03\ch03_instancing3\ch03_instancing3.cpp
?????文件????????3544??2011-02-18?19:33??Opengl配置庫與教程\oglpg-8th-edition\03\ch03_instancing3\ch03_instancing3.vcproj
?????文件????????4201??2011-02-18?19:33??Opengl配置庫與教程\oglpg-8th-edition\03\ch03_instancing3\vbm.cpp
?????文件????????1707??2011-02-18?19:33??Opengl配置庫與教程\oglpg-8th-edition\03\ch03_instancing3\vbm.h
?????目錄???????????0??2017-06-20?10:26??Opengl配置庫與教程\oglpg-8th-edition\03\ch03_pointsprites\
?????文件????????4666??2011-03-08?03:25??Opengl配置庫與教程\oglpg-8th-edition\03\ch03_pointsprites\ch03_pointsprites.cpp
............此處省略257個文件信息
- 上一篇:three.js開發指南及其中文版
- 下一篇:MVC源碼完整版
評論
共有 條評論