Need help with a black Tiger

Hi All,
I need help with a black tiger.

I am using DirectX 9.0 SDK (August 2005)

I used the Sample Browser to install new SimpleSample C++ project as a basic starting point.

The only changes I added were as follows...

//--------------------------------
// Global variables
//--------------------------------
CDXUTMesh g_Mesh; // mesh

//--------------------------------
OnCreateDevice()
// create the mesh
LPCWSTR strFilename = L"tiger.x";
V_RETURN( g_Mesh.Create( pd3dDevice, strFilename ) );

//--------------------------------
OnFrameRender()
g_Mesh.Render( g_pEffect );


//--------------------------------
OnLostDevice()
g_Mesh.InvalidateDeviceObjects();


//--------------------------------
OnDestroyDevice()
g_Mesh.Destroy();

I copied the tiger.x and tiger.bmp into my project folder

No other changes to the project.

When I run the application, I can see the shape of the tiger and rotate it with the mouse, but its all black.

Shouldn't the CDXUTMesh class handle the texture loading and rendering

I tried to load a texture and use SetTexture() it didn't help.

Is there something else I am missing so I can see the tiger with its texture

Much Thanks in advance!



Answer this question

Need help with a black Tiger

  • LccTom

    Thank you for the reply Pieterg.

    I added this to disable lighting...

    OnResetDevice()
    {
    ...

    pd3dDevice->SetRenderState( D3DRS_LIGHTING, FALSE );
    }

    It didn't help.

    You mentioned the vertex format, shouldn't the CDXUTMesh class take care of that

    I also tried to load the texture explicitly and call SetTexture()
    OnCreateDevice()
    {
    ...

    // Use D3DX to create a texture from a file based image
    if( FAILED( D3DXCreateTextureFromFile( pd3dDevice, L"tiger.bmp", &g_pTexture ) ) )
    {
    MessageBox(NULL, L"Could not load image file.", L"SimpleSample.exe", MB_OK);
    return E_FAIL;
    }
    }

    FrameRender()
    {
    ...

    pd3dDevice->SetTexture( 0, g_pTexture );


    // i also tried
    g_pEffect->SetTexture( 0, g_pTexture );

    g_Mesh.Render( g_pEffect );

    }

    These changes didn't help.

    I can rotate the tiger, etc, but it still renders black.

    The Tutorial 6: Meshes with the spinning tiger with texture works fine.

    For the SimpleSample, Do I need to edit something with the shaders, effect framework, or fx file

    The main question is: How would one take the SimpleSample project, load the tiger mesh, and have it render with its texture

    Thanks for the help. If you need more information let me know.


  • BitBasher

    Hello, I met the same problem too.

    Have you solved it yet

    Please, tell me if you can:)

    Thank you very much.

    My email: stanley.suntao@gmail.com



  • chaosvg

    The only reason you might find that you have a black tiger is one of the following reasons.

    1) Your lighting is enabled but no lights are set/active.
    e.g.
    Device.RenderState.Lighting = false; //disable light

    2) Incorrect vertex format set. This may result in other obscurities too.

    3) You haven't loaded and set the texture
    e.g.
    Texture texture = TextureLoader.FromFile(...);
    Device.SetTexture(0, texture);

    Just check the following in your source/project.
    I hope this helps.
    Take care.


  • A Wilco

    You have indicated that the mesh tutorial is functional, you may wish to

    compare the Init and Render functions from it to your project and note

    the differences. Also if you plan to do some serious work with Graphics

    and Direct3D, it would be wise to read up on the subject. Frank Luna has

    a good book that covers Direct3D and Graphics rather well. The Internet has

    many tutorials and papers as well to download. One very good site is the

    CodeSampler site.



  • flipdoubt

    Moved to "DirectX 101" forum.

  • Need help with a black Tiger