PDA

View Full Version : Is there code to draw a teapot without GLUT?



Bluebomber357
08-19-2009, 09:11 PM
Hey all, I am very close to finishing my shader gallery, and I have environment cube mapping working on a sphere and a torus, but when I use teapot, it messes up. I have checked for an hour to figure out why in my code. Anyways, is there code out there for making a teapot, I can't find any on Google and I don't want to mess around trying to load meshes.

Bluebomber357
08-19-2009, 09:24 PM
nvm, I figured it out, another OpenGL problem that I fixed by doing something random. I don't understand why it worked, but it did, and this seems to happen a lot for me with OpenGL.

All I did was switch to glMatrixMode(GL_MODELVIEW) from glMatrixMode(GL_TEXTURE). Now this doesn't make sense to me because I draw my sphere and torus with no problems without the mode change, but teapot requires it. If anyone has any ideas why please let me know. Thankfully it works though, phew :)

marshats
08-20-2009, 08:04 AM
glMatrixMode sets the current matrix mode.

GL_MODELVIEW Applies subsequent matrix operations to the modelview matrix stack. Like if you want to scale or rotate the teapot.

GL_TEXTURE Applies subsequent matrix operations to the texture matrix stack. Are you trying to rotate or make the texture move across the teapot, kinda like an animation projected onto the teapot?

What were you originally doing with the texture matrix? I very seldom see people ever use the texture matrix stack, if at all. I think understanding that question would make the "random" problem not a problem at all. It is hard to answer from here without seeing your code.