TechSpot

Textures in Direct3D to display text on cube face

By stx970
Oct 29, 2013
Post New Reply
  1. 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 != NULL)
    {
    texture->Release()
    texture = NULL
    }

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

    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
     


Add New Comment

TechSpot Members
Login or sign up for free,
it takes about 30 seconds.
You may also...


Get complete access to the TechSpot community. Join thousands of technology enthusiasts that contribute and share knowledge in our forum. Get a private inbox, upload your own photo gallery and more.