cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

codr
Journeyman III

Weird issue where a certain color causes render failure

I'm having an issue where triangles won't render if their green color component is greater than 55 (that's of 0-255 ubyte).

I'm using Ubuntu 15.10 with the fglrx-updates 2:15.201-0ubuntu1 driver. Hardware is R9 280x.

I'm rendering in orthographic "2D" mode using OpenGL 4.2 with 64-bit vertex coordinates.

I have created a simple SDL program that demonstrates the issue. See here:

c---/opengl-test · GitHub

I realize GL_QUADS are deprecated but I have also tested with GL_TRIANGLE_STRIP and it behaves the same way. If I set the color to 0,55,0,255 then everything renders fine. However, if I change the green color to anything higher than 55, then nothing renders. They seem to not even enter the shader because if I hard-code the vertex shader to always output the same color (frag_color in shader) I still see nothing rendering on the screen unless I set the green to 55 or less.

Bizarre eh? Bug in the driver or am I doing something wrong? This code works 100% correctly on nVidia hardware. I'm not sure about Intel, I'm trying to set up a new machine that will run the newer mesa with OGL4 support.

0 Likes
2 Replies
codr
Journeyman III

I have updated and edited this. I now have a "simple" example that easily re-creates the issue. The code is really ugly but it's just a cut/paste/hacked together bit of cruft just to show off the issue.

0 Likes
codr
Journeyman III

OK, more information from my thread over on the OpenGL forums:

OpenGL Discussion and Help Forums

Any one of these changes fixes it and makes it render correctly:

  1. Use location=2 for the "color" attribute
  2. Swap the attribute locations so that "color" is 0 and "vertex" is 1
  3. Allow the compiler to choose the locations and query them with glGetAttribLocation()
  4. Change "vertex" to dvec2.

Is this a bug in the driver?

0 Likes