Direct3D textures

Hello all,

I have created an application with D3DX9. My application displays text on the faces on 400 cubes using Textures. The heights of the cubes are changed every 100 milliseconds (in OnTimer call). I display text using the following sequence of calls (pseudocode is below):

OnTimer()
{
for (i=0 to 399)
{
if(texture[i] != NULL)
{
texture[i]->Release()
texture[i] = NULL
}

CreateTexture(texture[i])
MyFont->DrawTextA(texture[i], word[i])
CreateMeshObject(cube[i]) //Cube height changes for every OnTimer call.
cube[i]->SetTexture(texture[i])
Render(cube[i])
}
}

This code hangs after a few calls to OnTimer. My VRAM seems to be hogging up. Calling the Release for texture does not seem to be really releasing the memory in VRAM. Am I doing anything wrong here? Is there a better way to display text on the cube's face? Does D3DX11 have a better way of doing this? Any suggestion is welcome.

Regards
STX970
Try to store your textures.
Generating them every frame is really expensive and useless, and is probably the reason the VRAM goes so high, because memory may be freed in a second time.
U change ur textures too fast... Every writting that CPU has to do to VRAM is expensive. Store them once and then use them as you need them.
Topic archived. No new replies allowed.