Results 1 to 5 of 5

Thread: Problem with D3DXMesh... Diffuse is not rendered

  1. #1

    Problem with D3DXMesh... Diffuse is not rendered

    Hi guys..

    I was trying to figure out how D3DXMesh works.
    So i made a test project based on one of clooties tut's.
    but I wasn't able to render the diffuse colors. :cry:
    I used the red/green/bleu triangle in the tutorial but the result was totally black.

    The files are located here

    Can anyone help me to figure this out

    Thanx in advance.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  2. #2
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    Problem with D3DXMesh... Diffuse is not rendered

    Never done anything with D3DXMeshes... I use my own mesh format. I think it's not as fast as D3DXMesh, but it works
    NecroSOFT - End of line -

  3. #3

    Problem with D3DXMesh... Diffuse is not rendered

    The behaviour you see (black triangle) is not related to ID3DXMesh at all. Black color is caused by Lighting calculated by D3D (and as you have not setted up any light sources - no wonder it returns black color). To fix it you have to disable D3D lighting engine.

    Here are fixed I've done to compile/fix code on mine Delphi7:
    [pascal]
    // (1) D3DXMESH_DYNAMIC, as WriteOnly will not work with Lock(DISCARD)
    D3DXCreateMeshFVF(1,3,D3DXMESH_DYNAMIC,D3DFVF_XYZ OR D3DFVF_DIFFUSE,g_pd3dDevice,fMesh);

    // (2) type cast
    fMesh.LockAttributeBuffer(D3DLOCK_DISCARD,PDWORD(P ));

    // (3) turn lighting off - I've added it in render loop - but can be added in initialization in your case
    g_pd3dDevice.SetRenderState(D3DRS_LIGHTING, iFalse);
    [/pascal]
    There are only 10 types of people in this world; those who understand binary and those who don't.

  4. #4

    Problem with D3DXMesh... Diffuse is not rendered

    Btw, why are you still using DirectX 8?
    There are only 10 types of people in this world; those who understand binary and those who don't.

  5. #5

    Problem with D3DXMesh... Diffuse is not rendered

    Thank you very much Clootie.
    Somehow I knew you would know the awnser.

    For now.. i am using DX8, but will upgrade to DX9 in the future. The problem is that i use a PC with a GFX card which only hardware-supports DX7.
    So i cant benefit from the new features in DX9.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •