Sign in to follow this  
PG

OpenGL sprites....

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this