简体   繁体   中英

OpenGL GL_POLYGON Not Functioning Properly

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM