Skip to content

Commit

Permalink
Fix depth texture support in OpenGL ES 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowislord authored and Nehon committed Sep 9, 2017
1 parent e09a5a5 commit 7f8fa4d
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -206,9 +206,14 @@ public static GLImageFormat[][] getFormatsForCaps(EnumSet<Caps> caps) {

// Need to check if Caps.DepthTexture is supported prior to using for textures
// But for renderbuffers its OK.
format(formatToGL, Format.Depth, GL.GL_DEPTH_COMPONENT, GL.GL_DEPTH_COMPONENT, GL.GL_UNSIGNED_BYTE);
format(formatToGL, Format.Depth16, GL.GL_DEPTH_COMPONENT16, GL.GL_DEPTH_COMPONENT, GL.GL_UNSIGNED_SHORT);

// NOTE: OpenGL ES 2.0 does not support DEPTH_COMPONENT as internal format -- fallback to 16-bit depth.
if (caps.contains(Caps.OpenGLES20)) {
format(formatToGL, Format.Depth, GL.GL_DEPTH_COMPONENT16, GL.GL_DEPTH_COMPONENT, GL.GL_UNSIGNED_BYTE);
} else {
format(formatToGL, Format.Depth, GL.GL_DEPTH_COMPONENT, GL.GL_DEPTH_COMPONENT, GL.GL_UNSIGNED_BYTE);
}
if (caps.contains(Caps.OpenGL20)) {
format(formatToGL, Format.Depth24, GL2.GL_DEPTH_COMPONENT24, GL.GL_DEPTH_COMPONENT, GL.GL_UNSIGNED_INT);
}
Expand Down

0 comments on commit 7f8fa4d

Please sign in to comment.