opengles中glVertexPointer出错的问题
最近在学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,看起来就一切正常,但是却画不出三角形。。。这到底是肿么回事。。。