Jump to content
  • Advertisement
Sign in to follow this  

Problem loading texture uv coordinates from mesh

This topic is 4413 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

Hello I'm working on a space game in DX9, and now I'm trying to load mesh texture uv coordinates into my game, but something is wrong. I'm modelling my meshes in 3D Canvas Pro and then I export them in .x files. When I open the mesh with the DirectX Viewer it looks like this... Free Image Hosting at www.ImageShack.us ...but when I render it in my game: Free Image Hosting at www.ImageShack.us the code that I'm using to load a mesh (I want to load only the vertex data, textures and materials are added ingame):
D3DXLoadMeshFromX( "3d/asteroids/ceres.x", D3DXMESH_SYSTEMMEM, g_pd3dDevice, NULL, &g_pD3DXMB, NULL, NULL, &g_mCeres )
for rendering:
void RenderAsteroid()
	g_pd3dDevice->SetTexture( 0, g_tCeres );

	D3DXMatrixTranslation( &matTranslation, 20.0f, 20.0f, 10.0f );
	D3DXMatrixScaling( &matScalation, 10.0f, 10.0f, 10.0f );
	D3DXMatrixMultiply( &matWorld, &matScalation, &matTranslation ) ;

	g_pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld );

What am I doing wrong ? Any help is welcome :)

Share this post

Link to post
Share on other sites
The code looks correct to me. I'd guess theres something wrong with the texturecoords that's causing it to display differently than in DX Viewer.

I'd try setting the Sampler State's wrap mode to wrap:

mDevice->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP);
mDevice->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP);

Hope this helps :).

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!