PDA

View Full Version : Texture Mapping



04-02-2006, 04:40 PM
I am texture mapping a glutSolidTeapot, and the texture is applied but it seems like it is seethrough or transparent. Why could that be? Also I am trying to instead texturemap a sphere and I automatically generate the texture coordinates with the command

glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);

but that does not seem to work for a sphere. Why not and how would I go about generating automatic Texture Coordinates? I would appreciate any help.

Joe the Programmer
04-02-2006, 06:29 PM
I think you need to add GL_T to your automatic texture generation command. Also, are you using depth testing? If not, it is normal for an object to look transparent.

Komat
04-02-2006, 06:42 PM
Originally posted by <lebaii>:
I am texture mapping a glutSolidTeapot, and the texture is applied but it seems like it is seethrough or transparent. Why could that be?
Do you have alpha blending enabled? Can you post screenshot?



but that does not seem to work for a sphere. Why not and how would I go about generating automatic Texture Coordinates? I would appreciate any help. Have you enabled texture coordinate generation by glEnable( GL_TEXTURE_GEN_S )? Also you may wish to enable texgen for the T coordinate too.

memfr0b
04-03-2006, 03:11 AM
You might have forgotten to enable depth testing. Make sure you request a depth buffer with glutInitDisplayMode(... | GLUT_DEPTH) and enable depth testing with glEnable(GL_DEPTH_TEST). You also need to clear the depth buffer with the color buffer with glClear(... | GL_DEPTH_BUFFER_BIT).

Object linear generation maps the texture as if it was projected onto the object, somewhat like when you project an image with a beamer onto a sphere. If you want to have the texture completely wrap around the sphere, automatic texture coordinate generation won't work.