mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 08:15:18 -04:00
gles2gsg: Support gl-depth-zero-to-one in OpenGL ES 2+
Requires GL_EXT_clip_control support in the driver.
This commit is contained in:
parent
32b78a382a
commit
481fc67996
@ -120,6 +120,8 @@ typedef char GLchar;
|
|||||||
#define GL_ONE_MINUS_SRC1_COLOR GL_ONE_MINUS_SRC1_COLOR_EXT
|
#define GL_ONE_MINUS_SRC1_COLOR GL_ONE_MINUS_SRC1_COLOR_EXT
|
||||||
#define GL_SRC1_ALPHA GL_SRC1_ALPHA_EXT
|
#define GL_SRC1_ALPHA GL_SRC1_ALPHA_EXT
|
||||||
#define GL_ONE_MINUS_SRC1_ALPHA GL_ONE_MINUS_SRC1_ALPHA_EXT
|
#define GL_ONE_MINUS_SRC1_ALPHA GL_ONE_MINUS_SRC1_ALPHA_EXT
|
||||||
|
#define GL_LOWER_LEFT GL_LOWER_LEFT_EXT
|
||||||
|
#define GL_ZERO_TO_ONE GL_ZERO_TO_ONE_EXT
|
||||||
|
|
||||||
#define GL_DEBUG_OUTPUT_SYNCHRONOUS GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR
|
#define GL_DEBUG_OUTPUT_SYNCHRONOUS GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR
|
||||||
#define GL_DEBUG_TYPE_PERFORMANCE GL_DEBUG_TYPE_PERFORMANCE_KHR
|
#define GL_DEBUG_TYPE_PERFORMANCE GL_DEBUG_TYPE_PERFORMANCE_KHR
|
||||||
|
@ -1050,6 +1050,20 @@ GL_APICALL void GL_APIENTRY glBufferStorageEXT (GLenum target, GLsizeiptr size,
|
|||||||
#endif
|
#endif
|
||||||
#endif /* GL_EXT_buffer_storage */
|
#endif /* GL_EXT_buffer_storage */
|
||||||
|
|
||||||
|
#ifndef GL_EXT_clip_control
|
||||||
|
#define GL_EXT_clip_control 1
|
||||||
|
#define GL_LOWER_LEFT_EXT 0x8CA1
|
||||||
|
#define GL_UPPER_LEFT_EXT 0x8CA2
|
||||||
|
#define GL_NEGATIVE_ONE_TO_ONE_EXT 0x935E
|
||||||
|
#define GL_ZERO_TO_ONE_EXT 0x935F
|
||||||
|
#define GL_CLIP_ORIGIN_EXT 0x935C
|
||||||
|
#define GL_CLIP_DEPTH_MODE_EXT 0x935D
|
||||||
|
typedef void (GL_APIENTRYP PFNGLCLIPCONTROLEXTPROC) (GLenum origin, GLenum depth);
|
||||||
|
#ifdef GL_GLEXT_PROTOTYPES
|
||||||
|
GL_APICALL void GL_APIENTRY glClipControlEXT (GLenum origin, GLenum depth);
|
||||||
|
#endif
|
||||||
|
#endif /* GL_EXT_clip_control */
|
||||||
|
|
||||||
#ifndef GL_EXT_color_buffer_float
|
#ifndef GL_EXT_color_buffer_float
|
||||||
#define GL_EXT_color_buffer_float 1
|
#define GL_EXT_color_buffer_float 1
|
||||||
#endif /* GL_EXT_color_buffer_float */
|
#endif /* GL_EXT_color_buffer_float */
|
||||||
|
@ -3293,14 +3293,22 @@ reset() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Set depth range from zero to one if requested.
|
// Set depth range from zero to one if requested.
|
||||||
#ifndef OPENGLES
|
#ifndef OPENGLES_1
|
||||||
_use_depth_zero_to_one = false;
|
_use_depth_zero_to_one = false;
|
||||||
_use_remapped_depth_range = false;
|
_use_remapped_depth_range = false;
|
||||||
|
|
||||||
if (gl_depth_zero_to_one) {
|
if (gl_depth_zero_to_one) {
|
||||||
|
#ifndef OPENGLES
|
||||||
|
PFNGLCLIPCONTROLPROC pglClipControl = nullptr;
|
||||||
if (is_at_least_gl_version(4, 5) || has_extension("GL_ARB_clip_control")) {
|
if (is_at_least_gl_version(4, 5) || has_extension("GL_ARB_clip_control")) {
|
||||||
PFNGLCLIPCONTROLPROC pglClipControl =
|
pglClipControl = (PFNGLCLIPCONTROLPROC)get_extension_func("glClipControl");
|
||||||
(PFNGLCLIPCONTROLPROC)get_extension_func("glClipControl");
|
}
|
||||||
|
#else
|
||||||
|
PFNGLCLIPCONTROLEXTPROC pglClipControl = nullptr;
|
||||||
|
if (has_extension("GL_EXT_clip_control")) {
|
||||||
|
pglClipControl = (PFNGLCLIPCONTROLEXTPROC)get_extension_func("glClipControlEXT");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (pglClipControl != nullptr) {
|
if (pglClipControl != nullptr) {
|
||||||
pglClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE);
|
pglClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE);
|
||||||
@ -3310,7 +3318,6 @@ reset() {
|
|||||||
GLCAT.debug()
|
GLCAT.debug()
|
||||||
<< "Set zero-to-one depth using glClipControl\n";
|
<< "Set zero-to-one depth using glClipControl\n";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}/* else if (has_extension("GL_NV_depth_buffer_float")) {
|
}/* else if (has_extension("GL_NV_depth_buffer_float")) {
|
||||||
// Alternatively, all GeForce 8+ and even some AMD drivers support this
|
// Alternatively, all GeForce 8+ and even some AMD drivers support this
|
||||||
// extension, which (unlike the core glDepthRange, which clamps its
|
// extension, which (unlike the core glDepthRange, which clamps its
|
||||||
|
@ -761,9 +761,11 @@ protected:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
#ifndef OPENGLES
|
#ifndef OPENGLES_1
|
||||||
bool _use_depth_zero_to_one;
|
bool _use_depth_zero_to_one;
|
||||||
bool _use_remapped_depth_range;
|
bool _use_remapped_depth_range;
|
||||||
|
#endif
|
||||||
|
#ifndef OPENGLES
|
||||||
PFNGLDEPTHRANGEDNVPROC _glDepthRangedNV;
|
PFNGLDEPTHRANGEDNVPROC _glDepthRangedNV;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user