D3DXTexture

Started by
3 comments, last by Chetanhl 13 years, 5 months ago
Hi,

I want to load an globe into my game. So, I created a sphere and loaded into the window,no problem up to here. I downloaded a world.jpg (map image) and try to apply the texture on to the sphere.

No result there in the window.

// texture variable
LPDIRECT3DTEXTURE9 d3dTexture = NULL;

and in the winMain function before the message loop,

D3DXCreateTextureFromFile( d3ddev, "world.jpg", &d3dTexture );

do i need to do anything more than this..where is the flaw?

regards,
aras
Advertisement
Your sphere will need to have texture coordinates, and you will need to activate the texture.
Could be any number of things...

If you don't know how to use an API try finding a tutorial or read the documentation before posting for help.

http://www.directxtutorial.com/
Work through the examples in the SDK. Take note that DirectX functions give some sort of indication of success or failure. Check those error indications.

Avoid sites like www.directxtutorial.com that don't check error codes in their examples!

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

Check HRESULT values returned by every DirectX Function in your application, if any of them fails. Also you can check using some debugging tool (like Pix for Windows) values of Pre & Post VS vertices and see whether they include adequate texture corrdinates.
Also you didn't mention how you loaded the sphere , i mean importing from a X File or used D3DXCREATESPHERE function ?
D3DXCreateSphere doesn't create mesh with texture coordinates.

Again i am gonna agree with above replies go through DirectX SDK.

My Game Development Blog : chetanjags.wordpress.com

This topic is closed to new replies.

Advertisement