Page 1 of 1
OpenGL Sprites
Posted: Sat May 10, 2008 4:04 pm
by Moosader
So, as some peoples know, I'm attempting to remake ET in OpenGL and SDL. o_o
Instead of having 3D models or anything for ET and the baddies, I want to have flat 2D sprites like this:
I know how to load textures, but I don't know how to set a certain area to transparent. Do I need to figure out how to check each pixel on a texture and replace, say, (1.0, 0.0, 1.0) with ... nothingness. 0.o;
I don't know. I assume there's a function in OpenGL to turn an image partially or fully transparent, and I just need to do that for the appropriate pixels.
Posted: Sat May 10, 2008 4:13 pm
by eatcomics
Oh look, a Gay Pride Square!!! those are growing indangered...
Posted: Sat May 10, 2008 4:32 pm
by Falco Girgis
. . . I have a certain fondness for that square.
The way we did it was really easy. Our PNG library: glpng handles transparencies itself. You just load it as being a transparent PNG. That's what I recommend you look into, because I'm not a big fan of hardcoding transparencies.
Posted: Sat May 10, 2008 5:06 pm
by Moosader
Ah, sounds good then!
And yep, I colored it like a gay pride square on purpose. :D
Posted: Sun May 11, 2008 8:11 pm
by MarauderIIC
You can also do masking.
And you can use an 'alpha channel'
Posted: Fri Jun 20, 2008 8:43 pm
by Moosader
GyroVorbis wrote:. . . I have a certain fondness for that square.
The way we did it was really easy. Our PNG library: glpng handles transparencies itself. You just load it as being a transparent PNG. That's what I recommend you look into, because I'm not a big fan of hardcoding transparencies.
About GLPNG -- It requires GLUT as well? So are you using OpenGL, SDL, AND GLUT for the game?
Posted: Fri Jul 11, 2008 3:50 am
by marmalade
:guffaw: The gay pride square, I remember someone commenting in one of the earlier Adventures in Game Development videos about that.
As for the question, I have no idea. I'm too horrible at programming to even
think of coding in OpenGL.
I am not worthy!
Posted: Fri Jul 11, 2008 9:05 am
by cypher1554R
I'm not sure.. can you load a .png format texture (which contains alpha values) and setup the program for alpha blending to achieve that..?
PS: As far as I know you can't geometrically modify the texture..