Jump to content
  • Advertisement
Sign in to follow this  
L. Spiro

Only alpha textures work?

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

DirectX 9.0c latest release of SDK. Only textures created with alpha channels are actually succeeding (in being created). I have a 32-bit back buffer but I have never read any restrictions on making the texture format compatible with anything else. For example, I can not find any documentation that would give me a clue why D3DFMT_R3G3B2 and D3DFMT_R8G8B8 would be invalid where D3DFMT_A8R8G8B8 is valid. Textures are required to have alpha or what? Why do these formats exist if we can not use them? Thank you, Yogurt Emperor

Share this post


Link to post
Share on other sites
Advertisement
This code works:

// Create a blank texture.
HRESULT hRes = CGraphics::GetDirectXDevice()->CreateTexture( 512, 512,
FALSE,
0UL,
D3DFMT_A8R8G8B8, D3DPOOL_MANAGED,
&m_pd3dtTexture, NULL );
if ( FAILED( hRes ) ) {
return false;
}
// hRes == S_OK




This code fails:

// Create a blank texture.
HRESULT hRes = CGraphics::GetDirectXDevice()->CreateTexture( 512, 512,
FALSE,
0UL,
D3DFMT_R8G8B8, D3DPOOL_MANAGED,
&m_pd3dtTexture, NULL );
if ( FAILED( hRes ) ) {
return false;
}
// hRes == -2005530516 (D3DERR_INVALIDCALL)







m_ppPresentParms.BackBufferWidth = _diInit.ui32Width;
m_ppPresentParms.BackBufferHeight = _diInit.ui32Height;
m_ppPresentParms.BackBufferFormat = D3DFMT_A8R8G8B8;
m_ppPresentParms.BackBufferCount = 1UL;
m_ppPresentParms.MultiSampleType = D3DMULTISAMPLE_NONE;
m_ppPresentParms.MultiSampleQuality = 0UL;
m_ppPresentParms.SwapEffect = D3DSWAPEFFECT_DISCARD;
m_ppPresentParms.hDeviceWindow = _diInit.hWnd;
m_ppPresentParms.Windowed = !_diInit.bFullScreen;
m_ppPresentParms.EnableAutoDepthStencil = TRUE;
m_ppPresentParms.AutoDepthStencilFormat = D3DFMT_D24S8;
m_ppPresentParms.Flags = 0UL;
m_ppPresentParms.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
m_ppPresentParms.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;


if ( FAILED( m_pd3d9Object->CreateDevice( D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL,
_diInit.hWnd,
m_i32VertProcType,
&m_ppPresentParms,
&m_pdDevice ) ) ) { return false; }



Yogurt Emperor

Share this post


Link to post
Share on other sites
Many cards don't support that format, you can check at initialization if the player hardware support it with CheckDeviceFormat() function and use it or always use 255 as alpha for your 24bits textures. But most games use compressed format such as DXT1/DXT3/DXT5 generally.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!