Skip to main content
gamedev.net
🔒 Locked

env mapping

Started by taybrin 1 reply 600+ views
Original Post
taybrin
taybrin
Hey everyone, I have a routine to draw a cylinder and I have environment mapping turned on by the following:bool emap = true;
  	
if(emap) {
    glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
		glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
	glEnable(GL_TEXTURE_GEN_S);
	glEnable(GL_TEXTURE_GEN_T);
              }
	}
  
The very ends of my cylinder are drawn with trianges. Each triagnle starts at (0,0,0) or (height, 0, 0) depending on which end cap i am drawing. When I do regular texturing everything works fine, but when i do environment map texturing, as above, one triangle of the capped ends will show some random portion of the environment mapped image. I am drawing all of my triangles in the correct order and this is really frustrating me . . .does anyone have any ideas. If clarification is needed please feel free to ask. Matt
"PC Load Letter, what the F*Ck's that" ~Office Space
Dodger
Dodger
Make sure the normals of all vertices are correct. Sphere mapping computes a reflection vector in eyespace from the view vector and the vertices'' normals - sounds to me like one of your normals may be messed up.

taybrin
taybrin
Funny thing is, the normal for the bottom of a cylinder (-1.0, 0.0, 0.0) assuming that the cylinder lies on the x-axis. So in my primitive drawing routine I only have one call to glNormal and it happens before I draw any triangles for the base of the cylinder.

What is even funnier is that on Windows everything runs fine, but on Mesa (OGL for Solaris I think) . . . I get the weird chipping effects.

Oh well, any feedback would be great

Matt
"PC Load Letter, what the F*Ck's that" ~Office Space

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.