Advertisement

texture mapping

Started by April 13, 2003 11:36 AM
2 comments, last by noRulez43 21 years, 10 months ago
How do you texture map an object like glutSolidTorus()? glutSolidTeapot seems to automatically take on texture mapping without giving coordinates but none of the others do. I have an object made out of Torus'' and would like to texture map it with a bitmap. So far it only works on teapots
I''m not sure exactly what glut does, and doesn''t because I don''t use it myself... But OpenGL can automatically generate texture coordinates for you:

glTexGen(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGen(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);

Add this to your code, and it will work...

The last parameter og glTexGen can also be GL_EYE_LINEAR or GL_SPHERE_MAP... Try them, and you''ll see some cool stuff!
Advertisement
Thanks, what header file do I need to include for this?
Man, I keep forgetting to log in...how do you stay logged in? Anywho, I figured it out. I guess it's supposed to be glTexGeni?
I put that in and it works...found it on a website. Thanks once again James! You're a life saver...or a sanity saver. Whichever goes first.

p.s. You're right about that last parameter...very cool effects.

[edited by - noRulez43 on April 13, 2003 1:56:59 PM]

This topic is closed to new replies.

Advertisement