Jump to content
  • Advertisement
Sign in to follow this  

a texture management problem

This topic is 4947 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Recently, i'm involved in writing a game engine, and after i finish a primitive of my engine, i try to build a small car game. However ,when i test the car game with a beautifully-made race track(with a lot of textures), i found that the fps dropped dramatically when texture load and unload, anybody can suggest me a good method to manage the texture objects in opengl when we have a large amount of textures objects that the texture memory of the graphic card can't hold thx....

Share this post

Link to post
Share on other sites
Depending on your card you might want to use texture compression (S3TC/DXT) or down-sampling textures. If that doesn't help then you need to introduce some kind of streaming so you only load textures for the object that are in some radius from camera. But first of all you should make sure you don't load any texture more than one time.

Share this post

Link to post
Share on other sites
You should pay attention to Nvidias mantra, batches batches batches.
The more batches the slower it will run.
1 batch = 1statechange+drawprimitives.
Or basicly a statechange happens when you change the texture.
and draw primitives is any number of polygons that folows the statechange.

so basicly you need to reduce the number of textures for every frame.
You could do this by combining several textures into one big one(unless they are repeating that is).
allso you could check if you can reduce the resolution of some textures, 1024x1024 textures can not be motivated everywhere.
if you use 256x256 each texture(RGB) take up around 200Kb
512x512 is around 800KB
1024x1024 is about 3,2Mb

I hope this gives you some guidelines.
and to give you some perspective, on a PS2, the memory left for textures is about 750Kb, so feel lucky.

Share this post

Link to post
Share on other sites
en, thx very much, i 'll take ur opinions into consideration,

another question is how to tell opengl to lock the texture in the texture memory of the graphic card??


Share this post

Link to post
Share on other sites
isn't that done automaticly when you create your texture, they only dissapear from there when you release/destroy your render context or manualy remove them by force.
That is unless you have an excessive amount of textures (and that's a lot of textures boys and girls), then some of them have to be loaded from system ram.
and i have only seen two games do this sometimes, HL2 and doom3 and that's only when you turn up the graphics real high.

Share this post

Link to post
Share on other sites
From the official spec:


glPrioritizeTextures - set texture residence priority

void glPrioritizeTextures( GLsizei n,
const GLuint *textures,
const GLclampf *priorities )

n Specifies the number of textures to be

textures Specifies an array containing the names of the
textures to be prioritized.

priorities Specifies an array containing the texture
priorities. A priority given in an element of
priorities applies to the texture named by the
corresponding element of textures.

glPrioritizeTextures assigns the n texture priorities given
in priorities to the n textures named in textures.

The GL establishes a ``working set'' of textures that are
resident in texture memory. These textures may be bound to
a texture target much more efficiently than textures that
are not resident. By specifying a priority for each
texture, glPrioritizeTextures allows applications to guide
the GL implementation in determining which textures should

Clicky for the entire Blue Book entry

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!