Only alpha textures work?
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
I don't have this issue (at least I don't think so), mind showing how you create the textures?
This code works:
This code fails:
Yogurt Emperor
// 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
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement