• Advertisement

Archived

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

Texture color key

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

How to set a color key for texture and to use it with some primitive, to make assigned texture with transparent colors?

Share this post


Link to post
Share on other sites
Advertisement
for DX7 go here

For DX8 in the D3DUtil.cpp file add


    
HRESULT D3DUtil_CreateTextureCK( LPDIRECT3DDEVICE8 pd3dDevice, TCHAR* strTexture,
LPDIRECT3DTEXTURE8* ppTexture, D3DFORMAT d3dFormat,
byte alpha, byte red, byte blue, byte green)
{
// Get the path to the texture

TCHAR strPath[MAX_PATH];
DXUtil_FindMediaFile( strPath, strTexture );

// Create the texture using D3DX

return D3DXCreateTextureFromFileEx(
pd3dDevice,
strPath,
D3DX_DEFAULT,
D3DX_DEFAULT,
D3DX_DEFAULT,
0,
d3dFormat,
D3DPOOL_MANAGED,
D3DX_FILTER_TRIANGLE|D3DX_FILTER_MIRROR,
D3DX_FILTER_TRIANGLE|D3DX_FILTER_MIRROR,
D3DCOLOR_ARGB(alpha,red,blue,green),
NULL,
NULL,
ppTexture );
}


usage is


        
D3DUtil_CreateTextureCK( m_pd3dDevice, filename, &m_pTexture,D3DFMT_UNKNOWN,a,r,g,b )


Always use D3DFMT_UNKNOWN

Ben

IcarusIndie.com

[The Rabbit Hole | The Labyrinth | Programming | Gang Wars | The Wall]

[edited by - KalvinB on April 28, 2002 7:33:29 PM]

Share this post


Link to post
Share on other sites

  • Advertisement