openGL texture combiner extension
i tried to combine two textures in one pass, it worked, but the second
texture wasnt lighted, only the first one. i did the same effect like
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
with the combiner extension like this:
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_INTERPOLATE_EXT);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PREVIOUS_EXT);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB_EXT, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB_EXT, GL_SRC_ALPHA);
the effect is the same, but i thought that with that the second texture is
lighted like the underlaying first. by doing that with GL_DECAL it is
documented that the second one isnt lighted. how can i get the second one
lighted??? without doing it in two passes.
i tried the NV extension texture_env_combine4 like this:
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE4_NV);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_ADD);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE1_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE1_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB_EXT, GL_TEXTURE0_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE3_RGB_NV, GL_TEXTURE1_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB_EXT, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND3_RGB_NV, GL_ONE_MINUS_SRC_ALPHA);
but now both textures arent lighted... ??????
does anyone know how to do this?
in the extension specs isnt anything sayed about that.
Christoph
you want to combine 2 textures whilst retaining the lighting
of course this all dependsa on how u want to combine them. note u dont need to use the combine extension to combine textures plain old multitexture or blending will work fine
tex0 GL_MODULATE
glColor4f(1,1,1,1)
tex1 GL_MODULATE
glColor4f(1,1,1,1)
do not use replace or decal
http://members.xoom.com/myBollux
of course this all dependsa on how u want to combine them. note u dont need to use the combine extension to combine textures plain old multitexture or blending will work fine
tex0 GL_MODULATE
glColor4f(1,1,1,1)
tex1 GL_MODULATE
glColor4f(1,1,1,1)
do not use replace or decal
http://members.xoom.com/myBollux
I just tried those OpenGL commands below and the compiler complained that GL_COMBINE_EXT was a syntax error.
What version is this?
What version is this?
Have you included glext.h?
"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
http://druidgames.cjb.net/
"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
http://druidgames.cjb.net/
@ zed
the combinig can be done in 2passes with
test.setactive(0);
test.LockArrays();
glTranslatef(-4.0f,0.0f,0.0f);
test.texture.UseTexture(1);
glEnable(GL_TEXTURE_2D);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);//GL_REFLECTION_MAP_NV);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);//GL_REFLECTION_MAP_NV);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
test.Draw();
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
test.texture.UseTexture(0);
test.Draw();
glDisable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
test.deactive();
test.UnlockArrays();
with normal blending. but i want to do it in one pass with multitextureing. the second texture (texture(o)) has a alpha channel, which is used to blend. it can be done with glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); <--------
but now the prob with the lighting. and with the combiner the same prob. and with the nvidia tex_combine4 another prob, there is no lighting on both textures.
the combinig can be done in 2passes with
test.setactive(0);
test.LockArrays();
glTranslatef(-4.0f,0.0f,0.0f);
test.texture.UseTexture(1);
glEnable(GL_TEXTURE_2D);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);//GL_REFLECTION_MAP_NV);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);//GL_REFLECTION_MAP_NV);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
test.Draw();
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
test.texture.UseTexture(0);
test.Draw();
glDisable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
test.deactive();
test.UnlockArrays();
with normal blending. but i want to do it in one pass with multitextureing. the second texture (texture(o)) has a alpha channel, which is used to blend. it can be done with glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); <--------
but now the prob with the lighting. and with the combiner the same prob. and with the nvidia tex_combine4 another prob, there is no lighting on both textures.
sorry didnt realise you wanted to blend using the alpha part of one of the textures. im not to sure but i believe either the combine or combine4 demos on my site do this.
http://members.xoom.com/myBollux
http://members.xoom.com/myBollux
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement