Tag: vbo

麻烦简单的VBO示例

我试图让一个超级简单的GLFW和VBO示例运行,但我被卡住了。 我已经将glBegin和glEnd用于其他项目,但我正在尝试更新我的代码以使用OpenGL ES 2,但是现在我只想尽可能向前兼容。 从网上的一些例子中,我提出了以下代码: #include #include #include #define bool int #define true 1 #define false 0 const int width = 800; const int height = 600; bool opened = true; GLuint glTriangle; GLfloat triangle[] = { -1.0f, -1.0f, 0.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, }; void init() { glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glGenBuffers(1, […]

使用OpenGL ES 1.1中的顶点缓冲对象和ES 2.0进行绘制

我是openGL的新手。 我使用苹果文档作为我的主要参考资料http://developer.apple.com/library/ios/#documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/TechniquesforWorkingwithVertexData/TechniquesforWorkingwithVertexData.html#//apple_ref/doc/uid/TP40008793-CH107-SW6 我的问题是我使用的是openGL ES 1.1而不是2,因此清单9-3中使用的函数如glVertexAttribPointer , glEnableVertexAttribArray都无法识别…… 🙂 我试图进行本文档中描述的优化:将索引和顶点保存为包含其所有数据的结构:位置,颜色(清单9-1) typedef struct _vertexStruct { GLfloat position[3]; GLubyte color[4]; } VertexStruct; const VertexStruct vertices[] = {…}; const GLushort indices[] = {…}; 并使用清单9-2,9-3中的VBO 正如我所提到的,openGL ES 1.1中不存在一些在那里使用的函数。 我想知道是否有一种方法可以在ES 1.1中使用其他代码吗? 谢谢,亚历克斯 根据基督徒的回答编辑,尝试使用glVertexPointer,glColorPointer。 这是代码,它打印多维数据集,但没有颜色…… :(。任何人,是否可以使用ES 1.1这样的方式使用VBO typedef struct { GLubyte red; GLubyte green; GLubyte blue; GLubyte alpha; } Color3D; typedef struct […]