Alternatives to D3DTextr_CreateTextureFromFile()

Started by
14 comments, last by Esap1 24 years, 1 month ago
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
Advertisement
See the "Using Direct3D to accelerate you 2D iso engine" or something like that. It describes how to load textures.
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.
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 )
You know Spellbound, I looked, and dumb me, I couldnt find it, but if you never used it, what do u use?
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.
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?
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?

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

This topic is closed to new replies.

Advertisement