Skip to main content
gamedev.net
🔒 Locked

Quick texture question

Started by Empirical 7 replies 1.2k views
Original Post
Empirical
Empirical
If i load lots of textures, but only use some at a time, will openGL manage them for me i.e swap them in and out of the video memory as required. Or should I delete/load them only as they are required?
Samith
Samith
No, when you load them, they stay in memory. Unless you're using pretty big textures or a lot of textures, having a few loaded that you don't use much won't be that bad.
Empirical
Empirical
Thanks, but my question (i obviously put it badly) was how does openGL handle a large number of textures. More than can fit in video memory? Say i have 100 textures, only 25 will fit in memory, but i only use 10 at any one time. Will openGL swap them in and out automaticly if a load all 100 at the start?
_the_phantom_
_the_phantom_
yes, OGL will automaticaly deal with making textures resident on the graphics card.

however, you can make life easier by not having textures loaded you wont need.
C-Junkie
C-Junkie
It took me a surprisingly long time to find something that even vaguely refered to this.

Odd.
JoeCoder
JoeCoder
I think there's an extension somewhere to set texture priorities, but I think the vendors all handle it differently, so it may not be worth it.
------------------------------yage3d.net—a free 3D game engine written in D.listpod.net—a community powered web 2.0 site of lists.
kburkhart84
kburkhart84
In reality, you shouldn't have a problem, what would be, OGL does for you. To control memory problems, do it like you may have done with tile game engines. Load the textures you know you need for the moment, like per level/world, then when done, delete them and load the new ones for the next dungeon etc... Besides that, OGL handles the video card part of it.


hplus0603
hplus0603
The OpenGL specification is pretty explicit about the fact that OpenGL preserves all the texture images you've successfully specified, and pages as necesary (although the paging algorithm is up to the implementation to decide).
enum Bool { True, False, FileNotFound };

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.