Commit 1c560f5b authored by hybrid's avatar hybrid

Fix indentation and disabling float texture formats where not supported. This...

Fix indentation and disabling float texture formats where not supported. This will probably need some proper transformations instead on those systems.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2434 dfc29bdd-3216-0410-991c-e03cc46cb475
parent a86a0756
...@@ -99,6 +99,7 @@ ECOLOR_FORMAT COpenGLTexture::getBestColorFormat(ECOLOR_FORMAT format) ...@@ -99,6 +99,7 @@ ECOLOR_FORMAT COpenGLTexture::getBestColorFormat(ECOLOR_FORMAT format)
if (Driver->getTextureCreationFlag(ETCF_ALWAYS_16_BIT) || if (Driver->getTextureCreationFlag(ETCF_ALWAYS_16_BIT) ||
Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_SPEED)) Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_SPEED))
destFormat = ECF_A1R5G5B5; destFormat = ECF_A1R5G5B5;
default:
break; break;
} }
if (Driver->getTextureCreationFlag(ETCF_NO_ALPHA_CHANNEL)) if (Driver->getTextureCreationFlag(ETCF_NO_ALPHA_CHANNEL))
...@@ -496,66 +497,93 @@ GLint COpenGLFBOTexture::getOpenGLFormatAndParametersFromColorFormat(ECOLOR_FORM ...@@ -496,66 +497,93 @@ GLint COpenGLFBOTexture::getOpenGLFormatAndParametersFromColorFormat(ECOLOR_FORM
GLenum& colorformat, GLenum& colorformat,
GLenum& type) GLenum& type)
{ {
// default
filtering = GL_LINEAR;
colorformat = GL_RGBA;
type = GL_UNSIGNED_BYTE;
switch(format) switch(format)
{ {
// Floating Point texture formats. Thanks to Patryk "Nadro" Nadrowski. // Floating Point texture formats. Thanks to Patryk "Nadro" Nadrowski.
case ECF_R16F: case ECF_R16F:
{ {
#ifdef GL_ARB_texture_float
filtering = GL_NEAREST; filtering = GL_NEAREST;
colorformat = GL_RED; colorformat = GL_RED;
type = GL_FLOAT; type = GL_FLOAT;
return GL_RGB16F_ARB; return GL_RGB16F_ARB;
#else
return GL_RGB8;
#endif
} }
case ECF_G16R16F: case ECF_G16R16F:
{ {
#ifdef GL_ARB_texture_float
// We haven't got support for this type specifically, so we should use RGB for a close match. // We haven't got support for this type specifically, so we should use RGB for a close match.
filtering = GL_NEAREST; filtering = GL_NEAREST;
colorformat = GL_RGB; colorformat = GL_RGB;
type = GL_FLOAT; type = GL_FLOAT;
return GL_RGB16F_ARB; return GL_RGB16F_ARB;
#else
return GL_RGB8;
#endif
} }
case ECF_A16B16G16R16F: case ECF_A16B16G16R16F:
{ {
#ifdef GL_ARB_texture_float
filtering = GL_NEAREST; filtering = GL_NEAREST;
colorformat = GL_RGBA; colorformat = GL_RGBA;
type = GL_FLOAT; type = GL_FLOAT;
return GL_RGBA16F_ARB; return GL_RGBA16F_ARB;
#else
return GL_RGBA8;
#endif
} }
case ECF_R32F: case ECF_R32F:
{ {
#ifdef GL_ARB_texture_float
filtering = GL_NEAREST; filtering = GL_NEAREST;
colorformat = GL_RED; colorformat = GL_RED;
type = GL_FLOAT; type = GL_FLOAT;
return GL_RGB32F_ARB; return GL_RGB32F_ARB;
#else
return GL_RGB8;
#endif
} }
case ECF_G32R32F: case ECF_G32R32F:
{ {
#ifdef GL_ARB_texture_float
// We haven't got support for this type specifically, so we should use RGB for a close match. // We haven't got support for this type specifically, so we should use RGB for a close match.
filtering = GL_NEAREST; filtering = GL_NEAREST;
colorformat = GL_RGB; colorformat = GL_RGB;
type = GL_FLOAT; type = GL_FLOAT;
return GL_RGB32F_ARB; return GL_RGB32F_ARB;
#else
return GL_RGB8;
#endif
} }
case ECF_A32B32G32R32F: case ECF_A32B32G32R32F:
{ {
#ifdef GL_ARB_texture_float
filtering = GL_NEAREST; filtering = GL_NEAREST;
colorformat = GL_RGBA; colorformat = GL_RGBA;
type = GL_FLOAT; type = GL_FLOAT;
return GL_RGBA32F_ARB; return GL_RGBA32F_ARB;
#else
return GL_RGBA8;
#endif
} }
} default:
{
filtering = GL_LINEAR;
colorformat = GL_RGBA;
type = GL_UNSIGNED_BYTE;
return GL_RGBA8; return GL_RGBA8;
}
}
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment