PDA

View Full Version : More RAM than video card memory...



TheDD
05-13-2001, 06:26 AM
Well, i have a question about texture memory. When you load a texture (from the disk), you put it in the RAM, then you call
eventually gluBuild2DMipmaps(...), and glTexImage2D(...).
Then what do i have to do? Have i to free the memory in the RAM? But if i have more RAM-texture-memory than video-texture-memory, are my textures going to get lost?
Help me please!!!

Number42

Nutty
05-13-2001, 07:30 AM
You do not need to keep a copy of the image yourself. OpenGL automatically keeps a copy of the texture in system memory to re-upload to VRAM should it get shifted out.

You should free your image after you've created the texture with it, unless you need it for anything else.

Nutty

richardve
05-13-2001, 07:38 AM
You only have to upload the textures once using gluBuild2DMipmaps() or glTexImage2D().
After that you can delete the texture because OpenGL has a copy of it (in video/AGP memory, whatever http://www.opengl.org/discussion_boards/ubb/smile.gif).

You're textures are not going to be lost when there's no memory left on the videocard, instead OpenGL keeps a copy in system memory.
When system memory is full, windoze is going to trash http://www.opengl.org/discussion_boards/ubb/smile.gif

In a game you shouldn't upload all textures at once, you have to stream them into videomemory with glSubImage2D() (or something like that, don't know for sure about the name).
This way, you can have way more textures :P

Anyway, forget the last part of what I said for now, just delete that texture http://www.opengl.org/discussion_boards/ubb/smile.gif

You can use glDeleteTextures(..) for deleting the texture in videomemory.

richardve
05-13-2001, 07:40 AM
Bah, I should get a faster connection... :P

Nutty
05-13-2001, 08:59 AM
hehehe.. http://www.opengl.org/discussion_boards/ubb/smile.gif

This streaming thing. Hows that work?
I assumed you just did everything using glBind, and provided you sort by texture you get maximum efficiency of system ram -> VRAM texture uploads per frame.

Does anyone do something different, to get better performance? If so, what, and why, and how much better is it. Come on we want to know.. http://www.opengl.org/discussion_boards/ubb/smile.gif

Nutty

richardve
05-13-2001, 09:57 AM
When you've got large big worlds with many textures you can't upload all textures of that world at once, so you have to upload them when you need them via glSubImage2D() and delete them when you don't need them anymore...
That's what I meant with streaming http://www.opengl.org/discussion_boards/ubb/smile.gif

TheDD
05-14-2001, 04:20 AM
OK, thanks guys!

TheDD