Wednesday, March 11, 2009

Texture Pixel Data...

I've changed the functionality of the Texture struct in ArcLib. Now it will save the SDL_Surface* pixel data by default, and if one doesn't need to manipulate this data, you need to call

texture.freeSDLSurface();

If one want's to access this data

SDL_Surface* img = texture.getSDLSurface();

And if one want's to re-set the SDL_Surface data of an image

texture.setSDLSurface(img);

The behavior of setSDLSurface re-uses the image's OpenGL ID number, so all images bound by that ID number will change.

Edit: Changed the default behavior to not save the SDL surface. If you want to keep the SDL surface, use
Texture t = Texture("tname.png", true); // true sets the bool keepSDLSurface, which defaults to false

No comments: