Simple vertex shader - weird behavior


it’s somewhat my first time dealing with shaders and I’m going through the lighthouse3D GLSL tutorial.

	void main(void)
		vec4 v = vec4(gl_Vertex);		
		v.z = 0.0;
		gl_Position = gl_ModelViewProjectionMatrix * v;

In their flatten vertex shader example, my output differs from theirs:

As you can see, my glutTeapot seems to be flattened down in the y axis instead of the z axis as it should.

At first I thought it was the example, but I went further tracking and the following testing makes it even weirder:

As you can see, only the glutTeapot doesn’t get it right. In red I have some points loaded from a file, in blue I have a glutSphere to make sure it’s not a glut bug, and finally in green the evil glutTeapot.

So, I’m just curious on what could be causing this behavior?
It’s harder to learn when examples don’t seem to do what they are supposed to :slight_smile:

Thanks in advance!

Ok, after some more testing, I figured that using glRotate here isn’t a good idea.

And I looked at freeglut’s teapot code and they do use glRotate. :slight_smile:

Ahh, since you answered your own question it would seem then that the matrix currently active when you draw the teapot would be critical, This is probably why their code differs from you. They probably have the modelview as the current matrix and you have the projection. Or vice versa.