Jump to content
  • Advertisement
Sign in to follow this  
PG

OpenGL sprites....

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

hello there... i just wonder, if we can load sprites (.bmp or .png) with no background... without using masking technique... and of course using openGL library :D thanks... [Edited by - PG on May 1, 2006 7:35:16 AM]

Share this post


Link to post
Share on other sites
Advertisement
Sure. Create a texture and render the sprite in glOrtho mode as a textured quad.

You WILL want to use an alpha test. That IS what tells OpenGL to apply transparency to your sprite, otherwise it's a big rectangular block. In the case of a png though, the alpha channel might take care of it.

Share this post


Link to post
Share on other sites
You can try writing a function that iterates through each pixel in your image file , and blits each pixel except the ones of a specific colour. (I don't recommend it though :D)

Share this post


Link to post
Share on other sites
hehe.. thanks...
i once think about iterating for each pixels.. but i have to understand each kind of image format.. (whew..) it's kinda takes a lot of time hihi...

Share this post


Link to post
Share on other sites
Once you have loaded the image into uncompressed color data, you don't need to worry about the format (as long as you know the bits per channel).

TGA is a good replacement for BMP, it will store your alpha channel so you don't have to do pixel manipulation.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!