PDA

View Full Version : Problems using GLSL with GL_QUADS



eriks
02-02-2012, 04:31 AM
Hi,

Been stuck on a real annoying problem and need some help. I got a very simple vertex and fragment shader which is working fine when I use GL_TRIANGLES but as soon as I switch to using to GL_QUADS all I get is a blank screen.

I know the buffers are populated correctly with index and vertex data.

My render function use glDrawElements(GL_QUADS,4,GL_UNSIGNED_BYTE,0);, this doesn't work but if I switch to glDrawElements(GL_TRIANGLES,3,GL_UNSIGNED_BYTE,0); it works fine with the same buffers.

Anyone have any idea what might be wrong?

menzel
02-02-2012, 04:55 AM
Hi,

any chance your on MacOS with OpenGL 3.2 where GL_QUADS are not supported?
If not, do you get any errors from GL (glGetError) ?

eriks
02-02-2012, 05:36 AM
I am using the following in Windows.

Driver supports OpenGL 3.3
Using GLEW 1.5.6
Vendor: NVIDIA Corporation
Renderer: GeForce G105M/PCI/SSE2
Version: 3.3.0
GLSL: 3.30 NVIDIA via Cg compiler

I don't see any useful Error msg.

eriks
02-02-2012, 05:48 AM
Yeah looks like GL_QUADS isn't supported in OpenGL 3.1 or later version. Guess I have to rewrite my code using triangles then.

menzel
02-02-2012, 06:33 AM
The windows drivers from NVidia should still support quads as long as you don't ask explicitly for a core context.