问题
I have an OpenGL-related issue. Whenever I attempt to draw a simple polygon using four vertices from a vertex buffer... nothing happens. However, it will draw the shape in GL_TRIANGLES or GL_TRIANGLE_STRIP mode, albeit distorted. Am I doing something wrong?
Relevent code:
Vertex array: http://i.imgur.com/nEcbw.png
GL_POLYGON: http://i.imgur.com/idfFT.png
GL_TRIANGLES: http://imgur.com/84ey3,idfFT,nEcbw#0
GL_TRIANGLE_STRIP: http://i.imgur.com/JU3Zl.png
回答1:
I'm using a forward-compatible 3.2 core profile
First of all, never use a "forward-compatible core profile". You should just use a core profile; stop using the forward compatibility bit. It's pointless.
More importantly, GL_POLYGON
is not part of a core OpenGL profile. It was removed in 3.1. So your code is likely giving you a GL_INVALID_ENUM
error that you're ignoring.
Lastly, always post your OpenGL version and profile in your question.
来源:https://stackoverflow.com/questions/12762257/opengl-gl-polygon-not-functioning-properly