forked from Mirrors/openclonk
OpenGL: Use support for non-power-of-two-textures if available
parent
c6154b6881
commit
8c21cfbb41
|
@ -222,7 +222,15 @@ bool CSurface::CreateTextures(int MaxTextureSize)
|
|||
// free previous
|
||||
FreeTextures();
|
||||
// get needed tex size - begin with smaller value of wdt/hgt, so there won't be too much space wasted
|
||||
int iNeedSize=Min(Wdt, Hgt); int n=0; while ((1<<++n) < iNeedSize) {} iNeedSize=1<<n;
|
||||
int iNeedSize=Min(Wdt, Hgt);
|
||||
#ifdef USE_GL
|
||||
if (!pGL || !GLEW_ARB_texture_non_power_of_two)
|
||||
#endif
|
||||
{
|
||||
int n=0;
|
||||
while ((1<<++n) < iNeedSize) {}
|
||||
iNeedSize = 1<<n;
|
||||
}
|
||||
// adjust to available texture size
|
||||
iTexSize=Min(iNeedSize, lpDDraw->MaxTexSize);
|
||||
if (MaxTextureSize)
|
||||
|
@ -246,7 +254,14 @@ bool CSurface::CreateTextures(int MaxTextureSize)
|
|||
{
|
||||
// last texture might be smaller
|
||||
iNeedSize=Max(Wdt%iTexSize, Hgt%iTexSize);
|
||||
int n=0; while ((1<<++n) < iNeedSize) {} iNeedSize=1<<n;
|
||||
#ifdef USE_GL
|
||||
if (!pGL || !GLEW_ARB_texture_non_power_of_two)
|
||||
#endif
|
||||
{
|
||||
int n=0;
|
||||
while ((1<<++n) < iNeedSize) {}
|
||||
iNeedSize=1<<n;
|
||||
}
|
||||
*ppCTex = new CTexRef(iNeedSize, fIsRenderTarget);
|
||||
}
|
||||
if (fIsBackground && ppCTex) (*ppCTex)->FillBlack();
|
||||
|
|
Loading…
Reference in New Issue