(I’m reposting this message since the original doesn’t seem to have been
posted, if this ends up a duplicate, I apologize)
First off I’d like to say that I do know and understand that using
SDL_SetColorKey does not affect OpenGL Textures. That is not my
question/problem. I also know and understand that OpenGL does not have any
sort of function that resembles in functionality that of SDL_SetColorKey.
With that being said, here is my problem.
I’m working on a simple 2d game. I’m using it to teach me mixing SDL with
OpenGL. I have a 24bit bitmap of a ship with black as the background. With
SDL drawing functions I can simply set black as the colorkey and not worry
about it. However, I’ve spent the last few months googling for code to get
something similar to work with OpenGL. All the code I have found ends up
leaving a black box around my ship. I’ve just recently attempted to use the
getpixel/putpixel method to parse the pixels and set alpha to the colorkey I
wish. But it still failed. I’ve used pngs with the backgrounds with the alpha
set to 0. But I’m guessing the surfaces are somehow dropping the alpha data
when I do the poweroftwo conversion for the OpenGL Textures and then blitting
to a new surface (shouldn’t happen but I cannot think of what else is causing
From all I’ve read it must be common knowledge on how to do it since there are
no tutorials. That, or else it is impossible (which I very well doubt).
So my request:
Please, anyone who knows how to accomplish what I’m attempting, please post
code to initialize OpenGL, convert an SDL_Surface to an OpenGL Texture, or even
the drawing functions used. Or what ever might be involved in getting rid of
the boxes around the textures. I’m assuming I’m just forgetting to enable some
option, or set some value. But I cannot find anywhere on the Internet that
just comes out and tells it all plain and simple. I guess I need something
from start to finish so that I’m not missing something so brain numbingly
Or, if what I am attempting is in truth not possible, please let me know so I
can stop pulling out my hair.
Thanks in advance for any assistance,