Jump to content
  • Advertisement
Sign in to follow this  
Oculus_Malus

Sph Mapping Blending

This topic is 4961 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

I'm trying to use multitexturing to draw a rifle with a base texture and a "chrome" sphere mapping ontop so it look all shiny. my problem is that the sphmap layer filter-out the underlaying texture instead of adding itself. (black color will not let anything show so its only black, and bright spots only reveal the base texture) is there a way to use blending or different textures modes to do this ? thanks.

Share this post


Link to post
Share on other sites
Advertisement
somewhere in the initialization :

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

in the render :

glActiveTexture(GL_TEXTURE0);
glenable(gl_texture_2d);
glbindtexture(gl_texture_2d,texbase);

glActiveTexture(GL_TEXTURE1);
glenable(gl_texture_2d);
glbindtexture(gl_texture_2d,texenv);
glEnable(GL_TEXTURE_GEN_T);
glEnable(GL_TEXTURE_GEN_S);

glActiveTexture(GL_TEXTURE0);
glcolor4f(1,1,1,1);
glbegin(gl_quads); glnormal3f(0,0,1);
gltexcoord2f(0,0); glvertex3f(0, 0, 0);
gltexcoord2f(1,0); glvertex3f(64,0, 0);
gltexcoord2f(1,1); glvertex3f(64,64, 0);
gltexcoord2f(0,1); glvertex3f(0, 64, 0);
glend;

glActiveTexture(GL_TEXTURE1);
glDisable(GL_TEXTURE_GEN_T);
glDisable(GL_TEXTURE_GEN_S);
gldisable(gl_texture_2d);
glActiveTexture(GL_TEXTURE0);
gldisable(gl_texture_2d);

theres an image of what it currently looks like and what I want:



[Edited by - Oculus_Malus on November 24, 2004 9:42:02 AM]

Share this post


Link to post
Share on other sites
nevermind :P
i've figured it out myself

for the record, the GL_TEXTURE1 (with sph mapping) must be set to GL_BLEND and the COLOR to [1,1,1,1]


const Tex_Color : array[1..4] of glFloat = (1,1,1,1);

glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_BLEND );
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, @Tex_Color );

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!