+ -
当前位置:首页 → 问答吧 → opengles中glVertexPointer出错的问题

opengles中glVertexPointer出错的问题

时间:2011-12-05

来源:互联网

最近在学opengles,写了个很简单的例子,就画一个三角形,但是我失败了。。。详情如下:
GLfloat vertices[] = 
{
  0, 0,0, 
  100,0,0,
  0,100,0
}; 
glVertexPointer(3, GL_FLOAT, 0, vertices);
GLenum error = glGetError();//这里总是得到GL_INVALID_ENUM的错误,查文档说的是glVertexPointer的第二个参数type无效,但是我不明白为什么GL_FLOAT会无效;而且继续运行下去会在glDrawArrays中报错“Unhandled exception at 0x691e1df0 in OglesExercise.exe: 0xC0000005: Access violation reading location 0x00000000”;如果我把vertices的类型改成GLfixed,把glVertexPointer的第二个参数改成GL_FIXED这样error=0,看起来就一切正常,但是却画不出三角形。。。这到底是肿么回事。。。

作者: gssnail   发布时间: 2011-12-05

ogles1.0 好像是只支持定点数
2.0支持浮点数。

另外,你三角形的方向是不是反了?

作者: Kevin_qing   发布时间: 2011-12-05

热门下载

更多