This seems to be another cross-platform and cross-hardware issue and I just can’t work it out. I’m sure I’m doing something wrong… but here goes.
I’m rendering a series of cubes to the screen. In order to do mouse picking, I’m doing a ‘mouse pass’ that renders each cube in a unique color. I compare that color to a list of objects and that’s how I can determine which object I’ve selected. It works very well on my Windows 7 machine with an nVidia GPU.
And then there’s the Mac. And the Laptop.
The Mac is running on nVidia hardware. The Laptop is running on ATI hardware.
When I modify my background clear color to something non-white, I can see the geometry but it’s being rendered in all black. If I modify the code so that I’m specifying white, the geometry is still being rendered in only black. Texturing, blending and lighting are all disabled, and the shade model is GL_FLAT.
Now, when I go to render the geometry with lighting and texturing, there is no problem at all. Everything is rendered exactly as expected on all three machines.
What should I be looking for that would cause flat shading with solid coloration to not work properly on different machines? I’ve looked around on google and even searched these forums but haven’t come up with anything relevant.
What does glGetError say?
And if there is a difference in result, then one of the machines has a driver bug. You might want to post it in the Driver forum.
Thank you for your reply. I really do appreciate you’re taking the time to post a response.
glGetError returns GL_NO_ERROR on all machines. A driver bug would not surprise me at all on the laptop with the ATI hardware but it does surprise me on the Mac with the nVidia hardware.
I hesitate to blame someone elses code though which is why I believe the error is probably within my code.
Also , on the Mac port (haven’t tested this on the laptop), adding a call to glDisable(GL_TEXTURE_2D) (as a note, 2D textures are already disabled before this point and 1D and 3D textures are never enabled) does change the behavior such that the geometry is being rendered properly but the call to glReadPixels() is producing wildly inaccurate results (inspecting a screenshot, on the other hand, reveals that the geometry is in fact rendered with the correct colors). I have also made sure that all three machines are in fact running in 32 bit modes (I would expect to have these kinds of results in color modes other than 32bit such as 8 or 15/16) and have confirmed that all three GL contexts are in fact created with 8bits per color channale (r=8, g=8, b=8, a=8)
I don’t understand why there would be such wildly different behaviors on what should be a fairly straight-forward set of functions…