Advertisement

How to do a simple texture in D3D?

Started by September 30, 1999 05:07 AM
1 comment, last by nPawn 25 years, 3 months ago
First I should say that with the advent of DirectX 7 you no longer have to create a separate texture interface--it accepts DirectDrawSurfaces as the parameters to texturing functions.

As far as the older versions of DirectX are concerned, you obtain a texture by querying its interface from a surface.

surface->QueryInterface( IID_IDirect3DTexture2, (void**)&texture );

Also, the Direct3DX utility library that comes with DirectX 7 (it's actually part of DirectX, not just some .h files thrown in as an afterthought) has functions for loading textures from .BMP, .DIB, .TGA, and .DDS file formats, not to mention about a hundred other incredibly useful functions.

[This message has been edited by Shinkage (edited September 27, 1999).]

i've been working my way through the triangle tutorial and want to apply a texture to it. I however don't want to use the d3dutil texture functions to set a texture as i have my own graphics loader that works with targas not bitmaps.

The question is, I have a nice LPDIRECTDRAWSURFACE loaded up with an image ready to go, and i want to get this into a LPDIRECT3DTEXTURE2 structure for use with pd3dDevice->SetTexture, how do i get this directdrawsurface into the form of a texture2? I tried to follow this transition in d3dutil but the vars get passed around so much i get lost. Any ideas or code snippets that does this?

Advertisement
Make sure your texture sizes are all powers of 2, ie 64*64, 128*128 etc. I was stuck on that for days (well hours).

This topic is closed to new replies.

Advertisement