Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 24 Mar 2006
Offline Last Active Oct 13 2014 04:10 PM

#5049073 Free texture image memory after binding it

Posted by TheKreature on 01 April 2013 - 09:42 PM

Yes, glTexImage2D is copying your image data.


Probably worth mentioning GL synchronization notes:

This stuff used to be a little different, and has improved immensely:


From: http://www.opengl.org/wiki/Synchronization

Legacy Note: The only OpenGL functions that behave differently are functions that end in Pointer​. When these use client-side memory (which is no longer permitted in core OpenGL), the pointers are stored for a period of time. During that period, they must remain valid.

These are usually used for rendering calls; in which case, once the rendering call has returned, the memory to be read from client data has been read. Modifications to client memory after the rendering call will only affect future rendering calls, not those that have already passed.
This is generally why Buffer Objects are better than using client memory for rendering. A rendering call with buffers does not have to handle the possibility of the user changing the memory later, so it can simply write a few tokens into the command stream. With client memory, it must copy all of the vertices out of the client-side arrays.