From 02004084757191842f2bc77674a5d3eb8cea1300 Mon Sep 17 00:00:00 2001 From: nadro Date: Thu, 17 Dec 2015 12:44:24 +0000 Subject: [PATCH] - Fixed issue with depth color formats in OpenGL drivers (example no. 13 works properly at now). git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@5221 dfc29bdd-3216-0410-991c-e03cc46cb475 --- source/Irrlicht/COGLES2Driver.cpp | 10 ++++++---- source/Irrlicht/COGLESDriver.cpp | 11 ++++++----- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/source/Irrlicht/COGLES2Driver.cpp b/source/Irrlicht/COGLES2Driver.cpp index 1ca89cd6..cbb67616 100644 --- a/source/Irrlicht/COGLES2Driver.cpp +++ b/source/Irrlicht/COGLES2Driver.cpp @@ -2772,17 +2772,19 @@ COGLES2Driver::~COGLES2Driver() case ECF_D16: internalFormat = GL_DEPTH_COMPONENT16; pixelFormat = GL_DEPTH_COMPONENT; - pixelType = GL_UNSIGNED_BYTE; + pixelType = GL_UNSIGNED_SHORT; break; case ECF_D32: #if defined(GL_OES_depth32) if (queryOpenGLFeature(COGLES2ExtensionHandler::IRR_OES_depth32)) + { internalFormat = GL_DEPTH_COMPONENT32_OES; + pixelFormat = GL_DEPTH_COMPONENT; + pixelType = GL_UNSIGNED_INT; + } else #endif - internalFormat = GL_DEPTH_COMPONENT16; - pixelFormat = GL_DEPTH_COMPONENT; - pixelType = GL_UNSIGNED_BYTE; + os::Printer::log("ECF_D32 color format is not supported", ELL_ERROR); break; case ECF_D24S8: #ifdef GL_OES_packed_depth_stencil diff --git a/source/Irrlicht/COGLESDriver.cpp b/source/Irrlicht/COGLESDriver.cpp index 1976bdb8..b0d8f026 100644 --- a/source/Irrlicht/COGLESDriver.cpp +++ b/source/Irrlicht/COGLESDriver.cpp @@ -3148,19 +3148,20 @@ void COGLES1Driver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern case ECF_D16: internalFormat = GL_DEPTH_COMPONENT16; pixelFormat = GL_DEPTH_COMPONENT; - pixelType = GL_UNSIGNED_BYTE; + pixelType = GL_UNSIGNED_SHORT; break; case ECF_D32: #if defined(GL_OES_depth32) if (queryOpenGLFeature(COGLES1ExtensionHandler::IRR_OES_depth32)) + { internalFormat = GL_DEPTH_COMPONENT32_OES; + pixelFormat = GL_DEPTH_COMPONENT; + pixelType = GL_UNSIGNED_INT; + } else #endif - internalFormat = GL_DEPTH_COMPONENT16; - pixelFormat = GL_DEPTH_COMPONENT; - pixelType = GL_UNSIGNED_BYTE; + os::Printer::log("ECF_D32 color format is not supported", ELL_ERROR); break; - case ECF_D24S8: #ifdef GL_OES_packed_depth_stencil if (queryOpenGLFeature(COGLES1ExtensionHandler::IRR_OES_packed_depth_stencil)) {