OpenGL绘图过程中的操作无效。是什么导致的?

时间:2014-11-26 13:33:03

标签: opengl rendering

我写了这段代码,

void _3DGraphic::Render(){
glBindVertexArray(uiVAO[0]);
int HModelView = glGetUniformLocation(m_pShaderProgram->GetProgramID(), "gModelView");
int HProjection = glGetUniformLocation(m_pShaderProgram->GetProgramID(), "gProjection");
glm::mat4 projection = glm::perspective(45.0f, 1.0f, 0.001f, 1000.0f);
glUniformMatrix2fv(HProjection, 1, GL_FALSE, &projection[0][0]);

glm::mat4 mModelView = glm::lookAt(glm::vec3(0, 30,-10.0f ), glm::vec3(0.0f), glm::vec3(0.0f, 1.0f, 0.0f));


mModelView = glm::rotate(0.1f, glm::vec3(0.0f, 1.0f, 0.0f));

glUniformMatrix4fv(HModelView, 1, GL_FALSE, &mModelView[0][0]);


glDrawArrays(GL_TRIANGLES, 0, 12);

}

运行时,OGL出现“无效操作”错误。是什么原因造成的?

修改 似乎在每个open gl调用中都给出了错误。我在“无效操作”错误之前检查过,gl错误也会返回一些“无效的枚举”错误。

0 个答案:

没有答案