I am having a particularly annoying problem. In certain situations, calls to glColor appear to be ignored, resulting in objects being displayed with the incorrect color.
A Qt project which shows this problem can be found here.
When you run the program, all you see on the screen is two box-like objects, viewed from an angle. The object on the left is rendered by calling glCallList(boxModel1); and the object on the right is rendered by calling glCallList(boxModel2);. The two display lists are created by obviously-titled methods.
For both boxModel1 and boxModel2, I use a single display list called squareModel to render the sides of the boxes. I do this because while the square model in this case is trivial, the squareModel in my actual program is much more complex, with altered normals and etc.
The problem has something to do with the createManyRectangles method. When it is called with a small enough number (2715 for me), the colors appear normally: a blue box and a red box. When the number is high (2716 for me), the colors are ignored, and both boxes are rendered white.
Can anyone shed some light on what is happening here?
Try to run your program with glIntercept. This allows you to record every OpenGL call made. Compare the output you get between the 2715 and 2716 number of rectangles. If there are any differences, it should lead you in the right direction.
edit
Since your actual OpenGL calls seem ok, it could be a driver problem as you mentioned. You could try different environments (video card, pc, etc) since as totem pointed out, he didn’t experience your problem. Perhaps you could give some info on your environment?
Try rendering your rectangles without display lists to see if that helps. Where you would use
glCallList, redo the sequence of OpenGL calls instead. If that solves the problem, you will know there is a problem with the display lists management in your app or in the driver.Also, in case display lists turn out to be the problem, do you really need to use display lists? They have been less and less used for a while now in favor of VBOs. Perhaps you can "solve" your display list problem with that.