So… I’m working with SDL/OpenGL, and I’m trying to create a 2d application. I have most of the display code up, but I’m running into a grey area. I have an image on the screen (a textured quad), and what I want to do is keep drawing lines and dots to it over time.
The image data is stored in an SDL_Surface object - it contains some information about the format of the image, and then the pixel data. It starts out as a black image, so I pass this pixel data and the correct flags to the glTexImage2D function (after calling glGenTextures and enabling 2d textures and what not).
After I change the pixel data in the SDL_Surface object… how do I get that information back into a texture? I haven’t seen a function to delete a texture, and it seems like I’d be at risk for a memory leak if I just called glTexImage2D again (the image changes size as the screen resizes, so there’s different amounts of pixel data as well as different pixel data).
So… is it OK to call glTexImage2D to overwrite a texture?
[also, first post. Hi! I’m neurofuzzy.]