Support reversed Z rendering and float32 offscreen depth buffer
Combined, both options greatly improve camera depth accuracy compared to OpenGL default Z mapping and int24 depth buffer. Requires GL_ARB_clip_control and ARB_depth_buffer_float extensions
This commit is contained in:
+15
-3
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Based on the OpenGL loader generated by glad 0.1.35 on Mon Mar 21 12:42:33 2022.
|
||||
// Based on the OpenGL loader generated by glad 0.1.34 on Thu Jun 22 14:40:03 2023.
|
||||
//
|
||||
// The original generated code is distributed under CC0.
|
||||
// https://creativecommons.org/publicdomain/zero/1.0/
|
||||
@@ -22,6 +22,8 @@
|
||||
// APIs: gl=1.5
|
||||
// Profile: compatibility
|
||||
// Extensions:
|
||||
// GL_ARB_clip_control,
|
||||
// GL_ARB_depth_buffer_float,
|
||||
// GL_ARB_framebuffer_object,
|
||||
// GL_ARB_seamless_cube_map,
|
||||
// GL_ARB_vertex_buffer_object,
|
||||
@@ -32,9 +34,9 @@
|
||||
// Reproducible: False
|
||||
//
|
||||
// Commandline:
|
||||
// --profile="compatibility" --api="gl=1.5" --generator="c" --spec="gl" --extensions="GL_ARB_framebuffer_object,GL_ARB_seamless_cube_map,GL_ARB_vertex_buffer_object,GL_KHR_debug"
|
||||
// --profile="compatibility" --api="gl=1.5" --generator="c" --spec="gl" --extensions="GL_ARB_clip_control,GL_ARB_depth_buffer_float,GL_ARB_framebuffer_object,GL_ARB_seamless_cube_map,GL_ARB_vertex_buffer_object,GL_KHR_debug"
|
||||
// Online:
|
||||
// https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D1.5&extensions=GL_ARB_framebuffer_object&extensions=GL_ARB_seamless_cube_map&extensions=GL_ARB_vertex_buffer_object&extensions=GL_KHR_debug
|
||||
// https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D1.5&extensions=GL_ARB_clip_control&extensions=GL_ARB_depth_buffer_float&extensions=GL_ARB_framebuffer_object&extensions=GL_ARB_seamless_cube_map&extensions=GL_ARB_vertex_buffer_object&extensions=GL_KHR_debug
|
||||
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic push
|
||||
@@ -829,10 +831,13 @@ PFNGLWINDOWPOS3IPROC mjGlad_glWindowPos3i = NULL;
|
||||
PFNGLWINDOWPOS3IVPROC mjGlad_glWindowPos3iv = NULL;
|
||||
PFNGLWINDOWPOS3SPROC mjGlad_glWindowPos3s = NULL;
|
||||
PFNGLWINDOWPOS3SVPROC mjGlad_glWindowPos3sv = NULL;
|
||||
int mjGLAD_GL_ARB_clip_control = 0;
|
||||
int mjGLAD_GL_ARB_depth_buffer_float = 0;
|
||||
int mjGLAD_GL_ARB_framebuffer_object = 0;
|
||||
int mjGLAD_GL_ARB_seamless_cube_map = 0;
|
||||
int mjGLAD_GL_ARB_vertex_buffer_object = 0;
|
||||
int mjGLAD_GL_KHR_debug = 0;
|
||||
PFNGLCLIPCONTROLPROC mjGlad_glClipControl = NULL;
|
||||
PFNGLISRENDERBUFFERPROC mjGlad_glIsRenderbuffer = NULL;
|
||||
PFNGLBINDRENDERBUFFERPROC mjGlad_glBindRenderbuffer = NULL;
|
||||
PFNGLDELETERENDERBUFFERSPROC mjGlad_glDeleteRenderbuffers = NULL;
|
||||
@@ -1355,6 +1360,10 @@ static void mjGlad_load_GL_VERSION_1_5(GLADloadproc load) {
|
||||
mjGlad_glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)load("glGetBufferParameteriv");
|
||||
mjGlad_glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC)load("glGetBufferPointerv");
|
||||
}
|
||||
static void mjGlad_load_GL_ARB_clip_control(GLADloadproc load) {
|
||||
if(!mjGLAD_GL_ARB_clip_control) return;
|
||||
mjGlad_glClipControl = (PFNGLCLIPCONTROLPROC)load("glClipControl");
|
||||
}
|
||||
static void mjGlad_load_GL_ARB_framebuffer_object(GLADloadproc load) {
|
||||
if(!mjGLAD_GL_ARB_framebuffer_object) return;
|
||||
mjGlad_glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC)load("glIsRenderbuffer");
|
||||
@@ -1419,6 +1428,8 @@ static void mjGlad_load_GL_KHR_debug(GLADloadproc load) {
|
||||
}
|
||||
static int mjGlad_find_extensionsGL(void) {
|
||||
if (!mjGlad_get_exts()) return 0;
|
||||
mjGLAD_GL_ARB_clip_control = mjGlad_has_ext("GL_ARB_clip_control");
|
||||
mjGLAD_GL_ARB_depth_buffer_float = mjGlad_has_ext("GL_ARB_depth_buffer_float");
|
||||
mjGLAD_GL_ARB_framebuffer_object = mjGlad_has_ext("GL_ARB_framebuffer_object");
|
||||
mjGLAD_GL_ARB_seamless_cube_map = mjGlad_has_ext("GL_ARB_seamless_cube_map");
|
||||
mjGLAD_GL_ARB_vertex_buffer_object = mjGlad_has_ext("GL_ARB_vertex_buffer_object");
|
||||
@@ -1491,6 +1502,7 @@ int mjGladLoadGLUnsafe(void) {
|
||||
mjGlad_load_GL_VERSION_1_5(mjGlad_get_proc);
|
||||
|
||||
if (!mjGlad_find_extensionsGL()) return 0;
|
||||
mjGlad_load_GL_ARB_clip_control(mjGlad_get_proc);
|
||||
mjGlad_load_GL_ARB_framebuffer_object(mjGlad_get_proc);
|
||||
mjGlad_load_GL_ARB_vertex_buffer_object(mjGlad_get_proc);
|
||||
mjGlad_load_GL_KHR_debug(mjGlad_get_proc);
|
||||
|
||||
+25
-3
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Based on the OpenGL loader generated by glad 0.1.35 on Mon Mar 21 12:42:33 2022.
|
||||
// Based on the OpenGL loader generated by glad 0.1.34 on Thu Jun 22 14:40:03 2023.
|
||||
//
|
||||
// The original generated code is distributed under CC0.
|
||||
// https://creativecommons.org/publicdomain/zero/1.0/
|
||||
@@ -22,6 +22,8 @@
|
||||
// APIs: gl=1.5
|
||||
// Profile: compatibility
|
||||
// Extensions:
|
||||
// GL_ARB_clip_control,
|
||||
// GL_ARB_depth_buffer_float,
|
||||
// GL_ARB_framebuffer_object,
|
||||
// GL_ARB_seamless_cube_map,
|
||||
// GL_ARB_vertex_buffer_object,
|
||||
@@ -32,9 +34,9 @@
|
||||
// Reproducible: False
|
||||
//
|
||||
// Commandline:
|
||||
// --profile="compatibility" --api="gl=1.5" --generator="c" --spec="gl" --extensions="GL_ARB_framebuffer_object,GL_ARB_seamless_cube_map,GL_ARB_vertex_buffer_object,GL_KHR_debug"
|
||||
// --profile="compatibility" --api="gl=1.5" --generator="c" --spec="gl" --extensions="GL_ARB_clip_control,GL_ARB_depth_buffer_float,GL_ARB_framebuffer_object,GL_ARB_seamless_cube_map,GL_ARB_vertex_buffer_object,GL_KHR_debug"
|
||||
// Online:
|
||||
// https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D1.5&extensions=GL_ARB_framebuffer_object&extensions=GL_ARB_seamless_cube_map&extensions=GL_ARB_vertex_buffer_object&extensions=GL_KHR_debug
|
||||
// https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D1.5&extensions=GL_ARB_clip_control&extensions=GL_ARB_depth_buffer_float&extensions=GL_ARB_framebuffer_object&extensions=GL_ARB_seamless_cube_map&extensions=GL_ARB_vertex_buffer_object&extensions=GL_KHR_debug
|
||||
|
||||
#ifndef MUJOCO_SRC_RENDER_GLAD_GLAD_H_
|
||||
#define MUJOCO_SRC_RENDER_GLAD_GLAD_H_
|
||||
@@ -2304,6 +2306,15 @@ typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC)(GLenum target, GLenum pname,
|
||||
GLAPI PFNGLGETBUFFERPOINTERVPROC mjGlad_glGetBufferPointerv;
|
||||
#define glGetBufferPointerv mjGlad_glGetBufferPointerv
|
||||
#endif
|
||||
#define GL_LOWER_LEFT 0x8CA1
|
||||
#define GL_UPPER_LEFT 0x8CA2
|
||||
#define GL_NEGATIVE_ONE_TO_ONE 0x935E
|
||||
#define GL_ZERO_TO_ONE 0x935F
|
||||
#define GL_CLIP_ORIGIN 0x935C
|
||||
#define GL_CLIP_DEPTH_MODE 0x935D
|
||||
#define GL_DEPTH_COMPONENT32F 0x8CAC
|
||||
#define GL_DEPTH32F_STENCIL8 0x8CAD
|
||||
#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD
|
||||
#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211
|
||||
@@ -2487,6 +2498,17 @@ GLAPI PFNGLGETBUFFERPOINTERVPROC mjGlad_glGetBufferPointerv;
|
||||
#define GL_STACK_OVERFLOW_KHR 0x0503
|
||||
#define GL_STACK_UNDERFLOW_KHR 0x0504
|
||||
#define GL_DISPLAY_LIST 0x82E7
|
||||
#ifndef GL_ARB_clip_control
|
||||
#define GL_ARB_clip_control 1
|
||||
GLAPI int mjGLAD_GL_ARB_clip_control;
|
||||
typedef void (APIENTRYP PFNGLCLIPCONTROLPROC)(GLenum origin, GLenum depth);
|
||||
GLAPI PFNGLCLIPCONTROLPROC mjGlad_glClipControl;
|
||||
#define glClipControl mjGlad_glClipControl
|
||||
#endif
|
||||
#ifndef GL_ARB_depth_buffer_float
|
||||
#define GL_ARB_depth_buffer_float 1
|
||||
GLAPI int mjGLAD_GL_ARB_depth_buffer_float;
|
||||
#endif
|
||||
#ifndef GL_ARB_framebuffer_object
|
||||
#define GL_ARB_framebuffer_object 1
|
||||
GLAPI int mjGLAD_GL_ARB_framebuffer_object;
|
||||
|
||||
Reference in New Issue
Block a user