Using Sprites and Masks
Hello. I am new to these forums, but don''t consider me a newbie. I have been using computers since I was 6 and just starting programming in C++ a few years ago. Thanks to NeHe and his site, I have also learned how to use OpenGL with C++. I am currently creating a full-fledged RPG using C++ and OpenGL. We (me and my 2 friends thaat are doing the other aspects of the game) decided that at first we will use 2D graphics with a few 3D graphics in some places for the base of the RPG. We will be using "tiles" for the maps, towns, and characters. What I need to know is if there is a way to load a background texture (such as the overworld tiles) and then place another tile over that one (maybe using masking of some sort) without destroying the previous tile? Remember, this is just as a base for the game, and this game will take a few years to create. We are not trying to slap together a complete RPG in just a few days/months. When we do get the base down, then we will switch to 3D graphics. From what I have discused with other, in RPGs, storyline is more important that graphics. So we are going to have a kick-ass storyline, but crappy graphics at the beginning.
Could someone please help me out with this one?? I really need this in order to program my RPG.
Another thing: Can I load a PNG file with C++ and get the alpha channel and use that to create a mask? I made a sample graphic that is 16x16 and has an alpha channel that contains a mask that I made using PSP6. Will this work?
yep just create an alpha channel in your texture and use alpha testing when u render it on screen.
im using the libpng for png textures thers a few examples of its use on me site
http://members.xoom.com/myBollux
im using the libpng for png textures thers a few examples of its use on me site
http://members.xoom.com/myBollux
Can you tell me where to get libpng? I''m asuming that I need to use a search engine. I''m about to search for it and if I don''t find it you can tell me.
OK, I found out wher libpng is. Now, what I need to know is how to make use of the Alpha Channel in my PNG file. Also, is there any place with tutorials on how to use libpng? Thanks.
I was looking through the readme for libpng, and it seems that it is much more difficult then using bitmaps. The thing is that bitmaps don''t have alpha channels. I need to know how to use libpng to display the image using the alpha channel as a mask to make the back of the image transparent.
Does anyone know how to do this?? Or are you all just ignoring this post?!?!
you could try using TGA files, dealing with them and alpha is much easier imo
Write a .bmp loader that adds an alpha channel to the image.
That''s not hard to do, all you really have to do is make a
structure that holds the rgb values and an alpha value.
Then you create an array on that struct. Load the image and put
the rgb values into respective location and add a fictive alpha
value, and voila, you have converted the image from rgb to rgba.
Allmight.
That''s not hard to do, all you really have to do is make a
structure that holds the rgb values and an alpha value.
Then you create an array on that struct. Load the image and put
the rgb values into respective location and add a fictive alpha
value, and voila, you have converted the image from rgb to rgba.
Allmight.
-------------------------------------------------Founder and DirectorAllSoft Studios
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement