Simple Question: glColor4f() with glDrawArrays()

Started by
10 comments, last by L. Spiro 15 years, 4 months ago
Quote:Original post by KumGame07
Blending a texture with geometry color will work only if the texture has alpha channel in it. If the texture's alpha is 1 always, I don't think that BLENDing is going to work out for you.


This is both true and false. ;) It's possible to blend a texture with the environment without an alpha channel (IE; in a fading manner), but it's not possible to get transparent areas within the texture without an alpha channel or an alpha mask by using just GL_BLEND.

EDIT: BrotherBob already explained this.. Note to self; Don't write the reply and wait a few hours before pressing "Submit". ;)
Advertisement
Quote:Original post by KumGame07
Blending a texture with geometry color will work only if the texture has alpha channel in it. If the texture's alpha is 1 always, I don't think that BLENDing is going to work out for you.

However you can try blending the texture color with a constant color by setting the texture environment mode to GL_BLEND.

	glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_BLEND );	glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, color);


Now I am getting closer results but still off.


If I pass the following array:
GLfloat fCoolColor[] = { 1.0f, 1.0f, 1.0f, 0.0f };
glTexEnvfv( GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, fCoolColor );

My logo becomes pure white (alpha is ignored).


If I pass:
GLfloat fCoolColor[] = { 0.0f, 0.0f, 0.0f, 0.0f };
glTexEnvfv( GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, fCoolColor );

My logo becomes inverted (alpha still ignored).


My image has an alpha channel; it has transparent parts and partially transparent parts.



I will remember these effects for later as they are nice, but for now I just want this image to be partially transparent.


Thank you,
L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

This topic is closed to new replies.

Advertisement