View Full Version : The mystical teapot (beginner question)

08-09-2006, 06:14 AM
Hi all,

I'm currently learning the basics of GLSL, following the lighthouse3d tutorials. One of the very first shaders presented is a flatten (vertex) shader, where every incoming vertex's z value is set to 0.0 before transforming it. Like this:

void main()
vec4 v = vec4(gl_Vertex);
v.z = 0.0;
gl_Position = gl_ModelViewProjectionMatrix * v;
}The result ought to be obejects that are projected on the xy-plane. This works when I draw a quad, or a glutSolidSphere. However, when I a draw a glutSolidTeapot, somehow that one is flattened
in the y-direction, or projected on the xz-plane.

The source I downloaded from lighthouse3d had the same effect so its not some side effect from my code I think. Any toughts on this one? I'm very curious to why the teapot behaves differently.

Thanks for reading,

08-09-2006, 07:19 AM
It is possible that the theapot geometry has its object space oriented differently and the glutSolidTeapot uses the modelview matrix to orient the teapot to its final orientation.

08-09-2006, 08:24 AM
I think the teapot has an internal transformation into the z-direction in the Windows implementation of glut...I had the same problem too.

08-09-2006, 10:27 AM
Ah, I see, that would explain why my results differ from those in the tutorial. I guess there is no other way than flattening in the y-direction to emulate the tutorial stuff then. Thanks for your quick reactions!

08-19-2006, 01:02 AM
I can confirm that the teapot is indeed mystical on Windows (lid up the y-axis). Is it really different on other systems?

I guess there is no other way than flattening in the y-direction to emulate the tutorial stuff then.You could apply your own transformations to align it along the axis of your choosing. Personally, I like having z pointing up (if anyone cares).