Teapot at an odd angle (SOLVED)

Started by
2 comments, last by V-man 16 years ago
This may seem like a weird question, but does glutSolidTeapot() rely on OpenGL's matrix stack? The reason I ask is because ever since I started using my own matrices, and bypassing GL's matrix modes, the camera has been facing the top of the teapot, rather than the side. At first, I thought this was some bug with my matrix, and tested the other glut shapes to see. All the others appeared to be at the correct angles. So does glut implicitly do a rotateX(90) on the teapot? [Edited by - n00body on April 4, 2008 8:30:00 AM]

[Hardware:] Falcon Northwest Tiki, Windows 7, Nvidia Geforce GTX 970

[Websites:] Development Blog | LinkedIn
[Unity3D :] Alloy Physical Shader Framework

Advertisement
Quote:Original post by n00body
This may seem like a weird question, but does glutSolidTeapot() rely on OpenGL's matrix stack?
Inasmuch as all vertices passed to openGL are processed by the transformation matrices, yes. And because of the way linear algebra works, even if it did do extra transformations, it wouldn't matter; those would be transparent to its workings.
I went poking around in the freeglut teapot files, and found my suspicion was indeed correct. They apply rotate, scale, and translation transformations to the teapot using the MODELVIEW matrix mode of OpenGL.

So naturally, when I stopped using GL's matrix stack, those transformations became ineffectual.

Kinda wish this info was more commonplace. I thought I'd done something wrong when it started doing this without warning.

[Hardware:] Falcon Northwest Tiki, Windows 7, Nvidia Geforce GTX 970

[Websites:] Development Blog | LinkedIn
[Unity3D :] Alloy Physical Shader Framework

It is called "badly documented". I think GLUT doesn't even have a document.
Anyway, we are talking about GLUT, which isn't used in serious programming.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

This topic is closed to new replies.

Advertisement