OpenGL GL_POLYGON Not Functioning Properly

假如想象 提交于 2019-12-11 13:38:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!