Jump to content
  • Advertisement
Sign in to follow this  
Jesder

OpenGL Masking / Blend Question

This topic is 4333 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

Hi Guys, I am trying to recreate an old effect I had created years ago in Turbo Pascal - the ever eternal 3D Star field - as I come to grips with learning OpenGL. I have created a small bitmap - 128x128 which represents each star. The bitmap contains a small round shaded dot in the center (representing the star), with the rest of the texture being pure black. I have the effect up and running - but it does not look quite right. The problem I am running into is each time I render a star from the starfield to screen, the black from each star is also being written, and often overwritting surrounding stars. While this does leave a kind of neat sparkle effect - It isnt right and is something I want to fix. I have been playing around with the glBlendFunc call, but with no luck. Is there a way within OpenGL to tell it NOT to write pure black texels from a texture? Am I on the right track with blending? Would this be better converting the bitmap into another format and using an alpha channel? Any advice would be appreciated. Cheers, Andrew.

Share this post


Link to post
Share on other sites
Advertisement
You can tell OpenGL that your greyscale texture is actually an alpha map (GL_ALPHA format).

Then you will also be able to specify the color of the stars as the vertex colors.


Or you could use additive blending where black would be added white spots (and thus those white spots will stay).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!