Sign in to follow this  

Mesh is not visible (only a few code lines)

This topic is 4859 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[i] );
        D3D_Device->SetTexture(0, ptrMeshTextures[i] );

        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
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

This topic is 4859 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this