texture mapping d3d/d3dx

Started by
3 comments, last by Verminaard 23 years, 10 months ago
Well, I''m sort of getting there (texture mapping), but it would be a great help if someone could link to some source of theirs that does something to do with texture mapping in d3d. you dont have to comment or anything, i can figure the stuff out, i JUST NEED SOME SOURCE! sorry, just venting some frustration.
-------------I am a Juggalo.
Advertisement
sorry, to clarify, c/c++ source would be mostly appreciated. i don''t know if i could get help from vb source.
-------------I am a Juggalo.
Try the Examples from the SDK, the nearly all use Texturemapping.

Of course there are some good tutorials with Sourcecode here on gamedev.

And an other good source is Nvidia, under www.nvidia.com/developer they have many examples, even with advanced texturemapping

Lars
--------> http://www.larswolter.de <---------
Here''s some source ripped right out of my engine. Feel free to use it if you want to .

    //represents a textureclass Texture{protected:	LPDIRECTDRAWSURFACE7 lpDDSTexture;public:	Texture() { lpDDSTexture = NULL; }	~Texture() { Destroy(); }	bool LoadTexture(Screen3D* D3DCard, char *filename, BOOL mipmap);	void Destroy() { if(lpDDSTexture) lpDDSTexture->Release(); lpDDSTexture = NULL; }	LPDIRECTDRAWSURFACE7 GetTextureSurface() { return lpDDSTexture; }};bool Texture::LoadTexture(Screen3D* D3DCard, char *filename, BOOL mipmap){	//create a texture	D3DX_SURFACEFORMAT TextureFormat = D3DX_SF_UNKNOWN;	DWORD NumberOfMips;	HRESULT hr = D3DXCreateTextureFromFile(D3DCard->lpD3DDevice,		NULL,		0,		0,		&TextureFormat,		NULL,		&lpDDSTexture,		&NumberOfMips,		filename,		D3DX_FT_LINEAR );	if(FAILED(hr))		return false;	return true;}///To use the texture you''d just do this:lpD3DDevice->SetTexture(stage, texture->GetTextureSurface());    


Note that since this uses D3DX at the start of your application you''ll need to use D3DXInitialize(), and when it shuts down you should use D3DXUninitialize().

Good luck.

--TheGoop
thanks TheGoop for the code, and Lars for nvedia.com
-------------I am a Juggalo.

This topic is closed to new replies.

Advertisement