Sph Mapping Blending
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.
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]
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]
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 );
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 );
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement