aboutsummaryrefslogtreecommitdiffstats
path: root/ardor3d-jogl/src/main/java/com
diff options
context:
space:
mode:
authorJulien Gouesse <[email protected]>2013-03-06 22:26:54 +0100
committerJulien Gouesse <[email protected]>2013-03-06 22:26:54 +0100
commitc5da806c65de0da878389cc8d2f2fbf457961887 (patch)
treeb34bc8fdb8a60a1dcaaac505854399f057815975 /ardor3d-jogl/src/main/java/com
parenta2c14b1c244dad36fcb61bde4853d313383aa88e (diff)
ES isolation (work in progress)
Diffstat (limited to 'ardor3d-jogl/src/main/java/com')
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglRenderer.java188
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglBlendStateUtil.java6
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java4
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/shader/JoglShaderUtil.java68
4 files changed, 178 insertions, 88 deletions
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglRenderer.java b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglRenderer.java
index c244762..43cd035 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglRenderer.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglRenderer.java
@@ -602,7 +602,7 @@ public class JoglRenderer extends AbstractRenderer {
GL.GL_UNSIGNED_BYTE, source);
break;
case ThreeDimensional:
- gl.getGL2GL3().glTexSubImage3D(GL2ES2.GL_TEXTURE_3D, 0, dstOffsetX, dstOffsetY, dstOffsetZ,
+ gl.getGL2ES2().glTexSubImage3D(GL2ES2.GL_TEXTURE_3D, 0, dstOffsetX, dstOffsetY, dstOffsetZ,
dstWidth, dstHeight, dstDepth, pixelFormat, GL.GL_UNSIGNED_BYTE, source);
break;
case CubeMap:
@@ -705,9 +705,13 @@ public class JoglRenderer extends AbstractRenderer {
final FloatBuffer vertexBuffer = vertexBufferData != null ? vertexBufferData.getBuffer() : null;
if (vertexBuffer == null) {
- gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
+ }
} else {
- gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
+ }
vertexBuffer.rewind();
if (gl.isGL2ES1()) {
gl.getGL2ES1().glVertexPointer(vertexBufferData.getValuesPerTuple(), GL.GL_FLOAT, 0, vertexBuffer);
@@ -721,9 +725,13 @@ public class JoglRenderer extends AbstractRenderer {
final FloatBuffer normalBuffer = normalBufferData != null ? normalBufferData.getBuffer() : null;
if (normalBuffer == null) {
- gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_NORMAL_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_NORMAL_ARRAY);
+ }
} else {
- gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_NORMAL_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_NORMAL_ARRAY);
+ }
normalBuffer.rewind();
if (gl.isGL2ES1()) {
gl.getGL2ES1().glNormalPointer(GL.GL_FLOAT, 0, normalBuffer);
@@ -737,9 +745,13 @@ public class JoglRenderer extends AbstractRenderer {
final FloatBuffer colorBuffer = colorBufferData != null ? colorBufferData.getBuffer() : null;
if (colorBuffer == null) {
- gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_COLOR_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_COLOR_ARRAY);
+ }
} else {
- gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_COLOR_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_COLOR_ARRAY);
+ }
colorBuffer.rewind();
if (gl.isGL2ES1()) {
gl.getGL2ES1().glColorPointer(colorBufferData.getValuesPerTuple(), GL.GL_FLOAT, 0, colorBuffer);
@@ -753,9 +765,13 @@ public class JoglRenderer extends AbstractRenderer {
final FloatBuffer fogBuffer = fogBufferData != null ? fogBufferData.getBuffer() : null;
if (fogBuffer == null) {
- gl.getGL2GL3().glDisableClientState(GL2.GL_FOG_COORDINATE_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glDisableClientState(GL2.GL_FOG_COORDINATE_ARRAY);
+ }
} else {
- gl.getGL2GL3().glEnableClientState(GL2.GL_FOG_COORDINATE_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glEnableClientState(GL2.GL_FOG_COORDINATE_ARRAY);
+ }
fogBuffer.rewind();
if (gl.isGL2()) {
gl.getGL2().glFogCoordPointer(GL.GL_FLOAT, 0, fogBuffer);
@@ -792,7 +808,9 @@ public class JoglRenderer extends AbstractRenderer {
enabledTextures &= ~(2 << i);
// disable state
- gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY);
+ }
continue;
}
@@ -801,7 +819,9 @@ public class JoglRenderer extends AbstractRenderer {
if (!valid || !wasOn) {
// enable state
- gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY);
+ }
// enable bit in tracking int
enabledTextures |= (2 << i);
@@ -810,7 +830,9 @@ public class JoglRenderer extends AbstractRenderer {
final FloatBufferData textureBufferData = textureCoords.get(i);
final FloatBuffer textureBuffer = textureBufferData.getBuffer();
- gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY);
+ }
textureBuffer.rewind();
if (gl.isGL2ES1()) {
gl.getGL2ES1().glTexCoordPointer(textureBufferData.getValuesPerTuple(), GL.GL_FLOAT, 0,
@@ -842,8 +864,10 @@ public class JoglRenderer extends AbstractRenderer {
if (primcount < 0) {
gl.glDrawElements(glIndexMode, indices.getBufferLimit(), type, indices.getBuffer());
} else {
- gl.getGL2GL3().glDrawElementsInstanced(glIndexMode, indices.getBufferLimit(), type,
- indices.getBuffer(), primcount);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glDrawElementsInstanced(glIndexMode, indices.getBufferLimit(), type,
+ indices.getBuffer(), primcount);
+ }
}
if (Constants.stats) {
@@ -863,7 +887,10 @@ public class JoglRenderer extends AbstractRenderer {
if (primcount < 0) {
gl.glDrawElements(glIndexMode, count, type, indices.getBuffer());
} else {
- gl.getGL2GL3().glDrawElementsInstanced(glIndexMode, count, type, indices.getBuffer(), primcount);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3()
+ .glDrawElementsInstanced(glIndexMode, count, type, indices.getBuffer(), primcount);
+ }
}
if (Constants.stats) {
@@ -969,13 +996,17 @@ public class JoglRenderer extends AbstractRenderer {
final int vboID = setupVBO(data, context);
if (vboID != 0) {
- gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
+ }
JoglRendererUtil.setBoundVBO(rendRecord, vboID);
if (gl.isGL2ES1()) {
gl.getGL2ES1().glVertexPointer(data.getValuesPerTuple(), GL.GL_FLOAT, 0, 0);
}
} else {
- gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
+ }
}
}
@@ -988,13 +1019,17 @@ public class JoglRenderer extends AbstractRenderer {
final int vboID = setupVBO(data, context);
if (vboID != 0) {
- gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_NORMAL_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_NORMAL_ARRAY);
+ }
JoglRendererUtil.setBoundVBO(rendRecord, vboID);
if (gl.isGL2ES1()) {
gl.getGL2ES1().glNormalPointer(GL.GL_FLOAT, 0, 0);
}
} else {
- gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_NORMAL_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_NORMAL_ARRAY);
+ }
}
}
@@ -1007,13 +1042,17 @@ public class JoglRenderer extends AbstractRenderer {
final int vboID = setupVBO(data, context);
if (vboID != 0) {
- gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_COLOR_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_COLOR_ARRAY);
+ }
JoglRendererUtil.setBoundVBO(rendRecord, vboID);
if (gl.isGL2ES1()) {
gl.getGL2ES1().glColorPointer(data.getValuesPerTuple(), GL.GL_FLOAT, 0, 0);
}
} else {
- gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_COLOR_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_COLOR_ARRAY);
+ }
}
}
@@ -1031,13 +1070,17 @@ public class JoglRenderer extends AbstractRenderer {
final int vboID = setupVBO(data, context);
if (vboID != 0) {
- gl.getGL2GL3().glEnableClientState(GL2.GL_FOG_COORDINATE_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glEnableClientState(GL2.GL_FOG_COORDINATE_ARRAY);
+ }
JoglRendererUtil.setBoundVBO(rendRecord, vboID);
if (gl.isGL2()) {
gl.getGL2().glFogCoordPointer(GL.GL_FLOAT, 0, 0);
}
} else {
- gl.getGL2GL3().glDisableClientState(GL2.GL_FOG_COORDINATE_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glDisableClientState(GL2.GL_FOG_COORDINATE_ARRAY);
+ }
}
}
@@ -1069,7 +1112,9 @@ public class JoglRenderer extends AbstractRenderer {
enabledTextures &= ~(2 << i);
// disable state
- gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY);
+ }
continue;
}
@@ -1087,7 +1132,9 @@ public class JoglRenderer extends AbstractRenderer {
enabledTextures |= (2 << i);
// enable state
- gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY);
+ }
}
// set our active vbo
@@ -1105,7 +1152,9 @@ public class JoglRenderer extends AbstractRenderer {
enabledTextures &= ~(2 << i);
// disable state
- gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY);
+ }
}
}
}
@@ -1148,10 +1197,14 @@ public class JoglRenderer extends AbstractRenderer {
if (gl.isGL2ES1()) {
gl.getGL2ES1().glNormalPointer(GL.GL_FLOAT, 0, offsetBytes);
}
- gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_NORMAL_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_NORMAL_ARRAY);
+ }
offsetBytes += normalCoords.getBufferLimit() * 4;
} else {
- gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_NORMAL_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_NORMAL_ARRAY);
+ }
}
if (colorCoords != null) {
@@ -1159,10 +1212,14 @@ public class JoglRenderer extends AbstractRenderer {
if (gl.isGL2ES1()) {
gl.getGL2ES1().glColorPointer(colorCoords.getValuesPerTuple(), GL.GL_FLOAT, 0, offsetBytes);
}
- gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_COLOR_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_COLOR_ARRAY);
+ }
offsetBytes += colorCoords.getBufferLimit() * 4;
} else {
- gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_COLOR_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_COLOR_ARRAY);
+ }
}
if (textureCoords != null) {
@@ -1188,7 +1245,9 @@ public class JoglRenderer extends AbstractRenderer {
enabledTextures &= ~(2 << i);
// disable state
- gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY);
+ }
continue;
}
@@ -1205,7 +1264,9 @@ public class JoglRenderer extends AbstractRenderer {
enabledTextures |= (2 << i);
// enable state
- gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY);
+ }
}
// send data
@@ -1227,9 +1288,13 @@ public class JoglRenderer extends AbstractRenderer {
if (gl.isGL2ES1()) {
gl.getGL2ES1().glVertexPointer(vertexCoords.getValuesPerTuple(), GL.GL_FLOAT, 0, offsetBytes);
}
- gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
+ }
} else {
- gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
+ }
}
}
@@ -1314,8 +1379,10 @@ public class JoglRenderer extends AbstractRenderer {
if (primcount < 0) {
gl.glDrawElements(glIndexMode, indices.getBufferLimit(), type, 0);
} else {
- gl.getGL2GL3().glDrawElementsInstanced(glIndexMode, indices.getBufferLimit(), type,
- indices.getBuffer(), primcount);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glDrawElementsInstanced(glIndexMode, indices.getBufferLimit(), type,
+ indices.getBuffer(), primcount);
+ }
}
if (Constants.stats) {
@@ -1339,7 +1406,10 @@ public class JoglRenderer extends AbstractRenderer {
} else {
final int previousPos = indices.getBuffer().position();
indices.getBuffer().position(offset * byteSize);
- gl.getGL2GL3().glDrawElementsInstanced(glIndexMode, count, type, indices.getBuffer(), primcount);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3()
+ .glDrawElementsInstanced(glIndexMode, count, type, indices.getBuffer(), primcount);
+ }
indices.getBuffer().position(previousPos);
}
@@ -1366,7 +1436,9 @@ public class JoglRenderer extends AbstractRenderer {
if (primcount < 0) {
gl.glDrawArrays(glIndexMode, 0, vertexBuffer.getTupleCount());
} else {
- gl.getGL2GL3().glDrawArraysInstanced(glIndexMode, 0, vertexBuffer.getTupleCount(), primcount);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glDrawArraysInstanced(glIndexMode, 0, vertexBuffer.getTupleCount(), primcount);
+ }
}
if (Constants.stats) {
@@ -1383,7 +1455,9 @@ public class JoglRenderer extends AbstractRenderer {
if (primcount < 0) {
gl.glDrawArrays(glIndexMode, offset, count);
} else {
- gl.getGL2GL3().glDrawArraysInstanced(glIndexMode, offset, count, primcount);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glDrawArraysInstanced(glIndexMode, offset, count, primcount);
+ }
}
if (Constants.stats) {
@@ -1588,7 +1662,10 @@ public class JoglRenderer extends AbstractRenderer {
break;
}
- GLContext.getCurrentGL().getGL2GL3().glDrawBuffer(buffer);
+ final GL gl = GLContext.getCurrentGL();
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glDrawBuffer(buffer);
+ }
record.setDrawBufferTarget(target);
}
}
@@ -1648,21 +1725,29 @@ public class JoglRenderer extends AbstractRenderer {
final GL gl = GLContext.getCurrentGL();
// TODO: make this into a pointrecord call
- gl.getGL2GL3().glPointSize(pointSize);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glPointSize(pointSize);
+ }
if (antialiased) {
- gl.glEnable(GL2ES1.GL_POINT_SMOOTH);
- gl.glHint(GL2ES1.GL_POINT_SMOOTH_HINT, GL.GL_NICEST);
+ if (gl.isGL2ES1()) {
+ gl.glEnable(GL2ES1.GL_POINT_SMOOTH);
+ gl.glHint(GL2ES1.GL_POINT_SMOOTH_HINT, GL.GL_NICEST);
+ }
}
if (isSprite && context.getCapabilities().isPointSpritesSupported()) {
- gl.glEnable(GL2ES1.GL_POINT_SPRITE);
- gl.getGL2ES1().glTexEnvi(GL2ES1.GL_POINT_SPRITE, GL2ES1.GL_COORD_REPLACE, GL.GL_TRUE);
+ if (gl.isGL2ES1()) {
+ gl.glEnable(GL2ES1.GL_POINT_SPRITE);
+ gl.getGL2ES1().glTexEnvi(GL2ES1.GL_POINT_SPRITE, GL2ES1.GL_COORD_REPLACE, GL.GL_TRUE);
+ }
}
if (useDistanceAttenuation && context.getCapabilities().isPointParametersSupported()) {
- gl.getGL2GL3().glPointParameterfv(GL2ES1.GL_POINT_DISTANCE_ATTENUATION, attenuationCoefficients);
- gl.getGL2GL3().glPointParameterf(GL2ES1.GL_POINT_SIZE_MIN, minPointSize);
- gl.getGL2GL3().glPointParameterf(GL2ES1.GL_POINT_SIZE_MAX, maxPointSize);
+ if (gl.isGL2GL3()) {
+ gl.getGL2GL3().glPointParameterfv(GL2ES1.GL_POINT_DISTANCE_ATTENUATION, attenuationCoefficients);
+ gl.getGL2GL3().glPointParameterf(GL2ES1.GL_POINT_SIZE_MIN, minPointSize);
+ gl.getGL2GL3().glPointParameterf(GL2ES1.GL_POINT_SIZE_MAX, maxPointSize);
+ }
}
}
@@ -1753,7 +1838,8 @@ public class JoglRenderer extends AbstractRenderer {
* Ends a display list. Will likely cause an OpenGL exception is a display list is not currently being generated.
*/
public void endDisplayList() {
- GLContext.getCurrentGL().getGL2().glEndList();
+ final GL gl = GLContext.getCurrentGL();
+ gl.getGL2().glEndList();
}
/**
@@ -1807,7 +1893,9 @@ public class JoglRenderer extends AbstractRenderer {
public void checkAndSetTextureArrayUnit(final int unit, final GL gl, final RendererRecord record,
final ContextCapabilities caps) {
if (record.getCurrentTextureArraysUnit() != unit && caps.isMultitextureSupported()) {
- gl.getGL2().glClientActiveTexture(GL.GL_TEXTURE0 + unit);
+ if (gl.isGL2ES1()) {
+ gl.getGL2ES1().glClientActiveTexture(GL.GL_TEXTURE0 + unit);
+ }
record.setCurrentTextureArraysUnit(unit);
}
}
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglBlendStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglBlendStateUtil.java
index 30c86e4..4d7f834 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglBlendStateUtil.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglBlendStateUtil.java
@@ -128,8 +128,10 @@ public abstract class JoglBlendStateUtil {
if (applyConstant && caps.isConstantBlendColorSupported()) {
final ReadOnlyColorRGBA constant = state.getConstantColor();
if (!record.isValid() || (caps.isConstantBlendColorSupported() && !record.blendColor.equals(constant))) {
- gl.getGL2GL3().glBlendColor(constant.getRed(), constant.getGreen(), constant.getBlue(),
- constant.getAlpha());
+ if (gl.isGL2ES2()) {
+ gl.getGL2ES2().glBlendColor(constant.getRed(), constant.getGreen(), constant.getBlue(),
+ constant.getAlpha());
+ }
record.blendColor.set(constant);
}
}
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java
index 1bbe675..9ebc82d 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java
@@ -562,11 +562,11 @@ public class JoglTextureStateUtil {
final int depth = Math.max(1, image.getDepth() >> m);
// already checked for support above...
if (texture.getTextureStoreFormat().isCompressed()) {
- gl.getGL2GL3().glCompressedTexImage3D(GL2ES2.GL_TEXTURE_3D, m,
+ gl.getGL2ES2().glCompressedTexImage3D(GL2ES2.GL_TEXTURE_3D, m,
JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()),
width, height, depth, hasBorder ? 1 : 0, mipSizes[m], data);
} else {
- gl.getGL2GL3().glTexImage3D(GL2ES2.GL_TEXTURE_3D, m,
+ gl.getGL2ES2().glTexImage3D(GL2ES2.GL_TEXTURE_3D, m,
JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()),
width, height, depth, hasBorder ? 1 : 0,
JoglTextureUtil.getGLPixelFormat(image.getDataFormat()),
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/shader/JoglShaderUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/shader/JoglShaderUtil.java
index 0375e69..4748cd3 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/shader/JoglShaderUtil.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/shader/JoglShaderUtil.java
@@ -106,7 +106,7 @@ public abstract class JoglShaderUtil {
final GL gl = GLContext.getCurrentGL();
if (variable.variableID == -1) {
- variable.variableID = gl.getGL2GL3().glGetUniformLocation(programID, variable.name); // TODO Check
+ variable.variableID = gl.getGL2ES2().glGetUniformLocation(programID, variable.name); // TODO Check
// variable.name
if (variable.variableID == -1 && !variable.errorLogged) {
@@ -119,26 +119,26 @@ public abstract class JoglShaderUtil {
private static void updateShaderUniform(final ShaderVariableInt shaderUniform) {
final GL gl = GLContext.getCurrentGL();
- gl.getGL2GL3().glUniform1i(shaderUniform.variableID, shaderUniform.value1);
+ gl.getGL2ES2().glUniform1i(shaderUniform.variableID, shaderUniform.value1);
}
private static void updateShaderUniform(final ShaderVariableInt2 shaderUniform) {
final GL gl = GLContext.getCurrentGL();
- gl.getGL2GL3().glUniform2i(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2);
+ gl.getGL2ES2().glUniform2i(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2);
}
private static void updateShaderUniform(final ShaderVariableInt3 shaderUniform) {
final GL gl = GLContext.getCurrentGL();
- gl.getGL2GL3().glUniform3i(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2,
+ gl.getGL2ES2().glUniform3i(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2,
shaderUniform.value3);
}
private static void updateShaderUniform(final ShaderVariableInt4 shaderUniform) {
final GL gl = GLContext.getCurrentGL();
- gl.getGL2GL3().glUniform4i(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2,
+ gl.getGL2ES2().glUniform4i(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2,
shaderUniform.value3, shaderUniform.value4);
}
@@ -147,19 +147,19 @@ public abstract class JoglShaderUtil {
switch (shaderUniform.size) {
case 1:
- gl.getGL2GL3().glUniform1iv(shaderUniform.variableID, shaderUniform.value.remaining(),
+ gl.getGL2ES2().glUniform1iv(shaderUniform.variableID, shaderUniform.value.remaining(),
shaderUniform.value);
break;
case 2:
- gl.getGL2GL3().glUniform2iv(shaderUniform.variableID, shaderUniform.value.remaining(),
+ gl.getGL2ES2().glUniform2iv(shaderUniform.variableID, shaderUniform.value.remaining(),
shaderUniform.value);
break;
case 3:
- gl.getGL2GL3().glUniform3iv(shaderUniform.variableID, shaderUniform.value.remaining(),
+ gl.getGL2ES2().glUniform3iv(shaderUniform.variableID, shaderUniform.value.remaining(),
shaderUniform.value);
break;
case 4:
- gl.getGL2GL3().glUniform4iv(shaderUniform.variableID, shaderUniform.value.remaining(),
+ gl.getGL2ES2().glUniform4iv(shaderUniform.variableID, shaderUniform.value.remaining(),
shaderUniform.value);
break;
default:
@@ -170,26 +170,26 @@ public abstract class JoglShaderUtil {
private static void updateShaderUniform(final ShaderVariableFloat shaderUniform) {
final GL gl = GLContext.getCurrentGL();
- gl.getGL2GL3().glUniform1f(shaderUniform.variableID, shaderUniform.value1);
+ gl.getGL2ES2().glUniform1f(shaderUniform.variableID, shaderUniform.value1);
}
private static void updateShaderUniform(final ShaderVariableFloat2 shaderUniform) {
final GL gl = GLContext.getCurrentGL();
- gl.getGL2GL3().glUniform2f(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2);
+ gl.getGL2ES2().glUniform2f(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2);
}
private static void updateShaderUniform(final ShaderVariableFloat3 shaderUniform) {
final GL gl = GLContext.getCurrentGL();
- gl.getGL2GL3().glUniform3f(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2,
+ gl.getGL2ES2().glUniform3f(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2,
shaderUniform.value3);
}
private static void updateShaderUniform(final ShaderVariableFloat4 shaderUniform) {
final GL gl = GLContext.getCurrentGL();
- gl.getGL2GL3().glUniform4f(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2,
+ gl.getGL2ES2().glUniform4f(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2,
shaderUniform.value3, shaderUniform.value4);
}
@@ -198,19 +198,19 @@ public abstract class JoglShaderUtil {
switch (shaderUniform.size) {
case 1:
- gl.getGL2GL3().glUniform1fv(shaderUniform.variableID, shaderUniform.value.remaining(),
+ gl.getGL2ES2().glUniform1fv(shaderUniform.variableID, shaderUniform.value.remaining(),
shaderUniform.value);
break;
case 2:
- gl.getGL2GL3().glUniform2fv(shaderUniform.variableID, shaderUniform.value.remaining(),
+ gl.getGL2ES2().glUniform2fv(shaderUniform.variableID, shaderUniform.value.remaining(),
shaderUniform.value);
break;
case 3:
- gl.getGL2GL3().glUniform3fv(shaderUniform.variableID, shaderUniform.value.remaining(),
+ gl.getGL2ES2().glUniform3fv(shaderUniform.variableID, shaderUniform.value.remaining(),
shaderUniform.value);
break;
case 4:
- gl.getGL2GL3().glUniform4fv(shaderUniform.variableID, shaderUniform.value.remaining(),
+ gl.getGL2ES2().glUniform4fv(shaderUniform.variableID, shaderUniform.value.remaining(),
shaderUniform.value);
break;
default:
@@ -222,7 +222,7 @@ public abstract class JoglShaderUtil {
final GL gl = GLContext.getCurrentGL();
shaderUniform.matrixBuffer.rewind();
- gl.getGL2GL3().glUniformMatrix2fv(shaderUniform.variableID, 1, shaderUniform.rowMajor,
+ gl.getGL2ES2().glUniformMatrix2fv(shaderUniform.variableID, 1, shaderUniform.rowMajor,
shaderUniform.matrixBuffer);
}
@@ -230,7 +230,7 @@ public abstract class JoglShaderUtil {
final GL gl = GLContext.getCurrentGL();
shaderUniform.matrixBuffer.rewind();
- gl.getGL2GL3().glUniformMatrix3fv(shaderUniform.variableID, 1, shaderUniform.rowMajor,
+ gl.getGL2ES2().glUniformMatrix3fv(shaderUniform.variableID, 1, shaderUniform.rowMajor,
shaderUniform.matrixBuffer);
}
@@ -238,7 +238,7 @@ public abstract class JoglShaderUtil {
final GL gl = GLContext.getCurrentGL();
shaderUniform.matrixBuffer.rewind();
- gl.getGL2GL3().glUniformMatrix4fv(shaderUniform.variableID, 1, shaderUniform.rowMajor,
+ gl.getGL2ES2().glUniformMatrix4fv(shaderUniform.variableID, 1, shaderUniform.rowMajor,
shaderUniform.matrixBuffer);
}
@@ -247,7 +247,7 @@ public abstract class JoglShaderUtil {
shaderUniform.matrixBuffer.rewind();
// count == number of matrices we are sending, or iotw, limit / 16
- gl.getGL2GL3().glUniformMatrix4fv(shaderUniform.variableID, shaderUniform.matrixBuffer.limit() >> 4,
+ gl.getGL2ES2().glUniformMatrix4fv(shaderUniform.variableID, shaderUniform.matrixBuffer.limit() >> 4,
shaderUniform.rowMajor, shaderUniform.matrixBuffer);
}
@@ -263,7 +263,7 @@ public abstract class JoglShaderUtil {
final GL gl = GLContext.getCurrentGL();
if (variable.variableID == -1) {
- variable.variableID = gl.getGL2GL3().glGetAttribLocation(programID, variable.name); // TODO Check
+ variable.variableID = gl.getGL2ES2().glGetAttribLocation(programID, variable.name); // TODO Check
// variable.name
if (variable.variableID == -1 && !variable.errorLogged) {
@@ -336,11 +336,11 @@ public abstract class JoglShaderUtil {
private static void enableVertexAttribute(final ShaderVariable var, final ShaderObjectsStateRecord record) {
if (!record.enabledAttributes.contains(var)) {
if (var.getSize() == 1) {
- GLContext.getCurrentGL().getGL2GL3().glEnableVertexAttribArray(var.variableID);
+ GLContext.getCurrentGL().getGL2ES2().glEnableVertexAttribArray(var.variableID);
} else {
final GL gl = GLContext.getCurrentGL();
for (int i = 0, max = var.getSize(); i < max; i++) {
- gl.getGL2GL3().glEnableVertexAttribArray(var.variableID + i);
+ gl.getGL2ES2().glEnableVertexAttribArray(var.variableID + i);
}
}
record.enabledAttributes.add(var);
@@ -356,14 +356,14 @@ public abstract class JoglShaderUtil {
JoglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId);
GLContext
.getCurrentGL()
- .getGL2GL3()
+ .getGL2ES2()
.glVertexAttribPointer(variable.variableID, variable.size, GL.GL_FLOAT, variable.normalized,
variable.stride, 0);
} else {
variable.data.getBuffer().rewind();
GLContext
.getCurrentGL()
- .getGL2GL3()
+ .getGL2ES2()
.glVertexAttribPointer(variable.variableID, variable.size, GL.GL_FLOAT, variable.normalized,
variable.stride, variable.data.getBuffer());
}
@@ -382,12 +382,12 @@ public abstract class JoglShaderUtil {
if (useVBO) {
final int vboId = JoglRenderer.setupVBO(variable.data, context);
JoglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId);
- gl.getGL2GL3().glVertexAttribPointer(variable.variableID + i, size, GL.GL_FLOAT, variable.normalized,
+ gl.getGL2ES2().glVertexAttribPointer(variable.variableID + i, size, GL.GL_FLOAT, variable.normalized,
0, pos);
} else {
variable.data.getBuffer().limit(pos + length - 1);
variable.data.getBuffer().position(pos);
- gl.getGL2GL3().glVertexAttribPointer(variable.variableID + i, size, GL.GL_FLOAT, variable.normalized,
+ gl.getGL2ES2().glVertexAttribPointer(variable.variableID + i, size, GL.GL_FLOAT, variable.normalized,
0, variable.data.getBuffer());
}
}
@@ -402,7 +402,7 @@ public abstract class JoglShaderUtil {
JoglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId);
GLContext
.getCurrentGL()
- .getGL2GL3()
+ .getGL2ES2()
.glVertexAttribPointer(variable.variableID, variable.size,
variable.unsigned ? GL.GL_UNSIGNED_BYTE : GL.GL_BYTE, variable.normalized, variable.stride,
0);
@@ -410,7 +410,7 @@ public abstract class JoglShaderUtil {
variable.data.getBuffer().rewind();
GLContext
.getCurrentGL()
- .getGL2GL3()
+ .getGL2ES2()
.glVertexAttribPointer(variable.variableID, variable.size,
variable.unsigned ? GL.GL_UNSIGNED_BYTE : GL.GL_BYTE, variable.normalized, variable.stride,
variable.data.getBuffer());
@@ -426,7 +426,7 @@ public abstract class JoglShaderUtil {
JoglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId);
GLContext
.getCurrentGL()
- .getGL2GL3()
+ .getGL2ES2()
.glVertexAttribPointer(variable.variableID, variable.size,
variable.unsigned ? GL.GL_UNSIGNED_INT : GL2ES2.GL_INT, variable.normalized,
variable.stride, 0);
@@ -434,7 +434,7 @@ public abstract class JoglShaderUtil {
variable.data.getBuffer().rewind();
GLContext
.getCurrentGL()
- .getGL2GL3()
+ .getGL2ES2()
.glVertexAttribPointer(variable.variableID, variable.size,
variable.unsigned ? GL.GL_UNSIGNED_INT : GL2ES2.GL_INT, variable.normalized,
variable.stride, variable.data.getBuffer());
@@ -450,7 +450,7 @@ public abstract class JoglShaderUtil {
JoglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId);
GLContext
.getCurrentGL()
- .getGL2GL3()
+ .getGL2ES2()
.glVertexAttribPointer(variable.variableID, variable.size,
variable.unsigned ? GL.GL_UNSIGNED_SHORT : GL.GL_SHORT, variable.normalized,
variable.stride, 0);
@@ -458,7 +458,7 @@ public abstract class JoglShaderUtil {
variable.data.getBuffer().rewind();
GLContext
.getCurrentGL()
- .getGL2GL3()
+ .getGL2ES2()
.glVertexAttribPointer(variable.variableID, variable.size,
variable.unsigned ? GL.GL_UNSIGNED_SHORT : GL.GL_SHORT, variable.normalized,
variable.stride, variable.data.getBuffer());