OpenGL应用程序中的GL_Invalid_Operation

时间:2019-05-29 08:48:52

标签: c opengl opengl-compat

我目前正在连接OpenGL应用程序,并且正在获取GL_INVALID_OPERATION。整个GL分散在几个文件中,很难从中创建一个示例,但是我使用apitrace创建了OpenGL跟踪。这是造成错误的一个块:

glMatrixMode(mode = GL_PROJECTION)
glLoadIdentity()
glViewport(x = 0, y = 0, width = 1190, height = 746)
glOrtho(left = 0, right = 1190, bottom = 0, top = 746, zNear = 0, zFar = 128)
glBegin(mode = GL_QUADS)
glColor4f(red = 0.5, green = 0.5, blue = 0.5, alpha = 1)
glVertex3f(x = 1190, y = 746, z = 0)
glColor4f(red = 0.5, green = 0.5, blue = 0.5, alpha = 1)
glVertex3f(x = 0, y = 746, z = 0)
glColor4f(red = 0.5, green = 0.5, blue = 0.5, alpha = 1)
glVertex3f(x = 0, y = 100, z = 0)
glColor4f(red = 0.5, green = 0.5, blue = 0.5, alpha = 1)
glVertex3f(x = 1190, y = 100, z = 0)
glEnd()
glGetError() = GL_INVALID_OPERATION

有人对此有任何想法吗?

1 个答案:

答案 0 :(得分:-1)

从版本3开始不推荐使用GL_QUADS,从版本3.1开始将其删除。

https://www.khronos.org/opengl/wiki/Primitive#Quads