OpenGL behaviour depending on the graphics card?

This is something that never happened to me before. I have an OpenGL code that uses GLSL shaders to texture a 3D model. The code involves a lot of GPU texture processing, blending, etc...

I wanted to check how the performance of my code improves using a faster graphics card (both new and old are NVIDIA, using always the NVIDIA development drivers). But now I have found that once I run the code using the new graphics card, it behaves completely different (the final render looks wrong), probably because some blending effect is not performed correctly.

I haven't really look into what has changed, but I am guessing that some OpenGL states are, by default, set different. Is this possible? Have you ever found different OpenGL/GLSL behaviour using different graphics cards? Any "fast" solution? (So far I've thought of plugging back the old one, push all OpenGL default states, and compare with the ones I initially get using the new card..)

Edit #1: The graphics cards are NVIDIA Quadro GX7300 (in which my code works OK) and NVIDIA GeForce GTX 560 Ti (in which the results changes / fails)

Edit #2 I have commented out a lot of my code, and apparently the strange behaviour has nothing to do with texture handling. A simple chessboard-like floor looks differents. The diagonal white lines did not appear using the old NVIDIA Quadro GX7300. Any guess what OpenGL related thing could be causing this?

Figure 1

Edit #3 I have now fixed the issue commented on the previous edit, regarding the weird unwanted diagonal thin whit lines. As I commented below, I had to remove the glEnable(GL_POLYGON_SMOOTH);, which was affecting the NVIDIA GeForce GTX 560 for whatever reason (probably due to reasons explained by mh01 in his answer.

However, I am still facing a "texture blending" problem when using the NVIDIA GeForce GTX 560. I have a 3D model that is being textured using a shader that blends 8 different images to compute the right texture, depending on where the camera is at that particular moment. The resulting texture is then a combination of different images, and ideally they were blended nicely, using a set of blending weights computed each time the camera moves. The blending weights are still well computed, but the resulting texture is wrong. I am guessing that the GL_BLEND function is somehow behaving different, but I have checked it in both graphics cards and it is actually the same one. I have no idea what else can be involved in getting this wrong result:

As you can imagine, the black line is where two original textures are being blended in order to get a seamless texture. If I use the exact some code and a NVIDIA Quadro GX730, the shader works as expected. However, when I use the NVIDIA GeForce GTX 560, the texture blending goes wrong. Any guess?

This is the GLSL shader I am using.

• Maybe you can list the manufacturer and model information? – MichaelHouse Jul 9 '12 at 15:03
• To steal a meme: if you're not setting all the states needed by your render pass, you're going to have a bad time. – Patrick Hughes Jul 9 '12 at 15:20
• @PatrickHughes I thought you could trust on "the default ones" as they would be always the same (for all cards, I mean) – Dan Jul 9 '12 at 16:07
• @Dan: Here's an idea. Maybe you could post a Short, Self Contained, Correct (Compilable), Example that exhibits the problem. We can speculate from here to tomorrow about what is actually causing the problem. But unless we have actual source code, there's no way to know. – Nicol Bolas Jul 9 '12 at 18:17
• The problem with blindly trusting defaults is that middleware like GUIs may change them, and even your own program will start to render different styles and data which will leave settings changed. Plus, if you have a rendering problem like what you're having... it's one less thing to worry about if settings are done for sure instead of just assumed. – Patrick Hughes Jul 9 '12 at 19:16

If two different drivers have different default states then one of them is not in conformance with the OpenGL specification, although on the other hand there are no conformance tests for more recent GL_VERSIONs, so things are a bit Wild West at the moment.

What you're actually doing here is comparing the output from a professional/workstation class gfx card with the output from a consumer/desktop class card, and what you're seeing is most likely the expected result of a performance/quality tradeoff.

OpenGL allows leeway in the spec in many cases, and the Quadro will be erring on the side of quality so that the latest CAD or modelling software is more accurate, whereas the GeForce will be erring on the side of performance so that the latest game will run faster.

So the white lines will be as a result of lower floating point precision being used by the GeForce. NVIDIA has traditionally run at one of two internal precisions - 16 bit or 32-bit - and will occasionally take the lower precision path even in cases where it shouldn't.

You may be able to work around this by pushing the various available sliders towards "quality" in your NVIDIA control panel, or - if you're using shaders - you may be able to get a better result by explicitly specifying higher precision types.

It may also be the case that you're working on too large a scale, and that taking things down to 10% or 1% of their size (and adjusting everything else to match) is the solution you need.

• Thanks for the clear answer, it makes a lot of sense. I have fix one of the "different" behaviours just commenting out the following line: glEnable(GL_POLYGON_SMOOTH); which is apparently a deprecated state and should be avoided. Also, I have found other people with the same problem: blitzbasic.com/Community/posts.php?topic=74764 However, I haven't found yet a solution regarding the texture blending problem I initially mentioned in the question. I will try to post a few images and a code example to display the problem. Thanks a lot for your detailed and professional answer – Dan Jul 10 '12 at 11:31

I have finally figured out what was going on. The undesired thin white diagonal lines on the floor appeared because I was using glEnable(GL_POLYGON_SMOOTH);, which is apparently a bad practice.

The problem regarding the unexpected result when blending textures was caused due to a strange behaviour of a discard; operation in the shader. More details about it in this other question.