Jump to content
  • Advertisement
Sign in to follow this  
chennaiaras

loading X file in window

This topic is 2808 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 all,

I am trying to load an X file(globe.X) into a window.

This is my coding ..


// set camera
createcamera(1.0f,750.0f);
cameraposition(D3DXVECTOR3(0.0f,0.0f,-450.0f));
camerafocus(D3DXVECTOR3(0.0f,0.0f,0.0f));




bool loadglobe() {
hr=D3DXLoadMeshFromX("globe.X", D3DXMESH_SYSTEMMEM, d3ddev, &gadjacencybuffer, &gmtrlbuffer, NULL, &gnummaterials, &gpymesh);

if(FAILED(hr)) return false;

D3DXMATERIAL* gmatxmaterials=(D3DXMATERIAL*)gmtrlbuffer->GetBufferPointer();
gmatmaterials = new D3DMATERIAL9[gnummaterials];

for(DWORD i=0; i<nummaterials; i++) {
gmatmaterials=gmatxmaterials.MatD3D;
gmatmaterials.Ambient=gmatmaterials.Diffuse;
}
return true;
}



It gives the output a plain black screen.. The X file is loading since the variable hr works..

Thanks,
aras

Share this post


Link to post
Share on other sites
Advertisement
Could be a lot of things.

First: where do you set the value for nummaterials? You should be using gnummaterials.

Is the camera pointed at the mesh? Is the mesh large enough to see at the camera position? Is your camera created correctly? Do you set the projection and viewport correctly? Do you draw the mesh? What renderstates do you set when you draw the mesh? If you create a mesh with D3DXCreateSphere/Cube/etc., does it appear correctly?

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!