Archived

This topic is now archived and is closed to further replies.

colour muck up

This topic is 5147 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 am making a tile based game and when i enable : glBlendFunc(GL_SRC_ALPHA,GL_ONE); glEnable(GL_BLEND); The colours i on the top two tile layers become really weird, and a lot lighter, as if the alpha value is apllying to whole thing when all i want is it to apply to get rid of the black parts of the images (which it is doing) does anyone have ne suggesiton as how i can get my images back to normal?

Share this post


Link to post
Share on other sites
It indeed make lighter, I noticed too with Nehe fonts..

But if you have alpha channel (or modulated color) try

glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);

This should work better

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by Gresc
no this doens''t work because then the black portions of my textures show up...


But you need alpha channel in your texture with values 0 in the black portions.. and with alpha channel you don''t need the black portions to be black anymore.

I just converted nehe rgb-font from lesson17 with gimp to have alpha channel.. there''s no black portions. All I have is all white texture with alpha channel writing the letters..

Share this post


Link to post
Share on other sites
The blending mode you used (GL_SRC_ALPHA, GL_ONE) adds the color to the frame buffer. Black doen''t show up like this because you can see black as a zero.

color + black = same color.

"Normal" blending looks a lot more like
finalcolor = texture_color * alpha + framebuffer_color * (1 - alpha)

whereas additive blending looks like
finalcolor = texture_color * alpha + framebuffer_color * 1

in case you don''t have alpha channels, 1 will be used for channels and thus, in that case, (GL_ONE, GL_ONE) will do the same as (GL_SRC_ALPHA, GL_ONE).

glBlenndFunc lets you specify the scale factors of both the source and destination color.

I hope that clarifies it a bit...



[ Bananas | My dead site | www.sgi.com | Goegel ]

Share this post


Link to post
Share on other sites