a texture management problem

Started by
4 comments, last by Steve132 18 years, 10 months ago
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....
Advertisement
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.
You should never let your fears become the boundaries of your dreams.
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.
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??

thx
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.
From the official spec:

Quote:
AME
glPrioritizeTextures - set texture residence priority


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


PARAMETERS
n Specifies the number of textures to be
prioritized.

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.

DESCRIPTION
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

This topic is closed to new replies.

Advertisement