Jump to content
  • Advertisement
Sign in to follow this  
alex_r

EnvMap and MultTexture

This topic is 4838 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Google --> "Reflective Bump Mapping"

I am guessing you are using Multitexturing to texture map a surface with multiple textures. Assuming you know how to calculate reflection vector using view and normal vector either per vertex of per pixel. Now use this reflection vector inside the pixel shader to look into the environment map.

To load an environment map use GL_TEXTURE_CUBE_MAP_ARB.

Share this post


Link to post
Share on other sites
Thanks for the answer...

This is with shader right?!
I see some samples just with shader in google, some in ATI and nVidia sites...

I can't like to use shaders now, I just can use the glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); and glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);...

I'm using the vertex array to render my model, I made it to start the mult-textures:

// Metal texture
glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, t_Metal);

// "Reflex" texture
glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);

glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 2);

glBindTexture(GL_TEXTURE_2D, t_Reflex);

the problem is, where I place the glEnable(GL_TEXTURE_GEN_S); and glEnable(GL_TEXTURE_GEN_T); :-/

I made some test but the results is like I didn't start the GL_S and GL_T...

Share this post


Link to post
Share on other sites
when you call glActiveTexture( ... ), you actually need to call glClientActiveTexture( .... ) before it, and you also need to enable S and T coordinate generation; eg:


glClientActiveTexture( GL_TEXTURE0_ARB );
glActiveTextureARB( GL_TEXTURE0_ARB );
glEnable( GL_TEXTURE_2D );
glBindTexture( GL_TEXTURE_2D, t_Metal );

// "Reflex" texture
glClientActiveTexture( GL_TEXTURE1_ARB );
glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);

glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);

glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 2);

glBindTexture(GL_TEXTURE_2D, t_Reflex);
glEnable( GL_TEXTURE_GEN_S );
glEnable( GL_TEXTURE_GEN_T );
hope that helps..

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!