diff --git a/lib/irrlicht/changes.stk b/lib/irrlicht/changes.stk index 53a62e7cb..bc454834d 100644 --- a/lib/irrlicht/changes.stk +++ b/lib/irrlicht/changes.stk @@ -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 diff --git a/lib/irrlicht/include/IImage.h b/lib/irrlicht/include/IImage.h index 2cb1f8cf1..a2a93b252 100644 --- a/lib/irrlicht/include/IImage.h +++ b/lib/irrlicht/include/IImage.h @@ -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: diff --git a/lib/irrlicht/include/SColor.h b/lib/irrlicht/include/SColor.h index b61bbef97..8b6c2afa1 100644 --- a/lib/irrlicht/include/SColor.h +++ b/lib/irrlicht/include/SColor.h @@ -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. diff --git a/lib/irrlicht/source/Irrlicht/COpenGLDriver.cpp b/lib/irrlicht/source/Irrlicht/COpenGLDriver.cpp index a2ba02af2..938dfc5f8 100644 --- a/lib/irrlicht/source/Irrlicht/COpenGLDriver.cpp +++ b/lib/irrlicht/source/Irrlicht/COpenGLDriver.cpp @@ -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; diff --git a/lib/irrlicht/source/Irrlicht/COpenGLTexture.cpp b/lib/irrlicht/source/Irrlicht/COpenGLTexture.cpp index 7eea57cf4..03cbbdebd 100644 --- a/lib/irrlicht/source/Irrlicht/COpenGLTexture.cpp +++ b/lib/irrlicht/source/Irrlicht/COpenGLTexture.cpp @@ -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: {