MiniGL and glTexEnvi/f() parameters
Posted: Mon Feb 04, 2013 8:49 pm
Hello.
I'd like to make textures combination using 2 textures (double-texturing) but I never get a good result.
I've found a tutorial explaining some of the requirements :
http://www.informit.com/articles/articl ... 9&seqNum=6
It seem well explained so, I did this :
In all case I get the same result. the combination of the 2 textures but really dark.
Excepted case 4 for transparency where I only get the 2nd texture really dark.
Do you know exactly what can cause this ?
The wanted result is absolut adding of RED, GREEN & BLUE.
For example:
Texture 1 : RGB : 64, 80, 100
Texture 2 : RGB : 64, 10, 10
Result : RGB : 128, 90, 110
Do you understand ?
Is there someone that know how I can do this ?
EDIT : I've made changes to setup textures like opengl samples do. (source code edited)
in all case the texture remain dark excepted one where it appear bright but the result is not the one wanted.
Thank you.
Regards,
AmiDARK
I'd like to make textures combination using 2 textures (double-texturing) but I never get a good result.
I've found a tutorial explaining some of the requirements :
http://www.informit.com/articles/articl ... 9&seqNum=6
It seem well explained so, I did this :
Code: Select all
glActiveTexture(GL_TEXTURE0);
glEnable( GL_TEXTURE_2D );
TrueIndex = MyImagePTR->TrueImageIndex;
glBindTexture( GL_TEXTURE_2D, ImageTexture[ TrueIndex ] );
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
UpdateMyImagePTR( mRaster[ RasterID ].iRaster );
glActiveTexture(GL_TEXTURE1);
glEnable( GL_TEXTURE_2D );
TrueIndex = MyImagePTR->TrueImageIndex;
glBindTexture( GL_TEXTURE_2D, ImageTexture[ TrueIndex ] );
switch( Transparency ){
case 0:
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
break;
case 1:
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE );
break;
case 2:
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD );
break;
case 3:
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD_SIGNED );
break;
case 4:
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_INTERPOLATE );
break;
case 5:
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_SUBTRACT );
break;
case 6:
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DOT3_RGB );
break;
case 7:
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DOT3_RGBA );
break;
}
glActiveTexture( GL_TEXTURE0 );
Excepted case 4 for transparency where I only get the 2nd texture really dark.
Do you know exactly what can cause this ?
The wanted result is absolut adding of RED, GREEN & BLUE.
For example:
Texture 1 : RGB : 64, 80, 100
Texture 2 : RGB : 64, 10, 10
Result : RGB : 128, 90, 110
Do you understand ?
Is there someone that know how I can do this ?
EDIT : I've made changes to setup textures like opengl samples do. (source code edited)
in all case the texture remain dark excepted one where it appear bright but the result is not the one wanted.
Thank you.
Regards,
AmiDARK