glTexImage2D() & memory understanding...

Moderator
Posts: 691
Joined: 2002.04
Post: #1
A quick query - when you pass the pointer to pixel data to the last parameter of glTexImage2D(), OpenGL creates it's own internal reference to the pixel data? So, as you're effectively now keeping two copies of the pixel data, you're able to just pass the pixel data pointer to free()?

Mark Bishop
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #2
Correct, unless you're using the GL_CLIENT_STORAGE_APPLE extension. (Perhaps someone more knowledgeable (Keith?) wants to explain further?)

Alex Diener
Quote this message in a reply
Moderator
Posts: 691
Joined: 2002.04
Post: #3
Thanks, that's all I needed to know; I'm not/won't be using GL_CLIENT_STORAGE_APPLE as I'm trying for cross-platform niceness.

Mark Bishop
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #4
It's a 70% texture upload speedup. Worth using if you animate any textures.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #5
client storage typically isn't difficult to slot into cross-platform code, so it might well still be worthwhile doing.

Without client storage, there are typically three copies of your texture, one in application memory (which you can free at will), one in driver memory, and one in VRAM. With APPLE_client_storage, you can cut that down to two (you become responsible for the driver copy), and with APPLE_texture_range you can sometimes cut it down to one (if the texture is better off in AGP memory).
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Understanding multisampled FBOs Coyote 12 8,406 Nov 27, 2009 01:01 AM
Last Post: arekkusu
  Understanding glColorMaterial PhysicsGuy 3 5,153 Nov 25, 2008 06:25 PM
Last Post: PhysicsGuy
  how to use Glubuild2DMipmaps, GlTexImage2D and glTexParameter 007gamer 1 4,254 Jan 31, 2007 04:36 AM
Last Post: OneSadCookie
  Minor issue with understanding ExitToShell 15 6,022 Jul 13, 2005 10:22 AM
Last Post: MattDiamond
  glTexImage2D bug? Skorche 1 2,868 Apr 12, 2005 01:28 AM
Last Post: OneSadCookie