My OpenGL version is 4.0. I want to render a simple rectangle by glDrawArrays(GL_QUADS, 0, 4)
.
Although I use compatibility profile, I still get GL_INVALID_ENUM
. But when I add two points and use glDrawArrays(GL_TRIANGLES, 0, 6)
, it works. So is there another way to use GL_QUADS
or I can only use GL_TRIANGLES
?
Asked
Active
Viewed 193 times
0

luckintt
- 63
- 6
-
2Why not just use `glDrawArrays(GL_TRIANGLE_FAN, 0, 4)` ? – G.M. Apr 23 '20 at 14:57
-
1"*Although I use compatibility profile*" Did you? Provide a full [mcve] that shows you created a compatibility context. – Nicol Bolas Apr 23 '20 at 15:03
-
"Compatibility profile" means the `glad.h` is compatibility profile not core profile. Because core profile doesn't support `GL_QUADS` after 3.0, I think compatibility profile support it. And I use glad 3.3 compatibility profile. But when I use `glDrawArrays(GL_QUADS, 0, 4)`, there is an error `GL_INVALID_ENUM`. I don't know why it occurs. – luckintt Apr 23 '20 at 15:49
-
I forgot `GL_TRIANGLE_FAN`, I will try, thank you. – luckintt Apr 23 '20 at 15:50
-
2@lucknitt the glad version you generate has _nothing_ to do with the context you actually create, and in the code of [your previous question](https://stackoverflow.com/q/61387287/2327517) you explicitly request a **core** profile. – derhass Apr 23 '20 at 16:33
-
I misunderstood **compatibility** profile earlier. I chang OpenGl profile to compatibility just now, and it works. Thank you very much. – luckintt Apr 24 '20 at 01:28