PDA

View Full Version : Does glTexImage2D copy the texture data?



maximus-dev
04-26-2010, 10:08 PM
Sorry if this is a bit of an odd question, but I've not worked with Textures much so I need to double check.

When calling glTexImage2D and providing a pointer to the pixel data, is the data from that array actually copied elsewhere in memory or just pointed to? According to the behavior when the pixel value is given NULL (allocating texture memory based on the width, height and format), I would think it's copied but I just want to be sure.

Thanks,
Jeremiah

Xmas
04-27-2010, 03:24 AM
Yes, it is copied. You can safely free/delete the pixel data immediately after glTexImage2D returns.

maximus-dev
04-27-2010, 07:00 AM
Thanks for the quick and easy answer. Glad I checked... would hate to be sitting on two copies of the gfx in memory for no reason.

Take care,
Jeremiah