From b5d50ee51afe7d30bbbcdd619534e9d4f432f4d3 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Fri, 18 Sep 2020 20:47:39 +0200 Subject: EXAMPLE: models_skybox works on OpenGL ES 2.0 --- src/rlgl.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/rlgl.h b/src/rlgl.h index 60f68691..adf0900e 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -2065,20 +2065,20 @@ unsigned int rlLoadTexture(void *data, int width, int height, int format, int mi unsigned int rlLoadTextureDepth(int width, int height, bool useRenderBuffer) { unsigned int id = 0; - + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) - if (!RLGL.ExtSupported.texDepth) useRenderBuffer = false; + // In case depth textures not supported, we force renderbuffer usage + if (!RLGL.ExtSupported.texDepth) useRenderBuffer = true; // NOTE: We let the implementation to choose the best bit-depth unsigned int glInternalFormat = GL_DEPTH_COMPONENT; -/* -#if defined(GRAPHICS_API_OPENGL_33) - glInternalFormat = GL_DEPTH_COMPONENT24; // GL_DEPTH_COMPONENT32 -#elif defined(GRAPHICS_API_OPENGL_ES2) + +#if defined(GRAPHICS_API_OPENGL_ES2) if (RLGL.ExtSupported.maxDepthBits == 32) glInternalFormat = GL_DEPTH_COMPONENT32_OES; else if (RLGL.ExtSupported.maxDepthBits == 24) glInternalFormat = GL_DEPTH_COMPONENT24_OES; + else glInternalFormat = GL_DEPTH_COMPONENT16; #endif -*/ + if (!useRenderBuffer && RLGL.ExtSupported.texDepth) { glGenTextures(1, &id); -- cgit v1.2.3