PDA

View Full Version : Texture Memory and PC memory issue



Luca Vacchetti
07-29-2004, 02:23 PM
Hi everyone,

I guess I have a problem with the texture memory management on my machine.
I make some textures using the code you can see attached at the end. On one machine, my Toshiba laptop, the application takes 14Mb, as it is supposed to be. On another desktop machine it takes 54Mb. It is like every single texture is in the main RAM.
Both machines are running XP, the laptop has a cheap shared-memory card (and it runs slow) and the desktop has a Nvidia GeForce FX5200 and it runs smooth at 5% cpu.
I need not having such a big memory consumption since I want to run many instances of the same program. Btw the textures could be shared between the different instances of the program ( is it possible?)
Thanks in advance for help.
Luca

glPixelStorei(GL_UNPACK_ALIGNMENT,4);
glGenTextures(1,&texName);
glBindTexture(GL_TEXTURE_2D, texName);

if(alphaExists)
{
glTexImage2D(GL_TEXTURE_2D, 0, 4, textureImage>width,textureImage->height, 0, GL_RGBA,GL_UNSIGNED_BYTE, textureImageAlpha->imageData);
}
else
glTexImage2D(GL_TEXTURE_2D, 0, 3, textureImage->width,textureImage->height, 0, GL_RGB,GL_UNSIGNED_BYTE, textureImage->imageData);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R, GL_LINEAR);

if(alphaExists)
cvReleaseImage(&textureImageAlpha);
cvReleaseImage(&textureImage);

147-2
08-01-2004, 10:30 AM
Looks like the textures are paging in and out of memory, or the memory is set up for texture paging, perhaps its the NVidia drivers that are keeping your textures alive in your main memory. Now, I am almost sure you can't share textures between processes, but then again, I could be wrong.

Luca Vacchetti
08-03-2004, 06:39 AM
Thanks, you are right, the driver should the responsible, he may keep things in memory in some way. I was using two screens and now I switched to one only and it takes much less memory.
Luca

Obli
08-03-2004, 12:16 PM
Originally posted by Luca Vacchetti:
Btw the textures could be shared between the different instances of the program ( is it possible?)It should be possible by using render context sharing. Under windows it's enabled by wglShareList. The problem however is that you need to find a way to get the instances speak to each other to pass the requested data.
Depending on the robustness of what you need it could take a while. In terms of development time & effort I mean.