mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 07:48:37 -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_SRC1_ALPHA GL_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_TYPE_PERFORMANCE GL_DEBUG_TYPE_PERFORMANCE_KHR
|
||||
|
@ -1050,6 +1050,20 @@ GL_APICALL void GL_APIENTRY glBufferStorageEXT (GLenum target, GLsizeiptr size,
|
||||
#endif
|
||||
#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
|
||||
#define GL_EXT_color_buffer_float 1
|
||||
#endif /* GL_EXT_color_buffer_float */
|
||||
|
@ -3293,23 +3293,30 @@ reset() {
|
||||
#endif
|
||||
|
||||
// Set depth range from zero to one if requested.
|
||||
#ifndef OPENGLES
|
||||
#ifndef OPENGLES_1
|
||||
_use_depth_zero_to_one = false;
|
||||
_use_remapped_depth_range = false;
|
||||
|
||||
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")) {
|
||||
PFNGLCLIPCONTROLPROC pglClipControl =
|
||||
(PFNGLCLIPCONTROLPROC)get_extension_func("glClipControl");
|
||||
pglClipControl = (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) {
|
||||
pglClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE);
|
||||
_use_depth_zero_to_one = true;
|
||||
if (pglClipControl != nullptr) {
|
||||
pglClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE);
|
||||
_use_depth_zero_to_one = true;
|
||||
|
||||
if (GLCAT.is_debug()) {
|
||||
GLCAT.debug()
|
||||
<< "Set zero-to-one depth using glClipControl\n";
|
||||
}
|
||||
if (GLCAT.is_debug()) {
|
||||
GLCAT.debug()
|
||||
<< "Set zero-to-one depth using glClipControl\n";
|
||||
}
|
||||
}/* else if (has_extension("GL_NV_depth_buffer_float")) {
|
||||
// Alternatively, all GeForce 8+ and even some AMD drivers support this
|
||||
|
@ -761,9 +761,11 @@ protected:
|
||||
#endif
|
||||
|
||||
public:
|
||||
#ifndef OPENGLES
|
||||
#ifndef OPENGLES_1
|
||||
bool _use_depth_zero_to_one;
|
||||
bool _use_remapped_depth_range;
|
||||
#endif
|
||||
#ifndef OPENGLES
|
||||
PFNGLDEPTHRANGEDNVPROC _glDepthRangedNV;
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user