EXAMPLE: models_skybox works on OpenGL ES 2.0

This commit is contained in:
raysan5
2020-09-18 20:47:39 +02:00
parent 79d63e6ca1
commit b5d50ee51a
6 changed files with 22 additions and 58 deletions

View File

@@ -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);