irr: Add support for some RG texture formats

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@13628 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
curaga 2013-09-04 13:26:06 +00:00
parent 8f0f150c4a
commit 0588b4252e
5 changed files with 54 additions and 0 deletions

View File

@ -11,3 +11,4 @@ The following changes have been made:
- texture override
- non-triangle VBO support
- extension order mismatch
- support for some RG texture formats

View File

@ -111,6 +111,14 @@ public:
return 24;
case ECF_A8R8G8B8:
return 32;
case ECF_R8:
return 8;
case ECF_R8G8:
return 16;
case ECF_R16:
return 16;
case ECF_R16G16:
return 32;
case ECF_R16F:
return 16;
case ECF_G16R16F:

View File

@ -31,6 +31,12 @@ namespace video
//! Default 32 bit color format. 8 bits are used for every component: red, green, blue and alpha.
ECF_A8R8G8B8,
//! The normalized non-float formats from the _rg extension
ECF_R8,
ECF_R8G8,
ECF_R16,
ECF_R16G16,
/** Floating Point formats. The following formats may only be used for render target textures. */
//! 16 bit floating point format using 16 bits for the red channel.

View File

@ -4425,6 +4425,23 @@ IImage* COpenGLDriver::createScreenShot(video::ECOLOR_FORMAT format, video::E_RE
else
type = GL_UNSIGNED_BYTE;
break;
case ECF_R8G8:
// GL_ARB_texture_rg is considered always available in headers. No ifdefs.
fmt = GL_RG;
type = GL_UNSIGNED_BYTE;
break;
case ECF_R16G16:
fmt = GL_RG;
type = GL_UNSIGNED_SHORT;
break;
case ECF_R8:
fmt = GL_RED;
type = GL_UNSIGNED_BYTE;
break;
case ECF_R16:
fmt = GL_RED;
type = GL_UNSIGNED_SHORT;
break;
case ECF_R16F:
if (FeatureAvailable[IRR_ARB_texture_rg])
fmt = GL_RED;

View File

@ -159,6 +159,28 @@ GLint COpenGLTexture::getOpenGLFormatAndParametersFromColorFormat(ECOLOR_FORMAT
type=GL_UNSIGNED_INT_8_8_8_8_REV;
internalformat = GL_RGBA;
break;
// _rg formats.
case ECF_R8:
colorformat = GL_RED;
type = GL_UNSIGNED_BYTE;
internalformat = GL_R8;
break;
case ECF_R16:
colorformat = GL_RED;
type = GL_UNSIGNED_SHORT;
internalformat = GL_R16;
break;
case ECF_R8G8:
colorformat = GL_RG;
type = GL_UNSIGNED_BYTE;
internalformat = GL_RG8;
break;
case ECF_R16G16:
colorformat = GL_RG;
type = GL_UNSIGNED_SHORT;
internalformat = GL_RG16;
break;
// Floating Point texture formats. Thanks to Patryk "Nadro" Nadrowski.
case ECF_R16F:
{