Ok, So I been searching up on how to make a Chroma Key but can't find any good documentation that actually explains it in a code format related to c++.
I'm looking at using one for a game I'm wanting to make to remove certain parts of a picture when needed. Just wondering if anyone has any good documentation on them or even better. Documentation on using them with C++ and SDL/openGL.
Well, I'm not sure about this, but isn't Chroma Key a color value to be made transparent within a given surface? If so, you can use this neat SDL function int SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key)
You can find more info about this function here: http://sdl.beuc.net/sdl.wiki/SDL_SetColorKey;
Here's some example code just for you to see how it works. Actually, this is the only piece of code which is used in all my SDL projects.
That's purely for loading an image though. Makes sense and what not. But I was going to be using mine in a situation of a game like Worms/Gunbound - Destroying the map and making certain parts not viewable or solid.
Cheers though, Having a look at the documentation now.
So, you mean making the image transparent at run time?
If so, I think you'd need to access the surface's pixel array and modify it according to your needs....
I guess you could load a surface with a given color key, and when part of such surface is destroyed (mine, rocket, dinamite etc...) you would go to that surface's "pixels" member and using some sort of algorithm you'd get a circular area of pixels, then it'd be a matter of setting their colors to the colorkey value.
Please note that this is pure speculation, I haven't realy tested anything yet.