Sign in to follow this  
CRACK123

Bump mapping issues

Recommended Posts

Hey, I am trying to do bump mapping. The bump mapping seems to work but on the 2nd pass the texturing does not work. If I disable only the drawing part of vertices and textures coordinates in the first pass but not the setting up of multitexturing and the disabling of it, the 2nd pass texturing works fine. This is how I am doing it. Otherwise it only shows the bump map.
// first pass
glActiveTextureARB(GL_TEXTURE1_ARB);
this->m_NormalMap.BindCubeMap();
glEnable(GL_TEXTURE_2D);
glEnable(GL_TEXTURE_CUBE_MAP_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_DOT3_RGB_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PREVIOUS_ARB);
	
glActiveTextureARB(GL_TEXTURE0_ARB);
this->m_NormalMap.Bind();
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);

// now draw the vertices, textures, colors etc

....

// pass 2
glActiveTextureARB(GL_TEXTURE0_ARB);
glDisable(GL_TEXTURE_2D);

glActiveTextureARB(GL_TEXTURE1_ARB);
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
glDisable(GL_TEXTURE_2D);
	
glActiveTextureARB(GL_TEXTURE0_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
	
// pass 2
glBlendFunc(GL_DST_COLOR, GL_ZERO);
glEnable(GL_BLEND);
glEnable(GL_TEXTURE_2D);

// draw the vertices, texture and color info
.......

glDisable(GL_BLEND);


Could anyone point out as what I may be doing incorrectly Thanks

Share this post


Link to post
Share on other sites
You probably set the DepthFunc to GL_LESS. For multipassing, you must set it to GL_LEQUAL. Also, why are you enabling both GL_TEXTURE_2D and GL_TEXTURE_CUBE_MAP_ARB for texture unit1? You just need cube texturing.

Share this post


Link to post
Share on other sites
Yeah that worked. Thanks

I didn't realize that with CUBE_MAP_ARB I don't need TEXTURE_2D. Thanks for pointing that out.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this