Question on GL_QUAD and compatibilty across GPU manufacturers

Hello Gentlemen,
I observed that my code runs fine on NVidia 8000 series and recent ATI cards. Due to an array of uniforms within my fragment shader it’s not compatible to NVidia 7000 series and older, but that’s not the question. Important is, it runs on both NVidia and ATI “state of the art” cards.

I stick to openGL 2.0 (and GLSL 1.2). Most objects I render are GL_QUADs (and some TRIANGLES, very few though (see the sphere below)). A friend of mine has problems showing the QUADS, the TRIANGLES however show correctly.

Let me start with some pictures:
It should look like this:

but with him, it looks like this:

He uses an Asus Nvidia ENGT 240.

It looks like the upper-right triangle of each quad is correct, the lower left however completely distorted. Does anybody have an idea whether this is a known problem with QUADs?

Thanks to all! Cheers, J

I’ve seen that happen on overclocked / overheating graphics cards before, presumably because of some kind of memory corruption.

Update on what I claimed above:
I changed my code so I use two triangles instead of one quad. Still the same though.

@Tang: It’s always the same triangle, for each “Quad”, no flickering or anything. I was able to reproduce a similar behavior on my machine by messing around with the strides in my VBOs. Hence I expect the origin of the problem somewhere in my code. Maybe that specific card sets one of the openGL flags to another value than any other card? shrug

This is the main part to render my thingies, maybe there’s an obvious mistake somewhere?

		FloatBuffer TexData = makeFloatBuffer(new float[4 * 2]);
		TexData.put(new float[] { 1, 1 });
		TexData.put(new float[] { 0, 1 });
		TexData.put(new float[] { 0, 0 });
		TexData.put(new float[] { 1, 0 });

		FloatBuffer VertexData = makeFloatBuffer(new float[4 * 2]);
		VertexData.put(new float[] { x, y });
		VertexData.put(new float[] { x + scale * width, y });
		VertexData.put(new float[] { x + scale * width, y + scale * height });
		VertexData.put(new float[] { x, y + scale * height });

		glBindBuffer(GL_ARRAY_BUFFER, VOL_VBO1);
		glBufferData(GL_ARRAY_BUFFER, VertexData, GL_STATIC_DRAW);
		glBindBuffer(GL_ARRAY_BUFFER, 0);
		glBindBuffer(GL_ARRAY_BUFFER, VOL_VBO2);
		glBindBuffer(GL_ARRAY_BUFFER, 0);

		glBindBuffer(GL_ARRAY_BUFFER, VOL_VBO1);
		glVertexAttribPointer(saPositionHandle, 4, GL_FLOAT, false, 2 * FLOAT_SIZE_BYTES, 0);
		glBindBuffer(GL_ARRAY_BUFFER, VOL_VBO2);
		glVertexAttribPointer(saTexturePosHandle, 4, GL_FLOAT, false, 2 * FLOAT_SIZE_BYTES, 0);

		glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0);

I agree with you, I got the same symptom when my former ATI X1950 Pro was really too hot.

Orangy Tang and Goussej:
Thanks for your thoughts on this - and thanks for assuming the error is not in my code.

But as this is my first openGL app I think I’ll stick with the assumption that I’m doing something wrong… for now.

There are a few things in my shaders that are incompatible with older cards (arrays of uniforms @ frag…). While those cards are unable to compile the shaders, I assume this might have negative effects on newer cards as well.

I’ll let you know what it was once I found it.

You state your attributes are 4-dimensional, while they are 2-dimensional.

		glVertexAttribPointer(saPositionHandle, 2, GL_FLOAT, false, 2 * FLOAT_SIZE_BYTES, 0);

		glVertexAttribPointer(saTexturePosHandle, 2, GL_FLOAT, false, 2 * FLOAT_SIZE_BYTES, 0);

That should do it.

Hi Riven,
thanks a lot. Not only that you took the time to read through my code sample but also for pointing out what the second argument of “glVertexAttribPointer” really is for. I thought it was the “length” of the buffer to copy, not the length of a single coordinate.

Cool. I’m happy!

Added a “Star” named Riven to my Game:

mysql> select * from STARS where id = 50002;
| ID    | X    | Y    | SIZE | SPOKES | HALO | COLOR      | NAME  |
| 50002 |  -10 |  -10 |    1 |      9 |    0 | 2147483647 | Riven |

The big one in the middle:

Yay, seems to be near the center of the universe! :point:

Glad I could help, parameters in OpenGL are sometimes surprisingly hard to decipher when you don’t yet master the terminology.