From 4d27357dfe703c56ed4d6346690eeb64c2c703b7 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 1 Sep 2016 16:41:15 +0300 Subject: [PATCH] Access clipping through the extension mechanism It's not supported on OpenGL ES. --- extensions/msp_clipping.glext | 1 + gl.fixes.xml | 15 +++++++++++++++ source/clipping.cpp | 4 +++- source/clipplane.cpp | 4 +++- source/clipunit.cpp | 2 ++ 5 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 extensions/msp_clipping.glext diff --git a/extensions/msp_clipping.glext b/extensions/msp_clipping.glext new file mode 100644 index 00000000..b94288cf --- /dev/null +++ b/extensions/msp_clipping.glext @@ -0,0 +1 @@ +extension MSP_clipping diff --git a/gl.fixes.xml b/gl.fixes.xml index f3e2e60e..8edc3731 100644 --- a/gl.fixes.xml +++ b/gl.fixes.xml @@ -153,6 +153,8 @@ + + @@ -164,6 +166,19 @@ + + + + + + + + + + + + + diff --git a/source/clipping.cpp b/source/clipping.cpp index 430a7b6f..6508ecf7 100644 --- a/source/clipping.cpp +++ b/source/clipping.cpp @@ -1,3 +1,4 @@ +#include #include #include "clipping.h" #include "clipplane.h" @@ -55,8 +56,9 @@ void Clipping::update_shader_data(ProgramData &shdata, const Matrix &view_matrix void Clipping::bind(bool legacy) const { + static Require _req(MSP_clipping); if(legacy) - static Require _req(MSP_legacy_features); + static Require _req2(MSP_legacy_features); if(legacy!=bound_with_legacy) unbind(); diff --git a/source/clipplane.cpp b/source/clipplane.cpp index e0b425a4..21df0d17 100644 --- a/source/clipplane.cpp +++ b/source/clipplane.cpp @@ -1,3 +1,4 @@ +#include #include #include #include "clipplane.h" @@ -50,7 +51,8 @@ void ClipPlane::update_shader_data(ProgramData &shdata, const Matrix &view_inver void ClipPlane::bind_to(unsigned i) const { - Require _req(MSP_legacy_features); + Require _req(MSP_clipping); + Require _req2(MSP_legacy_features); ClipUnit &unit = ClipUnit::get_unit(i); if(unit.set_plane(this)) diff --git a/source/clipunit.cpp b/source/clipunit.cpp index 83080bd7..2db721cf 100644 --- a/source/clipunit.cpp +++ b/source/clipunit.cpp @@ -1,3 +1,4 @@ +#include #include #include "clipunit.h" #include "gl.h" @@ -24,6 +25,7 @@ bool ClipUnit::set_plane(const ClipPlane *p) unsigned ClipUnit::get_n_units() { + static Require _req(MSP_clipping); static int count = get_i(GL_MAX_CLIP_PLANES); return count; } -- 2.45.2