Feature #784
Make non power of 2 textures working
Status: | Closed | Start date: | 12/22/2009 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | kervala | % Done: | 100% |
|
Category: | NeL: General | |||
Target version: | Version 0.8.0 |
Description
Currently, non-power of 2 textures (CTextureFile) are displayed as a default texture with a "2", but recent graphic cards are supporting them.
For OpenGL, we just need to check for GL_ARB_texture_non_power_of_two extension, if it's present, we can use texture which haven't a power of 2 size.
History
#1 Updated by kervala over 8 years ago
if (caps.TextureCaps & D3DPTEXTURECAPS_POW2) { if(caps.TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL) { //But, in certain cases textures can ignore the power of 2 limitation } } else { //Textures do not need to be a power of 2 in size }
From D3D headers :
Device can use non-POW2 textures if:
1) D3DTEXTURE_ADDRESS is set to D3DTADDRESS_CLAMP for this texture's stage
2) D3DRS_WRAP(N) set to 0 for this texture's coordinates
PD3DDEVICE->SetRenderState(D3DRS_WRAP0, 0); PD3DDEVICE->SetTextureStageState(0, D3DTSS_ADDRESSU, D3DTADDRESS_CLAMP); PD3DDEVICE->SetTextureStageState(0, D3DTSS_ADDRESSV, D3DTADDRESS_CLAMP); PD3DDEVICE->SetTextureStageState(0, D3DTSS_ADDRESSW, D3DTADDRESS_CLAMP);
3) mip mapping is not enabled (use magnification filter only)
4) Texture formats must not be DXT1-5
if (FAILED(PD3DDEVICE->CreateTexture(m_pTextureInfo[nFrame].nWidth, m_pTextureInfo[nFrame].nHeight, 1, 0, D3DFMT_A4R4G4B4, D3DPOOL_MANAGED, &m_pTextureInfo[nFrame].pTexture))) return NULL;
#2 Updated by kervala over 8 years ago
- Assignee set to kervala
#3 Updated by vl over 8 years ago
- Status changed from New to Assigned
#4 Updated by kervala over 8 years ago
- Status changed from Assigned to Resolved
- % Done changed from 0 to 100
Applied in changeset r2156.
#5 Updated by sfb over 8 years ago
- Status changed from Resolved to Closed
#6 Updated by kervala about 8 years ago
- Target version set to 0.8.0
#7 Updated by kervala almost 8 years ago
- Project changed from NeL to Ryzom
- Category deleted (
3d) - Target version deleted (
0.8.0)
#8 Updated by kervala almost 8 years ago
- Category set to NeL: General
- Target version set to Version 0.8.0