aboutsummaryrefslogtreecommitdiffstats
path: root/ardor3d-core/src
diff options
context:
space:
mode:
authorJulien Gouesse <[email protected]>2013-04-02 22:59:21 +0200
committerJulien Gouesse <[email protected]>2013-04-02 22:59:21 +0200
commit4c5308f6b7f05057776620519992fa2c02f07acb (patch)
treeec056466718777bddc0d6ee57c31a5b93cac1165 /ardor3d-core/src
parent96fa22334c049a46bcd6246dd401eab4e41e56ed (diff)
Allows the use of clip planes with OpenGL-ES1
Diffstat (limited to 'ardor3d-core/src')
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/ContextCapabilities.java10
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ClipStateRecord.java21
2 files changed, 28 insertions, 3 deletions
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextCapabilities.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextCapabilities.java
index 3e8d55c..9599e0e 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextCapabilities.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextCapabilities.java
@@ -16,6 +16,8 @@ public class ContextCapabilities {
protected boolean _supportsGL1_2 = false;
protected boolean _supportsMultisample = false;
+ protected boolean _supportsDoubleCoefficientsInClipPlaneEquation = false;
+
protected boolean _supportsConstantColor = false;
protected boolean _supportsEq = false;
protected boolean _supportsSeparateEq = false;
@@ -186,6 +188,7 @@ public class ContextCapabilities {
_supportsMirrorEdgeClamp = source._supportsMirrorEdgeClamp;
_supportsMirroredRepeat = source._supportsMirroredRepeat;
_supportsMultisample = source._supportsMultisample;
+ _supportsDoubleCoefficientsInClipPlaneEquation = source._supportsDoubleCoefficientsInClipPlaneEquation;
_supportsMultiTexture = source._supportsMultiTexture;
_supportsNonPowerTwo = source._supportsNonPowerTwo;
_supportsPointParameters = source._supportsPointParameters;
@@ -229,6 +232,13 @@ public class ContextCapabilities {
}
/**
+ * @return true if double coefficients are supported in clip plane equation
+ */
+ public boolean areDoubleCoefficientsInClipPlaneEquationSupported() {
+ return _supportsDoubleCoefficientsInClipPlaneEquation;
+ }
+
+ /**
* @return true if we support fbo multisampling (antialiasing)
*/
public boolean isFBOMultisampleSupported() {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ClipStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ClipStateRecord.java
index 7dba025..eeedf23 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ClipStateRecord.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ClipStateRecord.java
@@ -10,16 +10,31 @@
package com.ardor3d.renderer.state.record;
-import java.nio.DoubleBuffer;
+import java.nio.Buffer;
import java.util.Arrays;
+import com.ardor3d.renderer.ContextCapabilities;
+import com.ardor3d.renderer.ContextManager;
+import com.ardor3d.renderer.RenderContext;
import com.ardor3d.renderer.state.ClipState;
import com.ardor3d.util.geom.BufferUtils;
public class ClipStateRecord extends StateRecord {
- public final boolean[] planeEnabled = new boolean[ClipState.MAX_CLIP_PLANES];
- public final DoubleBuffer buf = BufferUtils.createDoubleBuffer(4);
+ public final boolean[] planeEnabled;
+ public final Buffer buf;
+
+ public ClipStateRecord() {
+ planeEnabled = new boolean[ClipState.MAX_CLIP_PLANES];
+ final RenderContext context = ContextManager.getCurrentContext();
+ final ContextCapabilities caps = context.getCapabilities();
+ if (caps.areDoubleCoefficientsInClipPlaneEquationSupported()) {
+ buf = BufferUtils.createDoubleBuffer(4);
+ } else {
+ buf = BufferUtils.createFloatBuffer(4);
+ }
+
+ }
@Override
public void invalidate() {