Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Esap1

Alternatives to D3DTextr_CreateTextureFromFile()

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

Im using D3DX7 and cant get D3DTextr_CreateTextureFromFile() to work and I wanted to know any other simple ways of loading textures, thanks a lot

Share this post


Link to post
Share on other sites
Advertisement
See the "Using Direct3D to accelerate you 2D iso engine" or something like that. It describes how to load textures.

Share this post


Link to post
Share on other sites
The functions in there use DDraw4 or something, and it really messes with my program, Im using Dx7, isnt there a Texture Function in D3DX Util, or something, please help, thanks.

Share this post


Link to post
Share on other sites
You can use D3DXLoadTextureFromFile()

It supports BMP, DIB, DDS and TGA.

(You know it didn''t take me more than 1 minute to find this function in the SDK Doc, even though I had never seen it before. Just a tip )

Share this post


Link to post
Share on other sites
You know Spellbound, I looked, and dumb me, I couldnt find it, but if you never used it, what do u use?

Share this post


Link to post
Share on other sites
I never used it before, because I haven''t had any time to start using DX7 yet. All my older programs use DX6 so I was forced to either make my own loading routine or use D3DTextr_CreateTextureFromFile(). I chose to use D3DTextr since there is no sense reinventing the wheel.

When I finish my master thesis (hopefully this month) I will again have time to work on my own projects. Then I will try to use D3DX as much as possible because I think it is a really great addition to DX, it does almost everything that you had to write your own library for before.

Share this post


Link to post
Share on other sites
Should this work?
D3DXCreateTextureFromFile(m_pD3DDev, 0, 0,0,(_D3DX_SURFACEFORMAT*)D3DX_SF_UNKNOWN,NULL,&Texture, NULL, "test1.bmp", D3DX_FT_LINEAR);

This Doesnt Seem to work, after this, I put a SetTexture(0,Texture); and it doesnt work, what Am I doing wrong, anything obvios?

Share this post


Link to post
Share on other sites
How is Texture declared? The function wants a pointer to a pointer to a surface.

Maybe you must specify a pointer for pNumMipMaps instead of NULL. (I don''t think you have to, but as I haven''t tested myself I don''t know)

Do you get an error when calling the function or when you set the texture?

Share this post


Link to post
Share on other sites
Im Just Declaring Texture like
LPDIRECTDRAWSURFACE7 Texture;

An I neither function returns an error, its just the polygon is black, with no texture on it, I pretty sure I have the Texture Coords right and I can see the Triangle, but its just black.

Share this post


Link to post
Share on other sites
I don''t know if this is your problem, but with DX7 lighting is on by default and if you don''t add any lights all triangles will be black when rendered. Try disabling lighting with SetRenderState(D3DRENDERSTATE_LIGHTING, FALSE);

You may otherwise take a look at the D3DX samples that come with the SDK and see how they do the texturing.

Share this post


Link to post
Share on other sites

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