texture management problems

Hi guys

Well, my engine is crashing and i’m pretty sure that the crash problem is something related with the textures.
I have about 10 diferent textures in my world, and around 1000 lightmaps (16x16 size ), and the engine crashes. If i don’t load one of those 10 textures, the engine runs nicely…, but i’m still having problems in believing that this is filling the video card memory, 32Mb of video card and it’s filled by this? The lightmaps aren’t even rgb, they are black and white (lumincance).
I think that putting all the lightmaps in one file, it should help, but even so, can you understand what’s wrong here ??
Is there any texture management that could be done to avoid a crash ??

Bruno

You wouldn’t happen to be using Visual C++ in debug mode would you? Also, what graphics card do you have?

Yep, Visual C++ in debug mode with a Diamond Viper2, 32 Mb

Don’t ever look for performance in debug mode!

You should always use release mode, which allows optimizations.

Assuming you’re using VC++ 6, here are some other suggestions:

  1. set the processor type to Pentium Pro (this includes PII’s) - otherwise you won’t get the advantages of improvements since the PMMX came out. If you pick “blend” the PMMX set actually gets used. (growl)

  2. set the data strucutre size to 16, or 32 if it’s ever available. This increases the size of your file, but makes it run more smoothly on PII and later cpu’s.

  3. set the compiler to from _inline only inline functions to “any suiteable” - again you’re trading size for speed, but it’s generally worth it.

Cheers,
Andrew

Originally posted by outlander78:
[b]Don’t ever look for performance in debug mode!

You should always use release mode, which allows optimizations.[/b]

He’s not looking for performance, he’s trying to keep it from crashing

I don’t think texture management could really have anything to do with this. Even if you have more than 32 MB of textures, you should be perfectly safe. Double-check if you supply correct parameters to glTexImage(). If that’s not it, you might have to look elsewhere for your bug. What kind of error are you getting, anyway?

  • Tom

Hi guys
Thanks for all the answers

I have debugged the code, and this is so far what i have:
The engine is a portal engine, and the main render function is r_portal(position).
The program goes trough this function and does everything allright, in the next iteraction the program simply stalls in a glEnd() of a glBegin(GL_TRIANGLE_STRIPS).
The screen the just halts, and the rendered portal is rendered but without multitexturing and a windows message saying “Unknown error in application”.
The strange thing, is that for a test, i tried to change my bitmap loading routines with OpenIL routines and it works without problems, so the problem must be in my bitmap/texture generation routines.

This is my texture loading routine(NEHE code).
Do you guys see any problem here?

#define TEXTURESPACE 20
GLuint texture[TEXTURESPACE];
AUX_RGBImageRec *textures[TEXTURESPACE];

GLvoid LoadGLTextures(GLuint texnum, TCHAR* szFileName)
{
// Load Textures

textures[texnum] = auxDIBImageLoadA(szFileName);
if (!textures[texnum])
{
MessageBox(NULL,"Texture file not found!!","ERROR",MB_OK|MB_ICONEXCLAMATION);
	exit(1);
}

// Create Linear Filtered Texture
glGenTextures(1, &texture[texnum]);
glBindTexture(GL_TEXTURE_2D, texture[texnum]);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR );
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);

gluBuild2DMipmaps(GL_TEXTURE_2D, 3, textures[texnum]->sizeX, textures[texnum]->sizeY, GL_RGB, GL_UNSIGNED_BYTE, textures[texnum]->data);

}

Thanks

Bruno