PDA

View Full Version : Sprites, Etc.



Krak
05-15-2003, 12:40 PM
To add 2D sprites to a program, you could make a rectangle with the texture of the character, right? Well, how do you get rid of that background in the image of the character, leaving only the character?

Do you need some sort of mask?

Could someone explain how to do this? Plus, I'm still a little crappy on how to do bitmap textures...I read some of NeHe's tutorials, and some other ones, but I'm still kinda lost.

I still don't really understand how exactly OpenGL and Win32 work. Does everyone actually remember all that crap you need to set up the window, or do they just usually copy and paste it?

From what I understand,(please correct me if I'm wrong) but OpenGL is a library you can use to 'tap' into your comp's GDI with a Rendering Context, via some sorta of Device Context?

Anywho, do you know where I could possibly find some OpenGL tutorials that even a total idiot would understand? I've done C++ for a little while, and I know how to make DOS apps and such, and I'm comfortable with the rules and regs of the language for the most part, but this whole OpenGL thing confuses me a little.(mainly the setting up of the window, I guess)

nexusone
05-15-2003, 07:00 PM
It is called an alpha mask, in whick area's on the mask are made transparent.

Nehe has a very good tutor on it, lesson 32 show's you how to do just what you have asked.

If you are lost you need to start at lesson 1 and work your way up.

Back to the Alpha mask, I use Paint Shop pro to create my texture with a Alpha channel.

I sure there maybe other programs that will let you do this, but paint shop pro I know does.

Just bring in the image you want to create a mask from and use the mask tool, then save the alpha mask. I use TGA format since it supports alpha mask, else you would have to create two BMP files, one the image file and the other the mask file.

You may want to look at using GLUT library to create your window, very easy to use and understand.
I have sample programs using GLUT on my website.
www.angelfire.com/linux/nexusone/ (http://www.angelfire.com/linux/nexusone/)


Originally posted by Krak:
To add 2D sprites to a program, you could make a rectangle with the texture of the character, right? Well, how do you get rid of that background in the image of the character, leaving only the character?

Do you need some sort of mask?

Could someone explain how to do this? Plus, I'm still a little crappy on how to do bitmap textures...I read some of NeHe's tutorials, and some other ones, but I'm still kinda lost.

I still don't really understand how exactly OpenGL and Win32 work. Does everyone actually remember all that crap you need to set up the window, or do they just usually copy and paste it?

From what I understand,(please correct me if I'm wrong) but OpenGL is a library you can use to 'tap' into your comp's GDI with a Rendering Context, via some sorta of Device Context?

Anywho, do you know where I could possibly find some OpenGL tutorials that even a total idiot would understand? I've done C++ for a little while, and I know how to make DOS apps and such, and I'm comfortable with the rules and regs of the language for the most part, but this whole OpenGL thing confuses me a little.(mainly the setting up of the window, I guess)

Leyder Dylan
05-16-2003, 12:38 PM
Check on my Website, I've a little example for displaying a sprite.
www.slug-production.be.tf (http://www.slug-production.be.tf)