Jump to content
  • Advertisement
Sign in to follow this  
Delryn

Mesh is not visible (only a few code lines)

This topic is 5043 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, Im new with D3D and at the moment I try to load a Mesh from a x file. The xfile is loaded correctly, the texture also. I think the whole method to load a xfile is ok(Queston: I know that I have to write 'an' if a word begins with a,e,i,o,u, but must I use 'an' too when the word sounds like it begins with an vocal? An xfile?). I want to render it like this:
void Engine::Render(Mesh *mesh)
{
    D3D_Device->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(255,255,255), 1.0f, 0);
    D3D_Device->BeginScene();            

    mesh->Render();
    
    D3D_Device->EndScene();                        
    D3D_Device->Present(NULL,NULL,NULL,NULL);
}

This method is called and I pass a pointer to an instance from the class "Mesh" (At the moment I only work with one mesh, otherwise this rendermethod would be moronic). "mesh->Render()" is definitely called, I tested it with a PostQuitMessage(0). This is Render() from the class Mesh:
void Mesh::Render()
{
    D3D_Device->SetTransform(D3DTS_WORLD,&MeshMatrix); 

    for(DWORD i=0; i<dMaterials; i++)
    {
        D3D_Device->SetMaterial(&ptrMeshMaterials );
        D3D_Device->SetTexture(0, ptrMeshTextures );

        ptrMesh->DrawSubset(i);
    }
}

The pointer to the D3D Device was passed in the constructor of the class Mesh:
Code:Mesh::Mesh(LPDIRECT3DDEVICE8 device)
{
    D3D_Device        = device;
        [...];
}

Light is also off. I dont know where my mistake is. Must I specify a vector where I want this Mesh to be rendered or ist 0,0,0 standard? I hope you could understand what I want, Im from Germany ;) Greetings Delryn

Share this post


Link to post
Share on other sites
Advertisement
When you say light is off I assume you mean lighting is disabled. Did you set up the the camera/view matrix? That's important.

'an' goes in front of vowel sounds. :)

Share this post


Link to post
Share on other sites
Have you set your view and projection matrices? The world matrix doesn't do much without the other two.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!