原因:glBegin和glEnd之间只能调用顶点属性等相关函数,glGetError不可调用,GL_INVALID_OPERATION指的是glGetError操作无效。
gBegin的文档说明如下(以微软的MSDN的GL1.1为例)
You can use only a subset of OpenGL functions between glBegin and glend. The functions you can use are:
You can also use glCallList or glCallLists to execute display lists that include only the preceding functions. If any other OpenGL function is called between glBegin and glend, the error flag is set and the function is ignored.

本文详细解析了OpenGL中glBegin与glEnd之间的合法函数调用范围,强调在此区间内仅能调用特定的顶点属性相关函数,如glVertex、glColor等,并解释了为何在此期间调用glGetError会引发GL_INVALID_OPERATION错误。
5266

被折叠的 条评论
为什么被折叠?



