aboutsummaryrefslogtreecommitdiffstats
path: root/ardor3d-jogl/src/main/java/com/ardor3d
diff options
context:
space:
mode:
authorJulien Gouesse <[email protected]>2013-01-25 19:46:03 +0100
committerJulien Gouesse <[email protected]>2013-01-25 19:46:03 +0100
commitbe62dac324bc0f84ef4bae61893cb6acb36ba36e (patch)
treeb1142a6f27ac9b87b227a74118830d12bdfd1f76 /ardor3d-jogl/src/main/java/com/ardor3d
parentad0ca2d851240408aa47851019f037d1072784f4 (diff)
Replaces GLU.getCurrent*() by GLContext.getCurrent*()
Diffstat (limited to 'ardor3d-jogl/src/main/java/com/ardor3d')
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvasRenderer.java3
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglPbufferTextureRenderer.java15
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglRenderer.java152
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglTextureRenderer.java70
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglBlendStateUtil.java7
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglClipStateUtil.java4
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglColorMaskStateUtil.java4
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglCullStateUtil.java8
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglFogStateUtil.java18
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglFragmentProgramStateUtil.java16
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglLightStateUtil.java60
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglMaterialStateUtil.java23
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglOffsetStateUtil.java6
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglShaderObjectsStateUtil.java55
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglShadingStateUtil.java6
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglStencilStateUtil.java37
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java318
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglVertexProgramStateUtil.java28
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglWireframeStateUtil.java6
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglZBufferStateUtil.java3
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/shader/JoglShaderUtil.java168
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/util/JoglRendererUtil.java12
22 files changed, 548 insertions, 471 deletions
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvasRenderer.java b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvasRenderer.java
index 6618fbf..70aacb4 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvasRenderer.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvasRenderer.java
@@ -18,7 +18,6 @@ import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawableFactory;
import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;
-import javax.media.opengl.glu.GLU;
import com.ardor3d.annotation.MainThread;
import com.ardor3d.framework.CanvasRenderer;
@@ -146,7 +145,7 @@ public class JoglCanvasRenderer implements CanvasRenderer {
_renderer = new JoglRenderer();
if (settings.getSamples() != 0 && caps.isMultisampleSupported()) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
gl.glEnable(GL.GL_MULTISAMPLE);
}
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglPbufferTextureRenderer.java b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglPbufferTextureRenderer.java
index 63eb6ee..2613f25 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglPbufferTextureRenderer.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglPbufferTextureRenderer.java
@@ -21,7 +21,6 @@ import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawableFactory;
import javax.media.opengl.GLPbuffer;
import javax.media.opengl.GLProfile;
-import javax.media.opengl.glu.GLU;
import com.ardor3d.framework.DisplaySettings;
import com.ardor3d.framework.Scene;
@@ -76,7 +75,7 @@ public class JoglPbufferTextureRenderer extends AbstractPbufferTextureRenderer {
if (tex.getType() != Type.TwoDimensional) {
throw new IllegalArgumentException("Unsupported type: " + tex.getType());
}
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final RenderContext context = ContextManager.getCurrentContext();
final TextureStateRecord record = (TextureStateRecord) context.getStateRecord(RenderState.StateType.Texture);
@@ -99,8 +98,8 @@ public class JoglPbufferTextureRenderer extends AbstractPbufferTextureRenderer {
// Initialize our texture with some default data.
final int internalFormat = JoglTextureUtil.getGLInternalFormat(tex.getTextureStoreFormat());
final int dataFormat = JoglTextureUtil.getGLPixelFormatFromStoreFormat(tex.getTextureStoreFormat());
- final int pixelDataType = JoglTextureUtil.getGLPixelDataType(tex.getRenderedTexturePixelDataType());
-
+ final int pixelDataType = JoglTextureUtil.getGLPixelDataType(tex.getRenderedTexturePixelDataType());
+
gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, internalFormat, _width, _height, 0, dataFormat, pixelDataType, null);
// Setup filtering and wrap
@@ -236,7 +235,7 @@ public class JoglPbufferTextureRenderer extends AbstractPbufferTextureRenderer {
public void copyToTexture(final Texture tex, final int x, final int y, final int width, final int height,
final int xoffset, final int yoffset) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
JoglTextureStateUtil.doTextureBind(tex, 0, true);
@@ -245,7 +244,7 @@ public class JoglPbufferTextureRenderer extends AbstractPbufferTextureRenderer {
@Override
protected void clearBuffers(final int clear) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
gl.glDisable(GL.GL_SCISSOR_TEST);
_parentRenderer.clearBuffers(clear);
@@ -320,7 +319,7 @@ public class JoglPbufferTextureRenderer extends AbstractPbufferTextureRenderer {
ContextManager.getCurrentContext().enforceStates(_enforcedStates);
if (_bgColorDirty) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
gl.glClearColor(_backgroundColor.getRed(), _backgroundColor.getGreen(), _backgroundColor.getBlue(),
_backgroundColor.getAlpha());
@@ -357,7 +356,7 @@ public class JoglPbufferTextureRenderer extends AbstractPbufferTextureRenderer {
}
} else {
// XXX: Is this WGL specific query right?
- if (GLU.getCurrentGL().isExtensionAvailable("WGL_ARB_render_texture")) {
+ if (GLContext.getCurrentGL().isExtensionAvailable("WGL_ARB_render_texture")) {
logger.fine("Render to Texture Pbuffer supported!");
_useDirectRender = true;
} else {
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 7812aa6..4747dfd 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
@@ -90,12 +90,12 @@ import com.ardor3d.scene.state.jogl.JoglZBufferStateUtil;
import com.ardor3d.scene.state.jogl.util.JoglRendererUtil;
import com.ardor3d.scene.state.jogl.util.JoglTextureUtil;
import com.ardor3d.scenegraph.AbstractBufferData;
+import com.ardor3d.scenegraph.AbstractBufferData.VBOAccessMode;
import com.ardor3d.scenegraph.FloatBufferData;
import com.ardor3d.scenegraph.IndexBufferData;
import com.ardor3d.scenegraph.Mesh;
import com.ardor3d.scenegraph.Renderable;
import com.ardor3d.scenegraph.Spatial;
-import com.ardor3d.scenegraph.AbstractBufferData.VBOAccessMode;
import com.ardor3d.scenegraph.hint.NormalsMode;
import com.ardor3d.util.Ardor3dException;
import com.ardor3d.util.Constants;
@@ -122,7 +122,7 @@ public class JoglRenderer extends AbstractRenderer {
}
public void setBackgroundColor(final ReadOnlyColorRGBA c) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
_backgroundColor.set(c);
gl.glClearColor(_backgroundColor.getRed(), _backgroundColor.getGreen(), _backgroundColor.getBlue(),
@@ -163,7 +163,7 @@ public class JoglRenderer extends AbstractRenderer {
}
public void clearBuffers(final int buffers, final boolean strict) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
int clear = 0;
@@ -214,7 +214,7 @@ public class JoglRenderer extends AbstractRenderer {
}
public void flushFrame(final boolean doSwap) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
renderBuckets();
@@ -240,7 +240,7 @@ public class JoglRenderer extends AbstractRenderer {
}
public void setOrtho() {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (_inOrthoMode) {
throw new Ardor3dException("Already in Orthographic mode.");
@@ -261,7 +261,7 @@ public class JoglRenderer extends AbstractRenderer {
}
public void unsetOrtho() {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (!_inOrthoMode) {
throw new Ardor3dException("Not in Orthographic mode.");
@@ -278,7 +278,7 @@ public class JoglRenderer extends AbstractRenderer {
public void grabScreenContents(final ByteBuffer store, final ImageDataFormat format, final int x, final int y,
final int w, final int h) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final int pixFormat = JoglTextureUtil.getGLPixelFormat(format);
gl.glReadPixels(x, y, w, h, pixFormat, GL.GL_UNSIGNED_BYTE, store);
@@ -303,23 +303,23 @@ public class JoglRenderer extends AbstractRenderer {
* re-initializes the GL context for rendering of another piece of geometry.
*/
protected void postdrawGeometry(final Mesh g) {
- // Nothing to do here yet
+ // Nothing to do here yet
}
public void flushGraphics() {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
gl.glFlush();
}
public void finishGraphics() {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
gl.glFinish();
}
public void applyNormalsMode(final NormalsMode normalsMode, final ReadOnlyTransform worldTransform) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final RenderContext context = ContextManager.getCurrentContext();
final RendererRecord rendRecord = context.getRendererRecord();
if (normalsMode != NormalsMode.Off) {
@@ -403,17 +403,17 @@ public class JoglRenderer extends AbstractRenderer {
}
public void applyDefaultColor(final ReadOnlyColorRGBA defaultColor) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (defaultColor != null) {
- gl.getGL2().glColor4f(defaultColor.getRed(), defaultColor.getGreen(), defaultColor.getBlue(), defaultColor
- .getAlpha());
+ gl.getGL2().glColor4f(defaultColor.getRed(), defaultColor.getGreen(), defaultColor.getBlue(),
+ defaultColor.getAlpha());
} else {
gl.getGL2().glColor4f(1, 1, 1, 1);
}
}
public void deleteVBOs(final Collection<Integer> ids) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final IntBuffer idBuffer = BufferUtils.createIntBuffer(ids.size());
idBuffer.clear();
for (final Integer i : ids) {
@@ -428,7 +428,7 @@ public class JoglRenderer extends AbstractRenderer {
}
public void deleteDisplayLists(final Collection<Integer> ids) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
for (final Integer i : ids) {
if (i != null && i != 0) {
gl.getGL2().glDeleteLists(i, 1);
@@ -441,7 +441,7 @@ public class JoglRenderer extends AbstractRenderer {
return;
}
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
// ask for the current state record
final RenderContext context = ContextManager.getCurrentContext();
@@ -492,7 +492,7 @@ public class JoglRenderer extends AbstractRenderer {
final int srcOffsetX, final int srcOffsetY, final int srcOffsetZ, final int srcTotalWidth,
final int srcTotalHeight, final Face dstFace) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
// Ignore textures that do not have an id set
if (destination.getTextureIdForContext(ContextManager.getCurrentContext().getGlContextRep()) == 0) {
@@ -537,12 +537,12 @@ public class JoglRenderer extends AbstractRenderer {
}
// Grab pixel format
- final int pixelFormat;
- if (destination.getImage() != null) {
- pixelFormat = JoglTextureUtil.getGLPixelFormat(destination.getImage().getDataFormat());
- } else {
- pixelFormat = JoglTextureUtil.getGLPixelFormatFromStoreFormat(destination.getTextureStoreFormat());
- }
+ final int pixelFormat;
+ if (destination.getImage() != null) {
+ pixelFormat = JoglTextureUtil.getGLPixelFormat(destination.getImage().getDataFormat());
+ } else {
+ pixelFormat = JoglTextureUtil.getGLPixelFormatFromStoreFormat(destination.getTextureStoreFormat());
+ }
// bind...
JoglTextureStateUtil.doTextureBind(destination, 0, false);
@@ -577,12 +577,12 @@ public class JoglRenderer extends AbstractRenderer {
GL.GL_UNSIGNED_BYTE, source);
break;
case OneDimensional:
- gl.getGL2GL3().glTexSubImage1D(GL2GL3.GL_TEXTURE_1D, 0, dstOffsetX, dstWidth, pixelFormat, GL.GL_UNSIGNED_BYTE,
- source);
+ gl.getGL2GL3().glTexSubImage1D(GL2GL3.GL_TEXTURE_1D, 0, dstOffsetX, dstWidth, pixelFormat,
+ GL.GL_UNSIGNED_BYTE, source);
break;
case ThreeDimensional:
- gl.getGL2GL3().glTexSubImage3D(GL2ES2.GL_TEXTURE_3D, 0, dstOffsetX, dstOffsetY, dstOffsetZ, dstWidth, dstHeight,
- dstDepth, pixelFormat, GL.GL_UNSIGNED_BYTE, source);
+ gl.getGL2GL3().glTexSubImage3D(GL2ES2.GL_TEXTURE_3D, 0, dstOffsetX, dstOffsetY, dstOffsetZ,
+ dstWidth, dstHeight, dstDepth, pixelFormat, GL.GL_UNSIGNED_BYTE, source);
break;
case CubeMap:
gl.glTexSubImage2D(JoglTextureStateUtil.getGLCubeMapFace(dstFace), 0, dstOffsetX, dstOffsetY,
@@ -621,7 +621,7 @@ public class JoglRenderer extends AbstractRenderer {
}
public void checkCardError() throws Ardor3dException {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final GLU glu = new GLU();
try {
@@ -645,7 +645,7 @@ public class JoglRenderer extends AbstractRenderer {
}
public boolean doTransforms(final ReadOnlyTransform transform) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
// set world matrix
if (!transform.isIdentity()) {
@@ -663,7 +663,7 @@ public class JoglRenderer extends AbstractRenderer {
}
public void undoTransforms(final ReadOnlyTransform transform) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final RendererRecord matRecord = ContextManager.getCurrentContext().getRendererRecord();
JoglRendererUtil.switchMode(matRecord, GLMatrixFunc.GL_MODELVIEW);
@@ -671,7 +671,7 @@ public class JoglRenderer extends AbstractRenderer {
}
public void setupVertexData(final FloatBufferData vertexBufferData) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final FloatBuffer vertexBuffer = vertexBufferData != null ? vertexBufferData.getBuffer() : null;
@@ -685,7 +685,7 @@ public class JoglRenderer extends AbstractRenderer {
}
public void setupNormalData(final FloatBufferData normalBufferData) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final FloatBuffer normalBuffer = normalBufferData != null ? normalBufferData.getBuffer() : null;
@@ -699,7 +699,7 @@ public class JoglRenderer extends AbstractRenderer {
}
public void setupColorData(final FloatBufferData colorBufferData) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final FloatBuffer colorBuffer = colorBufferData != null ? colorBufferData.getBuffer() : null;
@@ -713,7 +713,7 @@ public class JoglRenderer extends AbstractRenderer {
}
public void setupFogData(final FloatBufferData fogBufferData) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final FloatBuffer fogBuffer = fogBufferData != null ? fogBufferData.getBuffer() : null;
@@ -727,7 +727,7 @@ public class JoglRenderer extends AbstractRenderer {
}
public void setupTextureData(final List<FloatBufferData> textureCoords) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final RenderContext context = ContextManager.getCurrentContext();
final ContextCapabilities caps = context.getCapabilities();
@@ -791,7 +791,7 @@ public class JoglRenderer extends AbstractRenderer {
return;
}
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final int type = getGLDataType(indices);
if (indexLengths == null) {
@@ -802,8 +802,8 @@ 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);
+ gl.getGL2GL3().glDrawElementsInstanced(glIndexMode, indices.getBufferLimit(), type,
+ indices.getBuffer(), primcount);
}
if (Constants.stats) {
@@ -844,7 +844,7 @@ public class JoglRenderer extends AbstractRenderer {
return 0;
}
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final RendererRecord rendRecord = context.getRendererRecord();
int vboID = data.getVBOID(context.getGlContextRep());
@@ -873,12 +873,11 @@ public class JoglRenderer extends AbstractRenderer {
private static void updateVBO(final AbstractBufferData<? extends Buffer> data, final RendererRecord rendRecord,
final int vboID, final int offsetBytes) {
if (data.isNeedsRefresh()) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final Buffer dataBuffer = data.getBuffer();
dataBuffer.rewind();
JoglRendererUtil.setBoundVBO(rendRecord, vboID);
- gl.glBufferSubData(GL.GL_ARRAY_BUFFER, offsetBytes, dataBuffer.limit() * data.getByteCount(),
- dataBuffer);
+ gl.glBufferSubData(GL.GL_ARRAY_BUFFER, offsetBytes, dataBuffer.limit() * data.getByteCount(), dataBuffer);
data.setNeedsRefresh(false);
}
}
@@ -889,7 +888,7 @@ public class JoglRenderer extends AbstractRenderer {
return 0;
}
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
int vboID = data.getVBOID(context.getGlContextRep());
if (vboID != 0) {
@@ -897,8 +896,7 @@ public class JoglRenderer extends AbstractRenderer {
final Buffer dataBuffer = data.getBuffer();
dataBuffer.rewind();
JoglRendererUtil.setBoundElementVBO(rendRecord, vboID);
- gl.glBufferSubData(GL.GL_ELEMENT_ARRAY_BUFFER, 0, dataBuffer.limit() * data.getByteCount(),
- dataBuffer);
+ gl.glBufferSubData(GL.GL_ELEMENT_ARRAY_BUFFER, 0, dataBuffer.limit() * data.getByteCount(), dataBuffer);
data.setNeedsRefresh(false);
}
@@ -923,7 +921,7 @@ public class JoglRenderer extends AbstractRenderer {
}
public void setupVertexDataVBO(final FloatBufferData data) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final RenderContext context = ContextManager.getCurrentContext();
final RendererRecord rendRecord = context.getRendererRecord();
@@ -940,7 +938,7 @@ public class JoglRenderer extends AbstractRenderer {
}
public void setupNormalDataVBO(final FloatBufferData data) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final RenderContext context = ContextManager.getCurrentContext();
final RendererRecord rendRecord = context.getRendererRecord();
@@ -957,7 +955,7 @@ public class JoglRenderer extends AbstractRenderer {
}
public void setupColorDataVBO(final FloatBufferData data) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final RenderContext context = ContextManager.getCurrentContext();
final RendererRecord rendRecord = context.getRendererRecord();
@@ -974,7 +972,7 @@ public class JoglRenderer extends AbstractRenderer {
}
public void setupFogDataVBO(final FloatBufferData data) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final RenderContext context = ContextManager.getCurrentContext();
final ContextCapabilities caps = context.getCapabilities();
@@ -996,7 +994,7 @@ public class JoglRenderer extends AbstractRenderer {
}
public void setupTextureDataVBO(final List<FloatBufferData> textureCoords) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final RenderContext context = ContextManager.getCurrentContext();
final RendererRecord rendRecord = context.getRendererRecord();
@@ -1071,7 +1069,7 @@ public class JoglRenderer extends AbstractRenderer {
public void setupInterleavedDataVBO(final FloatBufferData interleaved, final FloatBufferData vertexCoords,
final FloatBufferData normalCoords, final FloatBufferData colorCoords,
final List<FloatBufferData> textureCoords) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final RenderContext context = ContextManager.getCurrentContext();
final RendererRecord rendRecord = context.getRendererRecord();
@@ -1157,7 +1155,8 @@ public class JoglRenderer extends AbstractRenderer {
}
// send data
- gl.getGL2().glTexCoordPointer(textureBufferData.getValuesPerTuple(), GL.GL_FLOAT, 0, offsetBytes);
+ gl.getGL2().glTexCoordPointer(textureBufferData.getValuesPerTuple(), GL.GL_FLOAT, 0,
+ offsetBytes);
offsetBytes += textureBufferData.getBufferLimit() * 4;
}
}
@@ -1188,7 +1187,7 @@ public class JoglRenderer extends AbstractRenderer {
interleaved.getBuffer().rewind();
interleaved.getBuffer().put(bufferSize);
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final RendererRecord rendRecord = context.getRendererRecord();
final ContextCapabilities caps = context.getCapabilities();
@@ -1198,21 +1197,17 @@ public class JoglRenderer extends AbstractRenderer {
rendRecord.invalidateVBO();
JoglRendererUtil.setBoundVBO(rendRecord, vboID);
- gl
- .glBufferData(GL.GL_ARRAY_BUFFER, bufferSize, null, getGLVBOAccessMode(interleaved
- .getVboAccessMode()));
+ gl.glBufferData(GL.GL_ARRAY_BUFFER, bufferSize, null, getGLVBOAccessMode(interleaved.getVboAccessMode()));
int offset = 0;
if (normalCoords != null) {
normalCoords.getBuffer().rewind();
- gl.glBufferSubData(GL.GL_ARRAY_BUFFER, offset, normalCoords.getBufferLimit() * 4, normalCoords
- .getBuffer());
+ gl.glBufferSubData(GL.GL_ARRAY_BUFFER, offset, normalCoords.getBufferLimit() * 4, normalCoords.getBuffer());
offset += normalCoords.getBufferLimit() * 4;
}
if (colorCoords != null) {
colorCoords.getBuffer().rewind();
- gl.glBufferSubData(GL.GL_ARRAY_BUFFER, offset, colorCoords.getBufferLimit() * 4, colorCoords
- .getBuffer());
+ gl.glBufferSubData(GL.GL_ARRAY_BUFFER, offset, colorCoords.getBufferLimit() * 4, colorCoords.getBuffer());
offset += colorCoords.getBufferLimit() * 4;
}
if (textureCoords != null) {
@@ -1236,8 +1231,7 @@ public class JoglRenderer extends AbstractRenderer {
}
if (vertexCoords != null) {
vertexCoords.getBuffer().rewind();
- gl.glBufferSubData(GL.GL_ARRAY_BUFFER, offset, vertexCoords.getBufferLimit() * 4, vertexCoords
- .getBuffer());
+ gl.glBufferSubData(GL.GL_ARRAY_BUFFER, offset, vertexCoords.getBufferLimit() * 4, vertexCoords.getBuffer());
}
interleaved.setNeedsRefresh(false);
@@ -1245,7 +1239,7 @@ public class JoglRenderer extends AbstractRenderer {
public void drawElementsVBO(final IndexBufferData<?> indices, final int[] indexLengths,
final IndexMode[] indexModes, final int primcount) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final RenderContext context = ContextManager.getCurrentContext();
final RendererRecord rendRecord = context.getRendererRecord();
@@ -1262,8 +1256,8 @@ 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);
+ gl.getGL2GL3().glDrawElementsInstanced(glIndexMode, indices.getBufferLimit(), type,
+ indices.getBuffer(), primcount);
}
if (Constants.stats) {
@@ -1306,7 +1300,7 @@ public class JoglRenderer extends AbstractRenderer {
public void drawArrays(final FloatBufferData vertexBuffer, final int[] indexLengths, final IndexMode[] indexModes,
final int primcount) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (indexLengths == null) {
final int glIndexMode = getGLIndexMode(indexModes[0]);
@@ -1331,7 +1325,7 @@ public class JoglRenderer extends AbstractRenderer {
if (primcount < 0) {
gl.glDrawArrays(glIndexMode, offset, count);
} else {
- gl.getGL2GL3().glDrawArraysInstanced(glIndexMode, offset, count, primcount);
+ gl.getGL2GL3().glDrawArraysInstanced(glIndexMode, offset, count, primcount);
}
if (Constants.stats) {
@@ -1348,7 +1342,7 @@ public class JoglRenderer extends AbstractRenderer {
}
private static int makeVBOId() {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final IntBuffer idBuff = BufferUtils.createIntBuffer(1);
gl.glGenBuffers(1, idBuff);
@@ -1457,7 +1451,7 @@ public class JoglRenderer extends AbstractRenderer {
}
private void loadMatrix(final FloatBuffer matrix) {
- GLU.getCurrentGL().getGL2().glLoadMatrixf(matrix);
+ GLContext.getCurrentGL().getGL2().glLoadMatrixf(matrix);
}
public FloatBuffer getModelViewMatrix(final FloatBuffer store) {
@@ -1473,16 +1467,16 @@ public class JoglRenderer extends AbstractRenderer {
if (result.remaining() < 16) {
result = BufferUtils.createFloatBuffer(16);
}
- GLU.getCurrentGL().glGetFloatv(matrixType, store);
+ GLContext.getCurrentGL().glGetFloatv(matrixType, store);
return result;
}
public void setViewport(final int x, final int y, final int width, final int height) {
- GLU.getCurrentGL().glViewport(x, y, width, height);
+ GLContext.getCurrentGL().glViewport(x, y, width, height);
}
public void setDepthRange(final double depthRangeNear, final double depthRangeFar) {
- GLU.getCurrentGL().glDepthRange(depthRangeNear, depthRangeFar);
+ GLContext.getCurrentGL().glDepthRange(depthRangeNear, depthRangeFar);
}
public void setDrawBuffer(final DrawBufferTarget target) {
@@ -1531,14 +1525,14 @@ public class JoglRenderer extends AbstractRenderer {
break;
}
- GLU.getCurrentGL().getGL2GL3().glDrawBuffer(buffer);
+ GLContext.getCurrentGL().getGL2GL3().glDrawBuffer(buffer);
record.setDrawBufferTarget(target);
}
}
public void setupLineParameters(final float lineWidth, final int stippleFactor, final short stipplePattern,
final boolean antialiased) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final LineRecord lineRecord = ContextManager.getCurrentContext().getLineRecord();
@@ -1588,7 +1582,7 @@ public class JoglRenderer extends AbstractRenderer {
final boolean useDistanceAttenuation, final FloatBuffer attenuationCoefficients, final float minPointSize,
final float maxPointSize) {
final RenderContext context = ContextManager.getCurrentContext();
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
// TODO: make this into a pointrecord call
gl.getGL2GL3().glPointSize(pointSize);
@@ -1683,7 +1677,7 @@ public class JoglRenderer extends AbstractRenderer {
* @return id of new display list
*/
public int startDisplayList() {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final int id = gl.getGL2().glGenLists(1);
@@ -1696,14 +1690,14 @@ 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() {
- GLU.getCurrentGL().getGL2().glEndList();
+ GLContext.getCurrentGL().getGL2().glEndList();
}
/**
* Draw the given display list.
*/
public void renderDisplayList(final int displayListID) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
gl.getGL2().glCallList(displayListID);
}
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglTextureRenderer.java b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglTextureRenderer.java
index 99719df..2c68ec1 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglTextureRenderer.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglTextureRenderer.java
@@ -18,7 +18,7 @@ import java.util.logging.Logger;
import javax.media.opengl.GL;
import javax.media.opengl.GL2ES2;
import javax.media.opengl.GL2GL3;
-import javax.media.opengl.glu.GLU;
+import javax.media.opengl.GLContext;
import com.ardor3d.framework.Scene;
import com.ardor3d.image.Texture;
@@ -75,7 +75,7 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer {
throw new IllegalArgumentException("Texture type not supported: " + tex.getType());
}
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final RenderContext context = ContextManager.getCurrentContext();
final TextureStateRecord record = (TextureStateRecord) context.getStateRecord(RenderState.StateType.Texture);
@@ -101,8 +101,7 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer {
final int pixelDataType = JoglTextureUtil.getGLPixelDataType(tex.getRenderedTexturePixelDataType());
if (tex.getType() == Type.TwoDimensional) {
- gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, internalFormat, _width, _height, 0, dataFormat, pixelDataType,
- null);
+ gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, internalFormat, _width, _height, 0, dataFormat, pixelDataType, null);
} else {
for (final Face face : Face.values()) {
gl.glTexImage2D(JoglTextureStateUtil.getGLCubeMapFace(face), 0, internalFormat, _width, _height, 0,
@@ -138,7 +137,7 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer {
private void render(final List<? extends Spatial> toDrawA, final Spatial toDrawB, final Scene toDrawC,
final List<Texture> texs, final int clear) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final int maxDrawBuffers = ContextManager.getCurrentContext().getCapabilities().getMaxFBOColorAttachments();
@@ -217,8 +216,8 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer {
final Texture tex = depths.removeFirst();
// Set up our depth texture
if (tex.getType() == Type.TwoDimensional) {
- gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT,
- GL.GL_TEXTURE_2D, tex.getTextureIdForContext(context.getGlContextRep()), 0);
+ gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, GL.GL_TEXTURE_2D,
+ tex.getTextureIdForContext(context.getGlContextRep()), 0);
} else if (tex.getType() == Type.CubeMap) {
gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT,
JoglTextureStateUtil.getGLCubeMapFace(((TextureCubeMap) tex).getCurrentRTTFace()),
@@ -229,8 +228,8 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer {
_usingDepthRB = false;
} else if (!_usingDepthRB) {
// setup our default depth render buffer if not already set
- gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT,
- GL.GL_RENDERBUFFER, _depthRBID);
+ gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, GL.GL_RENDERBUFFER,
+ _depthRBID);
_usingDepthRB = true;
}
@@ -266,20 +265,18 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer {
@Override
protected void setupForSingleTexDraw(final Texture tex) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final RenderContext context = ContextManager.getCurrentContext();
final int textureId = tex.getTextureIdForContext(context.getGlContextRep());
if (tex.getTextureStoreFormat().isDepthFormat()) {
// No color buffer
- gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_COLOR_ATTACHMENT0, GL.GL_RENDERBUFFER,
- 0);
+ gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_COLOR_ATTACHMENT0, GL.GL_RENDERBUFFER, 0);
// Setup depth texture into FBO
if (tex.getType() == Type.TwoDimensional) {
- gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, GL.GL_TEXTURE_2D,
- textureId, 0);
+ gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, GL.GL_TEXTURE_2D, textureId, 0);
} else if (tex.getType() == Type.CubeMap) {
gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT,
JoglTextureStateUtil.getGLCubeMapFace(((TextureCubeMap) tex).getCurrentRTTFace()), textureId, 0);
@@ -292,8 +289,7 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer {
} else {
// Set color texture into FBO
if (tex.getType() == Type.TwoDimensional) {
- gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER, GL.GL_COLOR_ATTACHMENT0, GL.GL_TEXTURE_2D,
- textureId, 0);
+ gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER, GL.GL_COLOR_ATTACHMENT0, GL.GL_TEXTURE_2D, textureId, 0);
} else if (tex.getType() == Type.CubeMap) {
gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER, GL.GL_COLOR_ATTACHMENT0,
JoglTextureStateUtil.getGLCubeMapFace(((TextureCubeMap) tex).getCurrentRTTFace()), textureId, 0);
@@ -302,8 +298,7 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer {
}
// setup depth RB
- gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, GL.GL_RENDERBUFFER,
- _depthRBID);
+ gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, GL.GL_RENDERBUFFER, _depthRBID);
setDrawBuffer(GL.GL_COLOR_ATTACHMENT0);
setReadBuffer(GL.GL_COLOR_ATTACHMENT0);
@@ -314,19 +309,19 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer {
}
private void setReadBuffer(final int attachVal) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
gl.getGL2GL3().glReadBuffer(attachVal);
}
private void setDrawBuffer(final int attachVal) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
gl.getGL2GL3().glDrawBuffer(attachVal);
}
private void setDrawBuffers(final int maxEntry) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (maxEntry <= 1) {
setDrawBuffer(maxEntry != 0 ? GL.GL_COLOR_ATTACHMENT0 : GL.GL_NONE);
@@ -340,7 +335,7 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer {
@Override
protected void takedownForSingleTexDraw(final Texture tex) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
// automatically generate mipmaps for our texture.
if (tex.getMinificationFilter().usesMipMapLevels()) {
@@ -351,19 +346,19 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer {
@Override
protected void setMSFBO() {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
gl.glBindFramebuffer(GL2GL3.GL_DRAW_FRAMEBUFFER, _msfboID);
}
@Override
protected void blitMSFBO() {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
gl.glBindFramebuffer(GL2GL3.GL_READ_FRAMEBUFFER, _msfboID);
gl.glBindFramebuffer(GL2GL3.GL_DRAW_FRAMEBUFFER, _fboID);
- gl.getGL2GL3().glBlitFramebuffer(0, 0, _width, _height, 0, 0, _width, _height, GL.GL_COLOR_BUFFER_BIT
- | GL.GL_DEPTH_BUFFER_BIT, GL.GL_NEAREST);
+ gl.getGL2GL3().glBlitFramebuffer(0, 0, _width, _height, 0, 0, _width, _height,
+ GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT, GL.GL_NEAREST);
gl.glBindFramebuffer(GL2GL3.GL_READ_FRAMEBUFFER, 0);
gl.glBindFramebuffer(GL2GL3.GL_DRAW_FRAMEBUFFER, 0);
@@ -377,7 +372,7 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer {
* an id to use for log messages, particularly if there are any issues.
*/
public static void checkFBOComplete(final int fboID) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final int status = gl.glCheckFramebufferStatus(GL.GL_FRAMEBUFFER);
switch (status) {
@@ -414,7 +409,7 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer {
public void copyToTexture(final Texture tex, final int x, final int y, final int width, final int height,
final int xoffset, final int yoffset) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
JoglTextureStateUtil.doTextureBind(tex, 0, true);
@@ -430,7 +425,7 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer {
@Override
protected void clearBuffers(final int clear) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
gl.glDisable(GL.GL_SCISSOR_TEST);
_parentRenderer.clearBuffers(clear);
@@ -438,7 +433,7 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer {
@Override
protected void activate() {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
// Lazy init
if (_fboID == 0) {
@@ -488,7 +483,8 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer {
// set up renderbuffer properties
gl.glBindRenderbuffer(GL.GL_RENDERBUFFER, _mscolorRBID);
- gl.getGL2GL3().glRenderbufferStorageMultisample(GL.GL_RENDERBUFFER, _samples, GL.GL_RGBA, _width, _height);
+ gl.getGL2GL3().glRenderbufferStorageMultisample(GL.GL_RENDERBUFFER, _samples, GL.GL_RGBA, _width,
+ _height);
gl.glBindRenderbuffer(GL.GL_RENDERBUFFER, _msdepthRBID);
gl.getGL2GL3().glRenderbufferStorageMultisample(GL.GL_RENDERBUFFER, _samples, format, _width, _height);
@@ -496,10 +492,10 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer {
gl.glBindRenderbuffer(GL.GL_RENDERBUFFER, 0);
gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, _msfboID);
- gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_COLOR_ATTACHMENT0,
- GL.GL_RENDERBUFFER, _mscolorRBID);
- gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT,
- GL.GL_RENDERBUFFER, _msdepthRBID);
+ gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_COLOR_ATTACHMENT0, GL.GL_RENDERBUFFER,
+ _mscolorRBID);
+ gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, GL.GL_RENDERBUFFER,
+ _msdepthRBID);
// check for errors
checkFBOComplete(_msfboID);
@@ -536,7 +532,7 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer {
@Override
protected void deactivate() {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (_active == 1) {
final ReadOnlyColorRGBA bgColor = _parentRenderer.getBackgroundColor();
@@ -552,7 +548,7 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer {
}
public void cleanup() {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (_fboID != 0) {
final IntBuffer id = BufferUtils.createIntBuffer(1);
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 39f0221..bde9535 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
@@ -14,7 +14,7 @@ import javax.media.opengl.GL;
import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2ES2;
import javax.media.opengl.GL2GL3;
-import javax.media.opengl.glu.GLU;
+import javax.media.opengl.GLContext;
import com.ardor3d.math.type.ReadOnlyColorRGBA;
import com.ardor3d.renderer.ContextCapabilities;
@@ -37,7 +37,7 @@ public abstract class JoglBlendStateUtil {
final ContextCapabilities caps = context.getCapabilities();
context.setCurrentState(StateType.Blend, state);
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (state.isEnabled()) {
applyBlendEquations(gl, state.isBlendEnabled(), state, record, caps);
@@ -128,7 +128,8 @@ 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());
+ gl.getGL2GL3().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/JoglClipStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglClipStateUtil.java
index df673aa..a64cf95 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglClipStateUtil.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglClipStateUtil.java
@@ -12,7 +12,7 @@ package com.ardor3d.scene.state.jogl;
import javax.media.opengl.GL;
import javax.media.opengl.GL2ES1;
-import javax.media.opengl.glu.GLU;
+import javax.media.opengl.GLContext;
import com.ardor3d.renderer.ContextCapabilities;
import com.ardor3d.renderer.ContextManager;
@@ -50,7 +50,7 @@ public abstract class JoglClipStateUtil {
private static void enableClipPlane(final int planeIndex, final boolean enable, final ClipState state,
final ClipStateRecord record) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (enable) {
if (!record.isValid() || !record.planeEnabled[planeIndex]) {
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglColorMaskStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglColorMaskStateUtil.java
index a0316e0..ca685a8 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglColorMaskStateUtil.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglColorMaskStateUtil.java
@@ -11,7 +11,7 @@
package com.ardor3d.scene.state.jogl;
import javax.media.opengl.GL;
-import javax.media.opengl.glu.GLU;
+import javax.media.opengl.GLContext;
import com.ardor3d.renderer.ContextManager;
import com.ardor3d.renderer.RenderContext;
@@ -23,7 +23,7 @@ import com.ardor3d.renderer.state.record.ColorMaskStateRecord;
public abstract class JoglColorMaskStateUtil {
public static void apply(final JoglRenderer renderer, final ColorMaskState state) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
// ask for the current state record
final RenderContext context = ContextManager.getCurrentContext();
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglCullStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglCullStateUtil.java
index d93eb33..a2f3fd8 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglCullStateUtil.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglCullStateUtil.java
@@ -11,7 +11,7 @@
package com.ardor3d.scene.state.jogl;
import javax.media.opengl.GL;
-import javax.media.opengl.glu.GLU;
+import javax.media.opengl.GLContext;
import com.ardor3d.renderer.ContextManager;
import com.ardor3d.renderer.RenderContext;
@@ -62,7 +62,7 @@ public abstract class JoglCullStateUtil {
}
private static void setCullEnabled(final boolean enable, final CullState state, final CullStateRecord record) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (!record.isValid() || record.enabled != enable) {
if (enable) {
@@ -75,7 +75,7 @@ public abstract class JoglCullStateUtil {
}
private static void setCull(final int face, final CullState state, final CullStateRecord record) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (!record.isValid() || record.face != face) {
gl.glCullFace(face);
@@ -85,7 +85,7 @@ public abstract class JoglCullStateUtil {
private static void setGLPolygonWind(final PolygonWind windOrder, final CullState state,
final CullStateRecord record) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (!record.isValid() || record.windOrder != windOrder) {
switch (windOrder) {
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglFogStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglFogStateUtil.java
index 19b1b0f..a36649a 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglFogStateUtil.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglFogStateUtil.java
@@ -13,7 +13,7 @@ package com.ardor3d.scene.state.jogl;
import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import javax.media.opengl.GL2ES1;
-import javax.media.opengl.glu.GLU;
+import javax.media.opengl.GLContext;
import com.ardor3d.math.type.ReadOnlyColorRGBA;
import com.ardor3d.renderer.ContextCapabilities;
@@ -30,7 +30,7 @@ import com.ardor3d.renderer.state.record.FogStateRecord;
public abstract class JoglFogStateUtil {
public static void apply(final JoglRenderer renderer, final FogState state) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
// ask for the current state record
final RenderContext context = ContextManager.getCurrentContext();
@@ -78,7 +78,7 @@ public abstract class JoglFogStateUtil {
}
private static void enableFog(final boolean enable, final FogStateRecord record) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (record.isValid()) {
if (enable && !record.enabled) {
@@ -99,13 +99,13 @@ public abstract class JoglFogStateUtil {
}
private static void applyFogColor(final ReadOnlyColorRGBA color, final FogStateRecord record) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (!record.isValid() || !color.equals(record.fogColor)) {
record.fogColor.set(color);
record.colorBuff.clear();
- record.colorBuff.put(record.fogColor.getRed()).put(record.fogColor.getGreen()).put(
- record.fogColor.getBlue()).put(record.fogColor.getAlpha());
+ record.colorBuff.put(record.fogColor.getRed()).put(record.fogColor.getGreen())
+ .put(record.fogColor.getBlue()).put(record.fogColor.getAlpha());
record.colorBuff.flip();
gl.getGL2ES1().glFogfv(GL2ES1.GL_FOG_COLOR, record.colorBuff);
}
@@ -113,7 +113,7 @@ public abstract class JoglFogStateUtil {
private static void applyFogSource(final CoordinateSource source, final FogStateRecord record,
final ContextCapabilities caps) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (caps.isFogCoordinatesSupported()) {
if (!record.isValid() || !source.equals(record.source)) {
@@ -127,7 +127,7 @@ public abstract class JoglFogStateUtil {
}
private static void applyFogMode(final DensityFunction densityFunction, final FogStateRecord record) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
int glMode = 0;
switch (densityFunction) {
@@ -149,7 +149,7 @@ public abstract class JoglFogStateUtil {
}
private static void applyFogHint(final Quality quality, final FogStateRecord record) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
int glHint = 0;
switch (quality) {
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglFragmentProgramStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglFragmentProgramStateUtil.java
index 5b8d068..f71e4f5 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglFragmentProgramStateUtil.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglFragmentProgramStateUtil.java
@@ -16,7 +16,7 @@ import java.util.logging.Logger;
import javax.media.opengl.GL;
import javax.media.opengl.GL2;
-import javax.media.opengl.glu.GLU;
+import javax.media.opengl.GLContext;
import com.ardor3d.renderer.ContextCapabilities;
import com.ardor3d.renderer.ContextManager;
@@ -35,7 +35,7 @@ public final class JoglFragmentProgramStateUtil {
* message.
*/
private static void checkProgramError() {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (gl.glGetError() == GL.GL_INVALID_OPERATION) {
// retrieve the error position
@@ -48,7 +48,7 @@ public final class JoglFragmentProgramStateUtil {
}
private static int create(final ByteBuffer program) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final IntBuffer buf = BufferUtils.createIntBuffer(1);
@@ -58,8 +58,8 @@ public final class JoglFragmentProgramStateUtil {
final byte array[] = new byte[program.limit()];
program.rewind();
program.get(array);
- gl.getGL2().glProgramStringARB(GL2.GL_FRAGMENT_PROGRAM_ARB, GL2.GL_PROGRAM_FORMAT_ASCII_ARB, array.length, new String(
- array)); // TODO Check cost of using non-buffer
+ gl.getGL2().glProgramStringARB(GL2.GL_FRAGMENT_PROGRAM_ARB, GL2.GL_PROGRAM_FORMAT_ASCII_ARB, array.length,
+ new String(array)); // TODO Check cost of using non-buffer
checkProgramError();
@@ -67,7 +67,7 @@ public final class JoglFragmentProgramStateUtil {
}
public static void apply(final JoglRenderer renderer, final FragmentProgramState state) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final RenderContext context = ContextManager.getCurrentContext();
final ContextCapabilities caps = context.getCapabilities();
@@ -106,8 +106,8 @@ public final class JoglFragmentProgramStateUtil {
for (int i = 0; i < state._getParameters().length; i++) {
if (state._getParameters()[i] != null) {
gl.getGL2().glProgramLocalParameter4fARB(GL2.GL_FRAGMENT_PROGRAM_ARB, i,
- state._getParameters()[i][0], state._getParameters()[i][1], state
- ._getParameters()[i][2], state._getParameters()[i][3]);
+ state._getParameters()[i][0], state._getParameters()[i][1],
+ state._getParameters()[i][2], state._getParameters()[i][3]);
}
}
}
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglLightStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglLightStateUtil.java
index 3050d67..489fdd4 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglLightStateUtil.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglLightStateUtil.java
@@ -13,8 +13,8 @@ package com.ardor3d.scene.state.jogl;
import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import javax.media.opengl.GL2ES1;
+import javax.media.opengl.GLContext;
import javax.media.opengl.fixedfunc.GLLightingFunc;
-import javax.media.opengl.glu.GLU;
import com.ardor3d.light.DirectionalLight;
import com.ardor3d.light.Light;
@@ -163,7 +163,7 @@ public abstract class JoglLightStateUtil {
private static void setSingleLightEnabled(final boolean enable, final int index, final LightStateRecord record,
final LightRecord lr) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (!record.isValid() || lr.isEnabled() != enable) {
if (enable) {
@@ -177,7 +177,7 @@ public abstract class JoglLightStateUtil {
}
private static void setLightEnabled(final boolean enable, final LightStateRecord record) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (!record.isValid() || record.isEnabled() != enable) {
if (enable) {
@@ -190,7 +190,7 @@ public abstract class JoglLightStateUtil {
}
private static void setTwoSided(final boolean twoSided, final LightStateRecord record) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (!record.isValid() || record.isTwoSidedOn() != twoSided) {
if (twoSided) {
@@ -203,7 +203,7 @@ public abstract class JoglLightStateUtil {
}
private static void setLocalViewer(final boolean localViewer, final LightStateRecord record) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (!record.isValid() || record.isLocalViewer() != localViewer) {
if (localViewer) {
@@ -216,7 +216,7 @@ public abstract class JoglLightStateUtil {
}
private static void setSpecularControl(final boolean separateSpecularOn, final LightStateRecord record) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (!record.isValid() || record.isSeparateSpecular() != separateSpecularOn) {
if (separateSpecularOn) {
@@ -229,7 +229,7 @@ public abstract class JoglLightStateUtil {
}
private static void setModelAmbient(final LightStateRecord record, final ReadOnlyColorRGBA globalAmbient) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (!record.isValid() || !record.globalAmbient.equals(globalAmbient)) {
record.lightBuffer.clear();
@@ -245,7 +245,7 @@ public abstract class JoglLightStateUtil {
private static void setAmbient(final int index, final LightStateRecord record, final ReadOnlyColorRGBA ambient,
final LightRecord lr) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (!record.isValid() || !lr.ambient.equals(ambient)) {
record.lightBuffer.clear();
@@ -254,14 +254,17 @@ public abstract class JoglLightStateUtil {
record.lightBuffer.put(ambient.getBlue());
record.lightBuffer.put(ambient.getAlpha());
record.lightBuffer.flip();
- gl.getGL2().glLightfv(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_AMBIENT, record.lightBuffer); // TODO Check for float
+ gl.getGL2().glLightfv(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_AMBIENT, record.lightBuffer); // TODO
+ // Check
+ // for
+ // float
lr.ambient.set(ambient);
}
}
private static void setDiffuse(final int index, final LightStateRecord record, final ReadOnlyColorRGBA diffuse,
final LightRecord lr) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (!record.isValid() || !lr.diffuse.equals(diffuse)) {
record.lightBuffer.clear();
@@ -270,14 +273,17 @@ public abstract class JoglLightStateUtil {
record.lightBuffer.put(diffuse.getBlue());
record.lightBuffer.put(diffuse.getAlpha());
record.lightBuffer.flip();
- gl.getGL2().glLightfv(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_DIFFUSE, record.lightBuffer); // TODO Check for float
+ gl.getGL2().glLightfv(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_DIFFUSE, record.lightBuffer); // TODO
+ // Check
+ // for
+ // float
lr.diffuse.set(diffuse);
}
}
private static void setSpecular(final int index, final LightStateRecord record, final ReadOnlyColorRGBA specular,
final LightRecord lr) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (!record.isValid() || !lr.specular.equals(specular)) {
record.lightBuffer.clear();
@@ -286,14 +292,17 @@ public abstract class JoglLightStateUtil {
record.lightBuffer.put(specular.getBlue());
record.lightBuffer.put(specular.getAlpha());
record.lightBuffer.flip();
- gl.getGL2().glLightfv(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_SPECULAR, record.lightBuffer); // TODO Check for float
+ gl.getGL2().glLightfv(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_SPECULAR, record.lightBuffer); // TODO
+ // Check
+ // for
+ // float
lr.specular.set(specular);
}
}
private static void setPosition(final int index, final LightStateRecord record, final float positionX,
final float positionY, final float positionZ, final float positionW, final LightRecord lr) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
// From OpenGL Docs:
// The light position is transformed by the contents of the current top
@@ -321,15 +330,15 @@ public abstract class JoglLightStateUtil {
gl.getGL2().glLightfv(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_POSITION, record.lightBuffer);
lr.position.set(positionX, positionY, positionZ, positionW);
- if (!Camera.getCurrentCamera().isFrameDirty()) {
- lr.modelViewMatrix.set(modelViewMatrix);
- }
+ if (!Camera.getCurrentCamera().isFrameDirty()) {
+ lr.modelViewMatrix.set(modelViewMatrix);
+ }
}
}
private static void setSpotDirection(final int index, final LightStateRecord record, final float directionX,
final float directionY, final float directionZ, final float value) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
// From OpenGL Docs:
// The light position is transformed by the contents of the current top
@@ -346,11 +355,14 @@ public abstract class JoglLightStateUtil {
record.lightBuffer.put(directionZ);
record.lightBuffer.put(value);
record.lightBuffer.flip();
- gl.getGL2().glLightfv(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_SPOT_DIRECTION, record.lightBuffer); // TODO Check for float
+ gl.getGL2().glLightfv(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_SPOT_DIRECTION, record.lightBuffer); // TODO
+ // Check
+ // for
+ // float
}
private static void setConstant(final int index, final float constant, final LightRecord lr, final boolean force) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (force || constant != lr.getConstant()) {
gl.getGL2().glLightf(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_CONSTANT_ATTENUATION, constant);
@@ -359,7 +371,7 @@ public abstract class JoglLightStateUtil {
}
private static void setLinear(final int index, final float linear, final LightRecord lr, final boolean force) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (force || linear != lr.getLinear()) {
gl.getGL2().glLightf(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_LINEAR_ATTENUATION, linear);
@@ -368,7 +380,7 @@ public abstract class JoglLightStateUtil {
}
private static void setQuadratic(final int index, final float quad, final LightRecord lr, final boolean force) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (force || quad != lr.getQuadratic()) {
gl.getGL2().glLightf(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_QUADRATIC_ATTENUATION, quad);
@@ -392,7 +404,7 @@ public abstract class JoglLightStateUtil {
private static void setSpotExponent(final int index, final LightStateRecord record, final float exponent,
final LightRecord lr) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (!record.isValid() || lr.getSpotExponent() != exponent) {
gl.getGL2().glLightf(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_SPOT_EXPONENT, exponent);
@@ -402,7 +414,7 @@ public abstract class JoglLightStateUtil {
private static void setSpotCutoff(final int index, final LightStateRecord record, final float cutoff,
final LightRecord lr) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (!record.isValid() || lr.getSpotCutoff() != cutoff) {
gl.getGL2().glLightf(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_SPOT_CUTOFF, cutoff);
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglMaterialStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglMaterialStateUtil.java
index 4a20143..9fc3490 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglMaterialStateUtil.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglMaterialStateUtil.java
@@ -11,8 +11,8 @@
package com.ardor3d.scene.state.jogl;
import javax.media.opengl.GL;
+import javax.media.opengl.GLContext;
import javax.media.opengl.fixedfunc.GLLightingFunc;
-import javax.media.opengl.glu.GLU;
import com.ardor3d.math.type.ReadOnlyColorRGBA;
import com.ardor3d.renderer.ContextManager;
@@ -63,7 +63,7 @@ public abstract class JoglMaterialStateUtil {
private static void applyColor(final ColorMaterial glMatColor, final ReadOnlyColorRGBA frontColor,
final ReadOnlyColorRGBA backColor, final MaterialStateRecord record) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final int glMat = getGLColorMaterial(glMatColor);
if (frontColor.equals(backColor)) {
@@ -120,11 +120,11 @@ public abstract class JoglMaterialStateUtil {
case Emissive:
return record.colorMaterial == ColorMaterial.Emissive;
case AmbientAndDiffuse:
- break;
+ break;
case None:
- break;
+ break;
default:
- break;
+ break;
}
return false;
}
@@ -132,7 +132,7 @@ public abstract class JoglMaterialStateUtil {
private static void applyColorMaterial(final ColorMaterial colorMaterial, final MaterialFace face,
final MaterialStateRecord record) {
if (!record.isValid() || face != record.colorMaterialFace || colorMaterial != record.colorMaterial) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (colorMaterial == ColorMaterial.None) {
gl.glDisable(GLLightingFunc.GL_COLOR_MATERIAL);
@@ -151,22 +151,25 @@ public abstract class JoglMaterialStateUtil {
private static void applyShininess(final float frontShininess, final float backShininess,
final MaterialStateRecord record) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (frontShininess == backShininess) {
// consolidate to one call
if (!record.isValid() || frontShininess != record.frontShininess || record.backShininess != backShininess) {
- gl.getGL2().glMaterialf(getGLMaterialFace(MaterialFace.FrontAndBack), GLLightingFunc.GL_SHININESS, frontShininess);
+ gl.getGL2().glMaterialf(getGLMaterialFace(MaterialFace.FrontAndBack), GLLightingFunc.GL_SHININESS,
+ frontShininess);
record.backShininess = record.frontShininess = frontShininess;
}
} else {
if (!record.isValid() || frontShininess != record.frontShininess) {
- gl.getGL2().glMaterialf(getGLMaterialFace(MaterialFace.Front), GLLightingFunc.GL_SHININESS, frontShininess);
+ gl.getGL2().glMaterialf(getGLMaterialFace(MaterialFace.Front), GLLightingFunc.GL_SHININESS,
+ frontShininess);
record.frontShininess = frontShininess;
}
if (!record.isValid() || backShininess != record.backShininess) {
- gl.getGL2().glMaterialf(getGLMaterialFace(MaterialFace.Back), GLLightingFunc.GL_SHININESS, backShininess);
+ gl.getGL2().glMaterialf(getGLMaterialFace(MaterialFace.Back), GLLightingFunc.GL_SHININESS,
+ backShininess);
record.backShininess = backShininess;
}
}
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglOffsetStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglOffsetStateUtil.java
index b2cd05a..ec48484 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglOffsetStateUtil.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglOffsetStateUtil.java
@@ -12,7 +12,7 @@ package com.ardor3d.scene.state.jogl;
import javax.media.opengl.GL;
import javax.media.opengl.GL2GL3;
-import javax.media.opengl.glu.GLU;
+import javax.media.opengl.GLContext;
import com.ardor3d.renderer.ContextManager;
import com.ardor3d.renderer.RenderContext;
@@ -55,7 +55,7 @@ public abstract class JoglOffsetStateUtil {
private static void setOffsetEnabled(final OffsetType type, final boolean typeEnabled,
final OffsetStateRecord record) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final int glType = getGLType(type);
if (!record.isValid() || typeEnabled != record.enabledOffsets.contains(type)) {
@@ -68,7 +68,7 @@ public abstract class JoglOffsetStateUtil {
}
private static void setOffset(final float factor, final float units, final OffsetStateRecord record) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (!record.isValid() || record.factor != factor || record.units != units) {
gl.glPolygonOffset(factor, units);
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglShaderObjectsStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglShaderObjectsStateUtil.java
index f254b29..bb5fa05 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglShaderObjectsStateUtil.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglShaderObjectsStateUtil.java
@@ -19,8 +19,7 @@ import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import javax.media.opengl.GL2ES2;
import javax.media.opengl.GL3;
-import javax.media.opengl.GL4;
-import javax.media.opengl.glu.GLU;
+import javax.media.opengl.GLContext;
import com.ardor3d.renderer.ContextCapabilities;
import com.ardor3d.renderer.ContextManager;
@@ -38,7 +37,7 @@ public abstract class JoglShaderObjectsStateUtil {
private static final Logger logger = Logger.getLogger(JoglShaderObjectsStateUtil.class.getName());
protected static void sendToGL(final GLSLShaderObjectsState state, final ContextCapabilities caps) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (state.getVertexShader() == null && state.getFragmentShader() == null) {
logger.warning("Could not find shader resources!" + "(both inputbuffers are null)");
@@ -122,7 +121,8 @@ public abstract class JoglShaderObjectsStateUtil {
// Compile the geometry shader
final IntBuffer compiled = BufferUtils.createIntBuffer(1);
gl.getGL2().glCompileShaderARB(state._geometryShaderID);
- gl.getGL2().glGetObjectParameterivARB(state._geometryShaderID, GL2.GL_OBJECT_COMPILE_STATUS_ARB, compiled);
+ gl.getGL2().glGetObjectParameterivARB(state._geometryShaderID, GL2.GL_OBJECT_COMPILE_STATUS_ARB,
+ compiled);
checkProgramError(compiled, state._geometryShaderID, state._geometryShaderName);
// Attach the program
@@ -132,7 +132,7 @@ public abstract class JoglShaderObjectsStateUtil {
state._geometryShaderID = -1;
}
}
-
+
if (caps.isTessellationShadersSupported()) {
if (state.getTessellationControlShader() != null) {
if (state._tessellationControlShaderID != -1) {
@@ -145,19 +145,20 @@ public abstract class JoglShaderObjectsStateUtil {
final byte array[] = new byte[state.getTessellationControlShader().limit()];
state.getTessellationControlShader().rewind();
state.getTessellationControlShader().get(array);
- gl.getGL2().glShaderSourceARB(state._tessellationControlShaderID, 1, new String[] { new String(array) },
- new int[] { array.length }, 0);
+ gl.getGL2().glShaderSourceARB(state._tessellationControlShaderID, 1,
+ new String[] { new String(array) }, new int[] { array.length }, 0);
// Compile the tessellation control shader
final IntBuffer compiled = BufferUtils.createIntBuffer(1);
gl.getGL2().glCompileShaderARB(state._tessellationControlShaderID);
- gl.getGL2().glGetObjectParameterivARB(state._tessellationControlShaderID, GL2.GL_OBJECT_COMPILE_STATUS_ARB, compiled);
+ gl.getGL2().glGetObjectParameterivARB(state._tessellationControlShaderID,
+ GL2.GL_OBJECT_COMPILE_STATUS_ARB, compiled);
checkProgramError(compiled, state._tessellationControlShaderID, state._tessellationControlShaderName);
// Attach the program
gl.getGL2().glAttachObjectARB(state._programID, state._tessellationControlShaderID);
} else if (state._tessellationControlShaderID != -1) {
- removeTessControlShader(state);
+ removeTessControlShader(state);
state._tessellationControlShaderID = -1;
}
if (state.getTessellationEvaluationShader() != null) {
@@ -165,25 +166,27 @@ public abstract class JoglShaderObjectsStateUtil {
removeTessEvalShader(state);
}
- state._tessellationEvaluationShaderID = gl.getGL2().glCreateShaderObjectARB(GL4.GL_TESS_CONTROL_SHADER);
+ state._tessellationEvaluationShaderID = gl.getGL2().glCreateShaderObjectARB(GL3.GL_TESS_CONTROL_SHADER);
// Create the sources
final byte array[] = new byte[state.getTessellationEvaluationShader().limit()];
state.getTessellationEvaluationShader().rewind();
state.getTessellationEvaluationShader().get(array);
- gl.getGL2().glShaderSourceARB(state._tessellationEvaluationShaderID, 1, new String[] { new String(array) },
- new int[] { array.length }, 0);
+ gl.getGL2().glShaderSourceARB(state._tessellationEvaluationShaderID, 1,
+ new String[] { new String(array) }, new int[] { array.length }, 0);
// Compile the tessellation control shader
final IntBuffer compiled = BufferUtils.createIntBuffer(1);
gl.getGL2().glCompileShaderARB(state._tessellationEvaluationShaderID);
- gl.getGL2().glGetObjectParameterivARB(state._tessellationEvaluationShaderID, GL2.GL_OBJECT_COMPILE_STATUS_ARB, compiled);
- checkProgramError(compiled, state._tessellationEvaluationShaderID, state._tessellationEvaluationShaderName);
+ gl.getGL2().glGetObjectParameterivARB(state._tessellationEvaluationShaderID,
+ GL2.GL_OBJECT_COMPILE_STATUS_ARB, compiled);
+ checkProgramError(compiled, state._tessellationEvaluationShaderID,
+ state._tessellationEvaluationShaderName);
// Attach the program
gl.getGL2().glAttachObjectARB(state._programID, state._tessellationEvaluationShaderID);
} else if (state._tessellationEvaluationShaderID != -1) {
- removeTessEvalShader(state);
+ removeTessEvalShader(state);
state._tessellationEvaluationShaderID = -1;
}
}
@@ -195,7 +198,7 @@ public abstract class JoglShaderObjectsStateUtil {
}
private static void checkLinkError(final int programId) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final IntBuffer compiled = BufferUtils.createIntBuffer(1);
gl.getGL2().glGetObjectParameterivARB(programId, GL2ES2.GL_LINK_STATUS, compiled);
@@ -221,7 +224,7 @@ public abstract class JoglShaderObjectsStateUtil {
/** Removes the fragment shader */
private static void removeFragShader(final GLSLShaderObjectsState state) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (state._fragmentShaderID != -1) {
gl.getGL2().glDetachObjectARB(state._programID, state._fragmentShaderID);
@@ -231,7 +234,7 @@ public abstract class JoglShaderObjectsStateUtil {
/** Removes the vertex shader */
private static void removeVertShader(final GLSLShaderObjectsState state) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (state._vertexShaderID != -1) {
gl.getGL2().glDetachObjectARB(state._programID, state._vertexShaderID);
@@ -241,27 +244,27 @@ public abstract class JoglShaderObjectsStateUtil {
/** Removes the geometry shader */
private static void removeGeomShader(final GLSLShaderObjectsState state) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (state._geometryShaderID != -1) {
gl.getGL2().glDetachObjectARB(state._programID, state._geometryShaderID);
gl.getGL2().glDeleteObjectARB(state._geometryShaderID);
}
}
-
+
/** Removes the tessellation control shader */
private static void removeTessControlShader(final GLSLShaderObjectsState state) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (state._tessellationControlShaderID != -1) {
gl.getGL2().glDetachObjectARB(state._programID, state._tessellationControlShaderID);
gl.getGL2().glDeleteObjectARB(state._tessellationControlShaderID);
}
}
-
+
/** Removes the tessellation evaluation shader */
private static void removeTessEvalShader(final GLSLShaderObjectsState state) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (state._tessellationEvaluationShaderID != -1) {
gl.getGL2().glDetachObjectARB(state._programID, state._tessellationEvaluationShaderID);
@@ -278,7 +281,7 @@ public abstract class JoglShaderObjectsStateUtil {
* shader's id
*/
private static void checkProgramError(final IntBuffer compiled, final int id, final String shaderName) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (compiled.get(0) == GL.GL_FALSE) {
final IntBuffer iVal = BufferUtils.createIntBuffer(1);
@@ -298,13 +301,13 @@ public abstract class JoglShaderObjectsStateUtil {
logger.severe(out);
- final String nameString = shaderName.equals("") ? "" : " [ " + shaderName + " ]";
+ final String nameString = shaderName.equals("") ? "" : " [ " + shaderName + " ]";
throw new Ardor3dException("Error compiling GLSL shader " + nameString + ": " + out);
}
}
public static void apply(final JoglRenderer renderer, final GLSLShaderObjectsState state) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final RenderContext context = ContextManager.getCurrentContext();
final ContextCapabilities caps = context.getCapabilities();
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglShadingStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglShadingStateUtil.java
index ba3dea0..426befb 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglShadingStateUtil.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglShadingStateUtil.java
@@ -11,21 +11,21 @@
package com.ardor3d.scene.state.jogl;
import javax.media.opengl.GL;
+import javax.media.opengl.GLContext;
import javax.media.opengl.fixedfunc.GLLightingFunc;
-import javax.media.opengl.glu.GLU;
import com.ardor3d.renderer.ContextManager;
import com.ardor3d.renderer.RenderContext;
import com.ardor3d.renderer.jogl.JoglRenderer;
-import com.ardor3d.renderer.state.ShadingState;
import com.ardor3d.renderer.state.RenderState.StateType;
+import com.ardor3d.renderer.state.ShadingState;
import com.ardor3d.renderer.state.ShadingState.ShadingMode;
import com.ardor3d.renderer.state.record.ShadingStateRecord;
public abstract class JoglShadingStateUtil {
public static void apply(final JoglRenderer renderer, final ShadingState state) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
// ask for the current state record
final RenderContext context = ContextManager.getCurrentContext();
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglStencilStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglStencilStateUtil.java
index fd7204f..d624b60 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglStencilStateUtil.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglStencilStateUtil.java
@@ -12,14 +12,14 @@ package com.ardor3d.scene.state.jogl;
import javax.media.opengl.GL;
import javax.media.opengl.GL2;
-import javax.media.opengl.glu.GLU;
+import javax.media.opengl.GLContext;
import com.ardor3d.renderer.ContextCapabilities;
import com.ardor3d.renderer.ContextManager;
import com.ardor3d.renderer.RenderContext;
import com.ardor3d.renderer.jogl.JoglRenderer;
-import com.ardor3d.renderer.state.StencilState;
import com.ardor3d.renderer.state.RenderState.StateType;
+import com.ardor3d.renderer.state.StencilState;
import com.ardor3d.renderer.state.StencilState.StencilFunction;
import com.ardor3d.renderer.state.StencilState.StencilOperation;
import com.ardor3d.renderer.state.record.StencilStateRecord;
@@ -27,7 +27,7 @@ import com.ardor3d.renderer.state.record.StencilStateRecord;
public abstract class JoglStencilStateUtil {
public static void apply(final JoglRenderer renderer, final StencilState state) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
// ask for the current state record
final RenderContext context = ContextManager.getCurrentContext();
@@ -40,25 +40,26 @@ public abstract class JoglStencilStateUtil {
if (state.isUseTwoSided() && caps.isTwoSidedStencilSupported()) {
gl.getGL2().glActiveStencilFaceEXT(GL.GL_BACK);
applyMask(state.getStencilWriteMaskBack(), record, 2);
- applyFunc(getGLStencilFunction(state.getStencilFunctionBack()), state.getStencilReferenceBack(), state
- .getStencilFuncMaskBack(), record, 2);
- applyOp(getGLStencilOp(state.getStencilOpFailBack(), caps), getGLStencilOp(state
- .getStencilOpZFailBack(), caps), getGLStencilOp(state.getStencilOpZPassBack(), caps), record, 2);
+ applyFunc(getGLStencilFunction(state.getStencilFunctionBack()), state.getStencilReferenceBack(),
+ state.getStencilFuncMaskBack(), record, 2);
+ applyOp(getGLStencilOp(state.getStencilOpFailBack(), caps),
+ getGLStencilOp(state.getStencilOpZFailBack(), caps),
+ getGLStencilOp(state.getStencilOpZPassBack(), caps), record, 2);
gl.getGL2().glActiveStencilFaceEXT(GL.GL_FRONT);
applyMask(state.getStencilWriteMaskFront(), record, 1);
applyFunc(getGLStencilFunction(state.getStencilFunctionFront()), state.getStencilReferenceFront(),
state.getStencilFuncMaskFront(), record, 1);
- applyOp(getGLStencilOp(state.getStencilOpFailFront(), caps), getGLStencilOp(state
- .getStencilOpZFailFront(), caps), getGLStencilOp(state.getStencilOpZPassFront(), caps), record,
- 1);
+ applyOp(getGLStencilOp(state.getStencilOpFailFront(), caps),
+ getGLStencilOp(state.getStencilOpZFailFront(), caps),
+ getGLStencilOp(state.getStencilOpZPassFront(), caps), record, 1);
} else {
applyMask(state.getStencilWriteMaskFront(), record, 0);
applyFunc(getGLStencilFunction(state.getStencilFunctionFront()), state.getStencilReferenceFront(),
state.getStencilFuncMaskFront(), record, 0);
- applyOp(getGLStencilOp(state.getStencilOpFailFront(), caps), getGLStencilOp(state
- .getStencilOpZFailFront(), caps), getGLStencilOp(state.getStencilOpZPassFront(), caps), record,
- 0);
+ applyOp(getGLStencilOp(state.getStencilOpFailFront(), caps),
+ getGLStencilOp(state.getStencilOpZFailFront(), caps),
+ getGLStencilOp(state.getStencilOpZPassFront(), caps), record, 0);
}
}
@@ -119,7 +120,7 @@ public abstract class JoglStencilStateUtil {
private static void setEnabled(final boolean enable, final boolean twoSided, final StencilStateRecord record,
final ContextCapabilities caps) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (record.isValid()) {
if (enable && !record.enabled) {
@@ -141,7 +142,7 @@ public abstract class JoglStencilStateUtil {
private static void setTwoSidedEnabled(final boolean enable, final StencilStateRecord record,
final ContextCapabilities caps) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (caps.isTwoSidedStencilSupported()) {
if (record.isValid()) {
@@ -162,7 +163,7 @@ public abstract class JoglStencilStateUtil {
}
private static void applyMask(final int writeMask, final StencilStateRecord record, final int face) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
// if (!record.isValid() || writeMask != record.writeMask[face]) {
gl.glStencilMask(writeMask);
@@ -172,7 +173,7 @@ public abstract class JoglStencilStateUtil {
private static void applyFunc(final int glfunc, final int stencilRef, final int funcMask,
final StencilStateRecord record, final int face) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
// if (!record.isValid() || glfunc != record.func[face] || stencilRef != record.ref[face]
// || funcMask != record.funcMask[face]) {
@@ -185,7 +186,7 @@ public abstract class JoglStencilStateUtil {
private static void applyOp(final int fail, final int zfail, final int zpass, final StencilStateRecord record,
final int face) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
// if (!record.isValid() || fail != record.fail[face] || zfail != record.zfail[face]
// || zpass != record.zpass[face]) {
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 e98ced2..0cb091c 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
@@ -20,6 +20,7 @@ import javax.media.opengl.GL2;
import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2ES2;
import javax.media.opengl.GL2GL3;
+import javax.media.opengl.GLContext;
import javax.media.opengl.GLException;
import javax.media.opengl.fixedfunc.GLMatrixFunc;
import javax.media.opengl.glu.GLU;
@@ -27,10 +28,6 @@ import javax.media.opengl.glu.gl2.GLUgl2;
import com.ardor3d.image.Image;
import com.ardor3d.image.Texture;
-import com.ardor3d.image.Texture1D;
-import com.ardor3d.image.Texture2D;
-import com.ardor3d.image.Texture3D;
-import com.ardor3d.image.TextureCubeMap;
import com.ardor3d.image.Texture.ApplyMode;
import com.ardor3d.image.Texture.CombinerFunctionAlpha;
import com.ardor3d.image.Texture.CombinerFunctionRGB;
@@ -40,6 +37,10 @@ import com.ardor3d.image.Texture.CombinerSource;
import com.ardor3d.image.Texture.Type;
import com.ardor3d.image.Texture.WrapAxis;
import com.ardor3d.image.Texture.WrapMode;
+import com.ardor3d.image.Texture1D;
+import com.ardor3d.image.Texture2D;
+import com.ardor3d.image.Texture3D;
+import com.ardor3d.image.TextureCubeMap;
import com.ardor3d.image.util.ImageUtils;
import com.ardor3d.math.MathUtils;
import com.ardor3d.math.type.ReadOnlyColorRGBA;
@@ -47,8 +48,8 @@ import com.ardor3d.renderer.ContextCapabilities;
import com.ardor3d.renderer.ContextManager;
import com.ardor3d.renderer.RenderContext;
import com.ardor3d.renderer.jogl.JoglRenderer;
-import com.ardor3d.renderer.state.TextureState;
import com.ardor3d.renderer.state.RenderState.StateType;
+import com.ardor3d.renderer.state.TextureState;
import com.ardor3d.renderer.state.record.RendererRecord;
import com.ardor3d.renderer.state.record.TextureRecord;
import com.ardor3d.renderer.state.record.TextureStateRecord;
@@ -70,7 +71,7 @@ public class JoglTextureStateUtil {
return;
}
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final RenderContext context = ContextManager.getCurrentContext();
if (context == null) {
logger.warning("RenderContext is null for texture: " + texture);
@@ -126,7 +127,7 @@ public class JoglTextureStateUtil {
// our texture type:
final Texture.Type type = texture.getType();
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final GLU glu = new GLUgl2();
// bind our texture id to this unit.
@@ -160,9 +161,8 @@ public class JoglTextureStateUtil {
+ image.getWidth() + " x " + image.getHeight());
}
if (actualWidth > maxSize || actualHeight > maxSize) {
- logger
- .warning("(card unsupported) Attempted to apply texture with size bigger than max texture size ["
- + maxSize + "]: " + image.getWidth() + " x " + image.getHeight());
+ logger.warning("(card unsupported) Attempted to apply texture with size bigger than max texture size ["
+ + maxSize + "]: " + image.getWidth() + " x " + image.getHeight());
}
int w = actualWidth;
@@ -211,19 +211,20 @@ public class JoglTextureStateUtil {
// ensure the buffer is ready for reading
image.getData(0).rewind();
// send top level to card
- gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, JoglTextureUtil.getGLInternalFormat(texture
- .getTextureStoreFormat()), image.getWidth(), image.getHeight(), hasBorder ? 1 : 0,
- JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), JoglTextureUtil
- .getGLPixelDataType(image.getDataType()), image.getData(0));
+ gl.glTexImage2D(GL.GL_TEXTURE_2D, 0,
+ JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), image.getWidth(),
+ image.getHeight(), hasBorder ? 1 : 0,
+ JoglTextureUtil.getGLPixelFormat(image.getDataFormat()),
+ JoglTextureUtil.getGLPixelDataType(image.getDataType()), image.getData(0));
break;
case OneDimensional:
// ensure the buffer is ready for reading
image.getData(0).rewind();
// send top level to card
- gl.getGL2GL3().glTexImage1D(GL2GL3.GL_TEXTURE_1D, 0, JoglTextureUtil.getGLInternalFormat(texture
- .getTextureStoreFormat()), image.getWidth(), hasBorder ? 1 : 0, JoglTextureUtil
- .getGLPixelFormat(image.getDataFormat()), JoglTextureUtil.getGLPixelDataType(image
- .getDataType()), image.getData(0));
+ gl.getGL2GL3().glTexImage1D(GL2GL3.GL_TEXTURE_1D, 0,
+ JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), image.getWidth(),
+ hasBorder ? 1 : 0, JoglTextureUtil.getGLPixelFormat(image.getDataFormat()),
+ JoglTextureUtil.getGLPixelDataType(image.getDataType()), image.getData(0));
break;
case ThreeDimensional:
if (caps.isTexture3DSupported()) {
@@ -250,9 +251,10 @@ public class JoglTextureStateUtil {
data.flip();
}
// send top level to card
- gl.getGL2GL3().glTexImage3D(GL2.GL_TEXTURE_3D, 0, JoglTextureUtil.getGLInternalFormat(texture
- .getTextureStoreFormat()), image.getWidth(), image.getHeight(), image.getDepth(),
- hasBorder ? 1 : 0, JoglTextureUtil.getGLPixelFormat(image.getDataFormat()),
+ gl.getGL2GL3().glTexImage3D(GL2ES2.GL_TEXTURE_3D, 0,
+ JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()),
+ image.getWidth(), image.getHeight(), image.getDepth(), hasBorder ? 1 : 0,
+ JoglTextureUtil.getGLPixelFormat(image.getDataFormat()),
JoglTextureUtil.getGLPixelDataType(image.getDataType()), data);
} else {
logger.warning("This card does not support Texture3D.");
@@ -266,19 +268,21 @@ public class JoglTextureStateUtil {
// ensure the buffer is ready for reading
image.getData(face.ordinal()).rewind();
// send top level to card
- gl.glTexImage2D(getGLCubeMapFace(face), 0, JoglTextureUtil.getGLInternalFormat(texture
- .getTextureStoreFormat()), image.getWidth(), image.getWidth(), hasBorder ? 1
- : 0, JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), JoglTextureUtil
- .getGLPixelDataType(image.getDataType()), image.getData(face.ordinal()));
+ gl.glTexImage2D(getGLCubeMapFace(face), 0,
+ JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()),
+ image.getWidth(), image.getWidth(), hasBorder ? 1 : 0,
+ JoglTextureUtil.getGLPixelFormat(image.getDataFormat()),
+ JoglTextureUtil.getGLPixelDataType(image.getDataType()),
+ image.getData(face.ordinal()));
}
} else {
logger.warning("This card does not support Cubemaps.");
}
break;
case Rectangle:
- break;
+ break;
default:
- break;
+ break;
}
} else if (texture.getMinificationFilter().usesMipMapLevels() && !image.hasMipmaps()
&& !texture.getTextureStoreFormat().isCompressed()) {
@@ -299,16 +303,18 @@ public class JoglTextureStateUtil {
image.getData(0).rewind();
if (caps.isAutomaticMipmapsSupported()) {
// send top level to card
- gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, JoglTextureUtil.getGLInternalFormat(texture
- .getTextureStoreFormat()), image.getWidth(), image.getHeight(), hasBorder ? 1 : 0,
- JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), JoglTextureUtil
- .getGLPixelDataType(image.getDataType()), image.getData(0));
+ gl.glTexImage2D(GL.GL_TEXTURE_2D, 0,
+ JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()),
+ image.getWidth(), image.getHeight(), hasBorder ? 1 : 0,
+ JoglTextureUtil.getGLPixelFormat(image.getDataFormat()),
+ JoglTextureUtil.getGLPixelDataType(image.getDataType()), image.getData(0));
} else {
// send to card
- glu.gluBuild2DMipmaps(GL.GL_TEXTURE_2D, JoglTextureUtil.getGLInternalFormat(texture
- .getTextureStoreFormat()), image.getWidth(), image.getHeight(), JoglTextureUtil
- .getGLPixelFormat(image.getDataFormat()), JoglTextureUtil.getGLPixelDataType(image
- .getDataType()), image.getData(0));
+ glu.gluBuild2DMipmaps(GL.GL_TEXTURE_2D,
+ JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()),
+ image.getWidth(), image.getHeight(),
+ JoglTextureUtil.getGLPixelFormat(image.getDataFormat()),
+ JoglTextureUtil.getGLPixelDataType(image.getDataType()), image.getData(0));
}
break;
case OneDimensional:
@@ -316,15 +322,15 @@ public class JoglTextureStateUtil {
image.getData(0).rewind();
if (caps.isAutomaticMipmapsSupported()) {
// send top level to card
- gl.getGL2GL3().glTexImage1D(GL2GL3.GL_TEXTURE_1D, 0, JoglTextureUtil.getGLInternalFormat(texture
- .getTextureStoreFormat()), image.getWidth(), hasBorder ? 1 : 0, JoglTextureUtil
- .getGLPixelFormat(image.getDataFormat()), JoglTextureUtil.getGLPixelDataType(image
- .getDataType()), image.getData(0));
+ gl.getGL2GL3().glTexImage1D(GL2GL3.GL_TEXTURE_1D, 0,
+ JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()),
+ image.getWidth(), hasBorder ? 1 : 0,
+ JoglTextureUtil.getGLPixelFormat(image.getDataFormat()),
+ JoglTextureUtil.getGLPixelDataType(image.getDataType()), image.getData(0));
} else {
// Note: JOGL's GLU class does not support
// gluBuild1DMipmaps.
- logger
- .warning("non-fbo 1d mipmap generation is not currently supported. Use DDS or a non-mipmap minification filter.");
+ logger.warning("non-fbo 1d mipmap generation is not currently supported. Use DDS or a non-mipmap minification filter.");
return;
}
break;
@@ -354,16 +360,15 @@ public class JoglTextureStateUtil {
data.flip();
}
// send top level to card
- gl.getGL2GL3().glTexImage3D(GL2ES2.GL_TEXTURE_3D, 0, JoglTextureUtil.getGLInternalFormat(texture
- .getTextureStoreFormat()), image.getWidth(), image.getHeight(), image
- .getDepth(), hasBorder ? 1 : 0, JoglTextureUtil.getGLPixelFormat(image
- .getDataFormat()), JoglTextureUtil.getGLPixelDataType(image.getDataType()),
- data);
+ gl.getGL2GL3().glTexImage3D(GL2ES2.GL_TEXTURE_3D, 0,
+ JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()),
+ image.getWidth(), image.getHeight(), image.getDepth(), hasBorder ? 1 : 0,
+ JoglTextureUtil.getGLPixelFormat(image.getDataFormat()),
+ JoglTextureUtil.getGLPixelDataType(image.getDataType()), data);
} else {
// Note: JOGL's GLU class does not support
// gluBuild3DMipmaps.
- logger
- .warning("non-fbo 3d mipmap generation is not currently supported. Use DDS or a non-mipmap minification filter.");
+ logger.warning("non-fbo 3d mipmap generation is not currently supported. Use DDS or a non-mipmap minification filter.");
return;
}
} else {
@@ -380,22 +385,24 @@ public class JoglTextureStateUtil {
// ensure the buffer is ready for reading
image.getData(face.ordinal()).rewind();
// send top level to card
- gl.glTexImage2D(getGLCubeMapFace(face), 0, JoglTextureUtil
- .getGLInternalFormat(texture.getTextureStoreFormat()), image.getWidth(),
- image.getWidth(), hasBorder ? 1 : 0, JoglTextureUtil.getGLPixelFormat(image
- .getDataFormat()), JoglTextureUtil.getGLPixelDataType(image
- .getDataType()), image.getData(face.ordinal()));
+ gl.glTexImage2D(getGLCubeMapFace(face), 0,
+ JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()),
+ image.getWidth(), image.getWidth(), hasBorder ? 1 : 0,
+ JoglTextureUtil.getGLPixelFormat(image.getDataFormat()),
+ JoglTextureUtil.getGLPixelDataType(image.getDataType()),
+ image.getData(face.ordinal()));
}
} else {
for (final TextureCubeMap.Face face : TextureCubeMap.Face.values()) {
// ensure the buffer is ready for reading
image.getData(face.ordinal()).rewind();
// send to card
- glu.gluBuild2DMipmaps(getGLCubeMapFace(face), JoglTextureUtil
- .getGLInternalFormat(texture.getTextureStoreFormat()), image.getWidth(),
- image.getWidth(), JoglTextureUtil.getGLPixelFormat(image.getDataFormat()),
- JoglTextureUtil.getGLPixelDataType(image.getDataType()), image.getData(face
- .ordinal()));
+ glu.gluBuild2DMipmaps(getGLCubeMapFace(face),
+ JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()),
+ image.getWidth(), image.getWidth(),
+ JoglTextureUtil.getGLPixelFormat(image.getDataFormat()),
+ JoglTextureUtil.getGLPixelDataType(image.getDataType()),
+ image.getData(face.ordinal()));
}
}
} else {
@@ -404,9 +411,9 @@ public class JoglTextureStateUtil {
}
break;
case Rectangle:
- break;
+ break;
default:
- break;
+ break;
}
if (texture.getTextureMaxLevel() >= 0) {
@@ -432,7 +439,7 @@ public class JoglTextureStateUtil {
}
// set max mip level
- gl.glTexParameteri(getGLCubeMapFace(face), GL2.GL_TEXTURE_MAX_LEVEL, max - 1);
+ gl.glTexParameteri(getGLCubeMapFace(face), GL2GL3.GL_TEXTURE_MAX_LEVEL, max - 1);
for (int m = 0; m < max; m++) {
final int width = Math.max(1, image.getWidth() >> m);
@@ -442,13 +449,14 @@ public class JoglTextureStateUtil {
data.limit(pos + mipSizes[m]);
if (texture.getTextureStoreFormat().isCompressed()) {
- gl.glCompressedTexImage2D(getGLCubeMapFace(face), m, JoglTextureUtil
- .getGLInternalFormat(texture.getTextureStoreFormat()), width, height,
- hasBorder ? 1 : 0, mipSizes[m], data);
+ gl.glCompressedTexImage2D(getGLCubeMapFace(face), m,
+ JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()),
+ width, height, hasBorder ? 1 : 0, mipSizes[m], data);
} else {
- gl.glTexImage2D(getGLCubeMapFace(face), m, JoglTextureUtil
- .getGLInternalFormat(texture.getTextureStoreFormat()), width, height,
- hasBorder ? 1 : 0, JoglTextureUtil.getGLPixelFormat(image.getDataFormat()),
+ gl.glTexImage2D(getGLCubeMapFace(face), m,
+ JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()),
+ width, height, hasBorder ? 1 : 0,
+ JoglTextureUtil.getGLPixelFormat(image.getDataFormat()),
JoglTextureUtil.getGLPixelDataType(image.getDataType()), data);
}
pos += mipSizes[m];
@@ -480,12 +488,12 @@ public class JoglTextureStateUtil {
case OneDimensional:
gl.glTexParameteri(GL2GL3.GL_TEXTURE_1D, GL2GL3.GL_TEXTURE_MAX_LEVEL, max - 1);
break;
- case CubeMap:
- break;
- case Rectangle:
- break;
- default:
- break;
+ case CubeMap:
+ break;
+ case Rectangle:
+ break;
+ default:
+ break;
}
if (type == Type.ThreeDimensional) {
@@ -527,48 +535,51 @@ public class JoglTextureStateUtil {
switch (type) {
case TwoDimensional:
if (texture.getTextureStoreFormat().isCompressed()) {
- gl.glCompressedTexImage2D(GL.GL_TEXTURE_2D, m, JoglTextureUtil
- .getGLInternalFormat(texture.getTextureStoreFormat()), width, height,
- hasBorder ? 1 : 0, mipSizes[m], data);
+ gl.glCompressedTexImage2D(GL.GL_TEXTURE_2D, m,
+ JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()),
+ width, height, hasBorder ? 1 : 0, mipSizes[m], data);
} else {
- gl.glTexImage2D(GL.GL_TEXTURE_2D, m, JoglTextureUtil.getGLInternalFormat(texture
- .getTextureStoreFormat()), width, height, hasBorder ? 1 : 0,
- JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), JoglTextureUtil
- .getGLPixelDataType(image.getDataType()), data);
+ gl.glTexImage2D(GL.GL_TEXTURE_2D, m,
+ JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()),
+ width, height, hasBorder ? 1 : 0,
+ JoglTextureUtil.getGLPixelFormat(image.getDataFormat()),
+ JoglTextureUtil.getGLPixelDataType(image.getDataType()), data);
}
break;
case OneDimensional:
if (texture.getTextureStoreFormat().isCompressed()) {
- gl.getGL2GL3().glCompressedTexImage1D(GL2GL3.GL_TEXTURE_1D, m, JoglTextureUtil
- .getGLInternalFormat(texture.getTextureStoreFormat()), width, hasBorder ? 1
- : 0, mipSizes[m], data);
+ gl.getGL2GL3().glCompressedTexImage1D(GL2GL3.GL_TEXTURE_1D, m,
+ JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()),
+ width, hasBorder ? 1 : 0, mipSizes[m], data);
} else {
- gl.getGL2GL3().glTexImage1D(GL2GL3.GL_TEXTURE_1D, m, JoglTextureUtil.getGLInternalFormat(texture
- .getTextureStoreFormat()), width, hasBorder ? 1 : 0, JoglTextureUtil
- .getGLPixelFormat(image.getDataFormat()), JoglTextureUtil
- .getGLPixelDataType(image.getDataType()), data);
+ gl.getGL2GL3().glTexImage1D(GL2GL3.GL_TEXTURE_1D, m,
+ JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()),
+ width, hasBorder ? 1 : 0,
+ JoglTextureUtil.getGLPixelFormat(image.getDataFormat()),
+ JoglTextureUtil.getGLPixelDataType(image.getDataType()), data);
}
break;
case ThreeDimensional:
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, JoglTextureUtil
- .getGLInternalFormat(texture.getTextureStoreFormat()), width, height,
- depth, hasBorder ? 1 : 0, mipSizes[m], data);
+ gl.getGL2GL3().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, JoglTextureUtil.getGLInternalFormat(texture
- .getTextureStoreFormat()), width, height, depth, hasBorder ? 1 : 0,
- JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), JoglTextureUtil
- .getGLPixelDataType(image.getDataType()), data);
+ gl.getGL2GL3().glTexImage3D(GL2ES2.GL_TEXTURE_3D, m,
+ JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()),
+ width, height, depth, hasBorder ? 1 : 0,
+ JoglTextureUtil.getGLPixelFormat(image.getDataFormat()),
+ JoglTextureUtil.getGLPixelDataType(image.getDataType()), data);
}
break;
case CubeMap:
- break;
+ break;
case Rectangle:
- break;
+ break;
default:
- break;
+ break;
}
pos += mipSizes[m];
@@ -582,7 +593,7 @@ public class JoglTextureStateUtil {
}
public static void apply(final JoglRenderer renderer, final TextureState state) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
// ask for the current state record
final RenderContext context = ContextManager.getCurrentContext();
@@ -769,7 +780,7 @@ public class JoglTextureStateUtil {
private static void disableTexturing(final TextureUnitRecord unitRecord, final TextureStateRecord record,
final int unit, final Type exceptedType, final ContextCapabilities caps) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (exceptedType != Type.TwoDimensional) {
if (!unitRecord.isValid() || unitRecord.enabled[Type.TwoDimensional.ordinal()]) {
@@ -811,7 +822,7 @@ public class JoglTextureStateUtil {
private static void disableTexturing(final TextureUnitRecord unitRecord, final TextureStateRecord record,
final int unit, final ContextCapabilities caps) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (!unitRecord.isValid() || unitRecord.enabled[Type.TwoDimensional.ordinal()]) {
// Check we are in the right unit
@@ -849,7 +860,7 @@ public class JoglTextureStateUtil {
public static void applyCombineFactors(final Texture texture, final TextureUnitRecord unitRecord, final int unit,
final TextureStateRecord record, final ContextCapabilities caps) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
// check that this is a valid fixed function unit. glTexEnv is only
// supported for unit < GL_MAX_TEXTURE_UNITS
@@ -877,7 +888,8 @@ public class JoglTextureStateUtil {
checkAndSetUnit(unit, record, caps);
checked = true;
}
- gl.getGL2ES1().glTexEnvf(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_RGB_SCALE, texture.getCombineScaleRGB().floatValue());
+ gl.getGL2ES1().glTexEnvf(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_RGB_SCALE,
+ texture.getCombineScaleRGB().floatValue());
unitRecord.envRGBScale = texture.getCombineScaleRGB();
} // Then Alpha Combine scale
if (!unitRecord.isValid() || unitRecord.envAlphaScale != texture.getCombineScaleAlpha()) {
@@ -885,7 +897,8 @@ public class JoglTextureStateUtil {
checkAndSetUnit(unit, record, caps);
checked = true;
}
- gl.getGL2ES1().glTexEnvf(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_ALPHA_SCALE, texture.getCombineScaleAlpha().floatValue());
+ gl.getGL2ES1().glTexEnvf(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_ALPHA_SCALE,
+ texture.getCombineScaleAlpha().floatValue());
unitRecord.envAlphaScale = texture.getCombineScaleAlpha();
}
@@ -896,7 +909,8 @@ public class JoglTextureStateUtil {
checkAndSetUnit(unit, record, caps);
checked = true;
}
- gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_COMBINE_RGB, JoglTextureUtil.getGLCombineFuncRGB(rgbCombineFunc));
+ gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_COMBINE_RGB,
+ JoglTextureUtil.getGLCombineFuncRGB(rgbCombineFunc));
unitRecord.rgbCombineFunc = rgbCombineFunc;
}
@@ -906,7 +920,8 @@ public class JoglTextureStateUtil {
checkAndSetUnit(unit, record, caps);
checked = true;
}
- gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE0_RGB, JoglTextureUtil.getGLCombineSrc(combSrcRGB));
+ gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE0_RGB,
+ JoglTextureUtil.getGLCombineSrc(combSrcRGB));
unitRecord.combSrcRGB0 = combSrcRGB;
}
@@ -916,7 +931,8 @@ public class JoglTextureStateUtil {
checkAndSetUnit(unit, record, caps);
checked = true;
}
- gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND0_RGB, JoglTextureUtil.getGLCombineOpRGB(combOpRGB));
+ gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND0_RGB,
+ JoglTextureUtil.getGLCombineOpRGB(combOpRGB));
unitRecord.combOpRGB0 = combOpRGB;
}
@@ -929,7 +945,8 @@ public class JoglTextureStateUtil {
checkAndSetUnit(unit, record, caps);
checked = true;
}
- gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE1_RGB, JoglTextureUtil.getGLCombineSrc(combSrcRGB));
+ gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE1_RGB,
+ JoglTextureUtil.getGLCombineSrc(combSrcRGB));
unitRecord.combSrcRGB1 = combSrcRGB;
}
@@ -939,7 +956,8 @@ public class JoglTextureStateUtil {
checkAndSetUnit(unit, record, caps);
checked = true;
}
- gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND1_RGB, JoglTextureUtil.getGLCombineOpRGB(combOpRGB));
+ gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND1_RGB,
+ JoglTextureUtil.getGLCombineOpRGB(combOpRGB));
unitRecord.combOpRGB1 = combOpRGB;
}
@@ -952,7 +970,8 @@ public class JoglTextureStateUtil {
checkAndSetUnit(unit, record, caps);
checked = true;
}
- gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE2_RGB, JoglTextureUtil.getGLCombineSrc(combSrcRGB));
+ gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE2_RGB,
+ JoglTextureUtil.getGLCombineSrc(combSrcRGB));
unitRecord.combSrcRGB2 = combSrcRGB;
}
@@ -962,7 +981,8 @@ public class JoglTextureStateUtil {
checkAndSetUnit(unit, record, caps);
checked = true;
}
- gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND2_RGB, JoglTextureUtil.getGLCombineOpRGB(combOpRGB));
+ gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND2_RGB,
+ JoglTextureUtil.getGLCombineOpRGB(combOpRGB));
unitRecord.combOpRGB2 = combOpRGB;
}
@@ -976,8 +996,8 @@ public class JoglTextureStateUtil {
checkAndSetUnit(unit, record, caps);
checked = true;
}
- gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_COMBINE_ALPHA, JoglTextureUtil
- .getGLCombineFuncAlpha(alphaCombineFunc));
+ gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_COMBINE_ALPHA,
+ JoglTextureUtil.getGLCombineFuncAlpha(alphaCombineFunc));
unitRecord.alphaCombineFunc = alphaCombineFunc;
}
@@ -987,7 +1007,8 @@ public class JoglTextureStateUtil {
checkAndSetUnit(unit, record, caps);
checked = true;
}
- gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE0_ALPHA, JoglTextureUtil.getGLCombineSrc(combSrcAlpha));
+ gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE0_ALPHA,
+ JoglTextureUtil.getGLCombineSrc(combSrcAlpha));
unitRecord.combSrcAlpha0 = combSrcAlpha;
}
@@ -997,7 +1018,8 @@ public class JoglTextureStateUtil {
checkAndSetUnit(unit, record, caps);
checked = true;
}
- gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND0_ALPHA, JoglTextureUtil.getGLCombineOpAlpha(combOpAlpha));
+ gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND0_ALPHA,
+ JoglTextureUtil.getGLCombineOpAlpha(combOpAlpha));
unitRecord.combOpAlpha0 = combOpAlpha;
}
@@ -1010,7 +1032,8 @@ public class JoglTextureStateUtil {
checkAndSetUnit(unit, record, caps);
checked = true;
}
- gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE1_ALPHA, JoglTextureUtil.getGLCombineSrc(combSrcAlpha));
+ gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE1_ALPHA,
+ JoglTextureUtil.getGLCombineSrc(combSrcAlpha));
unitRecord.combSrcAlpha1 = combSrcAlpha;
}
@@ -1020,7 +1043,8 @@ public class JoglTextureStateUtil {
checkAndSetUnit(unit, record, caps);
checked = true;
}
- gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND1_ALPHA, JoglTextureUtil.getGLCombineOpAlpha(combOpAlpha));
+ gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND1_ALPHA,
+ JoglTextureUtil.getGLCombineOpAlpha(combOpAlpha));
unitRecord.combOpAlpha1 = combOpAlpha;
}
@@ -1033,7 +1057,8 @@ public class JoglTextureStateUtil {
checkAndSetUnit(unit, record, caps);
checked = true;
}
- gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE2_ALPHA, JoglTextureUtil.getGLCombineSrc(combSrcAlpha));
+ gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE2_ALPHA,
+ JoglTextureUtil.getGLCombineSrc(combSrcAlpha));
unitRecord.combSrcAlpha2 = combSrcAlpha;
}
@@ -1043,8 +1068,8 @@ public class JoglTextureStateUtil {
checkAndSetUnit(unit, record, caps);
checked = true;
}
- gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND2_ALPHA, JoglTextureUtil
- .getGLCombineOpAlpha(combOpAlpha));
+ gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND2_ALPHA,
+ JoglTextureUtil.getGLCombineOpAlpha(combOpAlpha));
unitRecord.combOpAlpha2 = combOpAlpha;
}
}
@@ -1053,25 +1078,26 @@ public class JoglTextureStateUtil {
public static void applyEnvMode(final ApplyMode mode, final TextureUnitRecord unitRecord, final int unit,
final TextureStateRecord record, final ContextCapabilities caps) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (!unitRecord.isValid() || unitRecord.envMode != mode) {
checkAndSetUnit(unit, record, caps);
- gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_TEXTURE_ENV_MODE, JoglTextureUtil.getGLEnvMode(mode));
+ gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_TEXTURE_ENV_MODE,
+ JoglTextureUtil.getGLEnvMode(mode));
unitRecord.envMode = mode;
}
}
public static void applyBlendColor(final Texture texture, final TextureUnitRecord unitRecord, final int unit,
final TextureStateRecord record, final ContextCapabilities caps) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final ReadOnlyColorRGBA texBlend = texture.getConstantColor();
if (!unitRecord.isValid() || !unitRecord.blendColor.equals(texBlend)) {
checkAndSetUnit(unit, record, caps);
TextureRecord.colorBuffer.clear();
- TextureRecord.colorBuffer.put(texBlend.getRed()).put(texBlend.getGreen()).put(texBlend.getBlue()).put(
- texBlend.getAlpha());
+ TextureRecord.colorBuffer.put(texBlend.getRed()).put(texBlend.getGreen()).put(texBlend.getBlue())
+ .put(texBlend.getAlpha());
TextureRecord.colorBuffer.rewind();
gl.getGL2ES1().glTexEnvfv(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_TEXTURE_ENV_COLOR, TextureRecord.colorBuffer);
unitRecord.blendColor.set(texBlend);
@@ -1080,7 +1106,7 @@ public class JoglTextureStateUtil {
public static void applyLodBias(final Texture texture, final TextureUnitRecord unitRecord, final int unit,
final TextureStateRecord record, final ContextCapabilities caps) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (caps.isTextureLodBiasSupported()) {
final float bias = texture.getLodBias() < caps.getMaxLodBias() ? texture.getLodBias() : caps
@@ -1095,13 +1121,13 @@ public class JoglTextureStateUtil {
public static void applyBorderColor(final Texture texture, final TextureRecord texRecord, final int unit,
final TextureStateRecord record, final ContextCapabilities caps) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final ReadOnlyColorRGBA texBorder = texture.getBorderColor();
if (!texRecord.isValid() || !texRecord.borderColor.equals(texBorder)) {
TextureRecord.colorBuffer.clear();
- TextureRecord.colorBuffer.put(texBorder.getRed()).put(texBorder.getGreen()).put(texBorder.getBlue()).put(
- texBorder.getAlpha());
+ TextureRecord.colorBuffer.put(texBorder.getRed()).put(texBorder.getGreen()).put(texBorder.getBlue())
+ .put(texBorder.getAlpha());
TextureRecord.colorBuffer.rewind();
gl.glTexParameterfv(getGLType(texture.getType()), GL2GL3.GL_TEXTURE_BORDER_COLOR, TextureRecord.colorBuffer);
texRecord.borderColor.set(texBorder);
@@ -1110,7 +1136,7 @@ public class JoglTextureStateUtil {
public static void applyTextureTransforms(final Texture texture, final int unit, final TextureStateRecord record,
final ContextCapabilities caps) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final boolean needsReset = !record.units[unit].identityMatrix;
@@ -1141,7 +1167,7 @@ public class JoglTextureStateUtil {
public static void applyTexCoordGeneration(final Texture texture, final TextureUnitRecord unitRecord,
final int unit, final TextureStateRecord record, final ContextCapabilities caps) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
switch (texture.getEnvironmentalMapMode()) {
case None:
@@ -1234,13 +1260,13 @@ public class JoglTextureStateUtil {
gl.getGL2ES1().glTexGeni(GL2.GL_S, GL2ES1.GL_TEXTURE_GEN_MODE, GL2.GL_OBJECT_LINEAR);
unitRecord.textureGenSMode = GL2.GL_OBJECT_LINEAR;
- gl.getGL2ES1().glTexGeni(GL2.GL_T, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_OBJECT_LINEAR);
+ gl.getGL2ES1().glTexGeni(GL2.GL_T, GL2ES1.GL_TEXTURE_GEN_MODE, GL2.GL_OBJECT_LINEAR);
unitRecord.textureGenTMode = GL2.GL_OBJECT_LINEAR;
- gl.getGL2ES1().glTexGeni(GL2.GL_R, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_OBJECT_LINEAR);
+ gl.getGL2ES1().glTexGeni(GL2.GL_R, GL2ES1.GL_TEXTURE_GEN_MODE, GL2.GL_OBJECT_LINEAR);
unitRecord.textureGenRMode = GL2.GL_OBJECT_LINEAR;
- gl.getGL2ES1().glTexGeni(GL2.GL_Q, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_OBJECT_LINEAR);
+ gl.getGL2ES1().glTexGeni(GL2.GL_Q, GL2ES1.GL_TEXTURE_GEN_MODE, GL2.GL_OBJECT_LINEAR);
unitRecord.textureGenQMode = GL2.GL_OBJECT_LINEAR;
}
@@ -1261,7 +1287,7 @@ public class JoglTextureStateUtil {
private static void setTextureGen(final TextureUnitRecord unitRecord, final int unit,
final TextureStateRecord record, final ContextCapabilities caps, final boolean genS, final boolean genT,
final boolean genR, final boolean genQ) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (!unitRecord.isValid()) {
checkAndSetUnit(unit, record, caps);
@@ -1329,7 +1355,7 @@ public class JoglTextureStateUtil {
// If we support multitexturing, specify the unit we are affecting.
public static void checkAndSetUnit(final int unit, final TextureStateRecord record, final ContextCapabilities caps) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
// No need to worry about valid record, since invalidate sets record's
// currentUnit to -1.
@@ -1354,7 +1380,7 @@ public class JoglTextureStateUtil {
*/
public static void applyShadow(final Texture texture, final TextureRecord texRecord, final int unit,
final TextureStateRecord record, final ContextCapabilities caps) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final Type type = texture.getType();
@@ -1398,7 +1424,7 @@ public class JoglTextureStateUtil {
*/
public static void applyFilter(final Texture texture, final TextureRecord texRecord, final int unit,
final TextureStateRecord record, final ContextCapabilities caps) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final Type type = texture.getType();
@@ -1441,7 +1467,7 @@ public class JoglTextureStateUtil {
*/
public static void applyWrap(final Texture3D texture, final TextureRecord texRecord, final int unit,
final TextureStateRecord record, final ContextCapabilities caps) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (!caps.isTexture3DSupported()) {
return;
@@ -1480,7 +1506,7 @@ public class JoglTextureStateUtil {
*/
public static void applyWrap(final Texture1D texture, final TextureRecord texRecord, final int unit,
final TextureStateRecord record, final ContextCapabilities caps) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final int wrapS = getGLWrap(texture.getWrap(WrapAxis.S), caps);
@@ -1524,7 +1550,7 @@ public class JoglTextureStateUtil {
*/
public static void applyWrap(final Texture2D texture, final TextureRecord texRecord, final int unit,
final TextureStateRecord record, final ContextCapabilities caps) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final int wrapS = getGLWrap(texture.getWrap(WrapAxis.S), caps);
final int wrapT = getGLWrap(texture.getWrap(WrapAxis.T), caps);
@@ -1553,7 +1579,7 @@ public class JoglTextureStateUtil {
*/
public static void applyWrap(final TextureCubeMap cubeMap, final TextureRecord texRecord, final int unit,
final TextureStateRecord record, final ContextCapabilities caps) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (!caps.isTextureCubeMapSupported()) {
return;
@@ -1581,7 +1607,7 @@ public class JoglTextureStateUtil {
}
public static void deleteTexture(final Texture texture) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
// ask for the current state record
final RenderContext context = ContextManager.getCurrentContext();
@@ -1603,7 +1629,7 @@ public class JoglTextureStateUtil {
}
public static void deleteTextureIds(final Collection<Integer> ids) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
// ask for the current state record
final RenderContext context = ContextManager.getCurrentContext();
@@ -1627,7 +1653,7 @@ public class JoglTextureStateUtil {
* Useful for external jogl based classes that need to safely set the current texture.
*/
public static void doTextureBind(final Texture texture, final int unit, final boolean invalidateState) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
// ask for the current state record
final RenderContext context = ContextManager.getCurrentContext();
@@ -1660,9 +1686,9 @@ public class JoglTextureStateUtil {
case CubeMap:
return GL.GL_TEXTURE_CUBE_MAP;
case Rectangle:
- break;
+ break;
default:
- break;
+ break;
}
throw new IllegalArgumentException("invalid texture type: " + type);
}
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglVertexProgramStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglVertexProgramStateUtil.java
index 50258b8..3cf3149 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglVertexProgramStateUtil.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglVertexProgramStateUtil.java
@@ -16,14 +16,14 @@ import java.util.logging.Logger;
import javax.media.opengl.GL;
import javax.media.opengl.GL2;
-import javax.media.opengl.glu.GLU;
+import javax.media.opengl.GLContext;
import com.ardor3d.renderer.ContextCapabilities;
import com.ardor3d.renderer.ContextManager;
import com.ardor3d.renderer.RenderContext;
import com.ardor3d.renderer.jogl.JoglRenderer;
-import com.ardor3d.renderer.state.VertexProgramState;
import com.ardor3d.renderer.state.RenderState.StateType;
+import com.ardor3d.renderer.state.VertexProgramState;
import com.ardor3d.renderer.state.record.VertexProgramStateRecord;
import com.ardor3d.util.geom.BufferUtils;
@@ -35,7 +35,7 @@ public abstract class JoglVertexProgramStateUtil {
* message.
*/
private static void checkProgramError() {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (gl.glGetError() == GL.GL_INVALID_OPERATION) {
// retrieve the error position
@@ -48,7 +48,7 @@ public abstract class JoglVertexProgramStateUtil {
}
private static int create(final ByteBuffer program) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final IntBuffer buf = BufferUtils.createIntBuffer(1);
@@ -58,9 +58,8 @@ public abstract class JoglVertexProgramStateUtil {
final byte array[] = new byte[program.limit()];
program.rewind();
program.get(array);
- gl.getGL2()
- .glProgramStringARB(GL2.GL_VERTEX_PROGRAM_ARB, GL2.GL_PROGRAM_FORMAT_ASCII_ARB, array.length, new String(
- array));
+ gl.getGL2().glProgramStringARB(GL2.GL_VERTEX_PROGRAM_ARB, GL2.GL_PROGRAM_FORMAT_ASCII_ARB, array.length,
+ new String(array));
checkProgramError();
@@ -68,7 +67,7 @@ public abstract class JoglVertexProgramStateUtil {
}
public static void apply(final JoglRenderer renderer, final VertexProgramState state) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final RenderContext context = ContextManager.getCurrentContext();
final ContextCapabilities caps = context.getCapabilities();
@@ -97,10 +96,11 @@ public abstract class JoglVertexProgramStateUtil {
// load environmental parameters...
for (int i = 0; i < VertexProgramState._getEnvParameters().length; i++) {
if (VertexProgramState._getEnvParameters()[i] != null) {
- gl.getGL2().glProgramEnvParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, i, VertexProgramState
- ._getEnvParameters()[i][0], VertexProgramState._getEnvParameters()[i][1],
- VertexProgramState._getEnvParameters()[i][2], VertexProgramState
- ._getEnvParameters()[i][3]);
+ gl.getGL2().glProgramEnvParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, i,
+ VertexProgramState._getEnvParameters()[i][0],
+ VertexProgramState._getEnvParameters()[i][1],
+ VertexProgramState._getEnvParameters()[i][2],
+ VertexProgramState._getEnvParameters()[i][3]);
}
}
@@ -110,8 +110,8 @@ public abstract class JoglVertexProgramStateUtil {
for (int i = 0; i < state._getParameters().length; i++) {
if (state._getParameters()[i] != null) {
gl.getGL2().glProgramLocalParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, i,
- state._getParameters()[i][0], state._getParameters()[i][1], state
- ._getParameters()[i][2], state._getParameters()[i][3]);
+ state._getParameters()[i][0], state._getParameters()[i][1],
+ state._getParameters()[i][2], state._getParameters()[i][3]);
}
}
}
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglWireframeStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglWireframeStateUtil.java
index bf8b026..7172fc0 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglWireframeStateUtil.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglWireframeStateUtil.java
@@ -12,13 +12,13 @@ package com.ardor3d.scene.state.jogl;
import javax.media.opengl.GL;
import javax.media.opengl.GL2GL3;
-import javax.media.opengl.glu.GLU;
+import javax.media.opengl.GLContext;
import com.ardor3d.renderer.ContextManager;
import com.ardor3d.renderer.RenderContext;
import com.ardor3d.renderer.jogl.JoglRenderer;
-import com.ardor3d.renderer.state.WireframeState;
import com.ardor3d.renderer.state.RenderState.StateType;
+import com.ardor3d.renderer.state.WireframeState;
import com.ardor3d.renderer.state.record.WireframeStateRecord;
public abstract class JoglWireframeStateUtil {
@@ -54,7 +54,7 @@ public abstract class JoglWireframeStateUtil {
}
private static void applyPolyMode(final int frontMode, final int backMode, final WireframeStateRecord record) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (record.isValid()) {
if (frontMode == backMode && (record.frontMode != frontMode || record.backMode != backMode)) {
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglZBufferStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglZBufferStateUtil.java
index b806b02..4763ced 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglZBufferStateUtil.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglZBufferStateUtil.java
@@ -11,6 +11,7 @@
package com.ardor3d.scene.state.jogl;
import javax.media.opengl.GL;
+import javax.media.opengl.GLContext;
import javax.media.opengl.glu.GLU;
import com.ardor3d.renderer.ContextManager;
@@ -67,7 +68,7 @@ public abstract class JoglZBufferStateUtil {
}
private static void enableDepthTest(final boolean enable, final ZBufferStateRecord record) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (enable && (!record.depthTest || !record.isValid())) {
gl.glEnable(GL.GL_DEPTH_TEST);
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 96927ae..006cdb8 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
@@ -13,9 +13,8 @@ package com.ardor3d.scene.state.jogl.shader;
import java.util.logging.Logger;
import javax.media.opengl.GL;
-import javax.media.opengl.GL2;
import javax.media.opengl.GL2ES2;
-import javax.media.opengl.glu.GLU;
+import javax.media.opengl.GLContext;
import com.ardor3d.renderer.ContextCapabilities;
import com.ardor3d.renderer.ContextManager;
@@ -104,10 +103,11 @@ public abstract class JoglShaderUtil {
* shader program context ID
*/
public static void updateUniformLocation(final ShaderVariable variable, final int programID) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (variable.variableID == -1) {
- variable.variableID = gl.getGL2GL3().glGetUniformLocation(programID, variable.name); // TODO Check variable.name
+ variable.variableID = gl.getGL2GL3().glGetUniformLocation(programID, variable.name); // TODO Check
+ // variable.name
if (variable.variableID == -1 && !variable.errorLogged) {
logger.severe("Shader uniform [" + variable.name + "] could not be located in shader");
@@ -117,45 +117,50 @@ public abstract class JoglShaderUtil {
}
private static void updateShaderUniform(final ShaderVariableInt shaderUniform) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
gl.getGL2GL3().glUniform1i(shaderUniform.variableID, shaderUniform.value1);
}
private static void updateShaderUniform(final ShaderVariableInt2 shaderUniform) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
gl.getGL2GL3().glUniform2i(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2);
}
private static void updateShaderUniform(final ShaderVariableInt3 shaderUniform) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
- gl.getGL2GL3().glUniform3i(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2, shaderUniform.value3);
+ gl.getGL2GL3().glUniform3i(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2,
+ shaderUniform.value3);
}
private static void updateShaderUniform(final ShaderVariableInt4 shaderUniform) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
- gl.getGL2GL3().glUniform4i(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2, shaderUniform.value3,
- shaderUniform.value4);
+ gl.getGL2GL3().glUniform4i(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2,
+ shaderUniform.value3, shaderUniform.value4);
}
private static void updateShaderUniform(final ShaderVariableIntArray shaderUniform) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
switch (shaderUniform.size) {
case 1:
- gl.getGL2GL3().glUniform1iv(shaderUniform.variableID, shaderUniform.value.remaining(), shaderUniform.value);
+ gl.getGL2GL3().glUniform1iv(shaderUniform.variableID, shaderUniform.value.remaining(),
+ shaderUniform.value);
break;
case 2:
- gl.getGL2GL3().glUniform2iv(shaderUniform.variableID, shaderUniform.value.remaining(), shaderUniform.value);
+ gl.getGL2GL3().glUniform2iv(shaderUniform.variableID, shaderUniform.value.remaining(),
+ shaderUniform.value);
break;
case 3:
- gl.getGL2GL3().glUniform3iv(shaderUniform.variableID, shaderUniform.value.remaining(), shaderUniform.value);
+ gl.getGL2GL3().glUniform3iv(shaderUniform.variableID, shaderUniform.value.remaining(),
+ shaderUniform.value);
break;
case 4:
- gl.getGL2GL3().glUniform4iv(shaderUniform.variableID, shaderUniform.value.remaining(), shaderUniform.value);
+ gl.getGL2GL3().glUniform4iv(shaderUniform.variableID, shaderUniform.value.remaining(),
+ shaderUniform.value);
break;
default:
throw new IllegalArgumentException("Wrong size: " + shaderUniform.size);
@@ -163,45 +168,50 @@ public abstract class JoglShaderUtil {
}
private static void updateShaderUniform(final ShaderVariableFloat shaderUniform) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
gl.getGL2GL3().glUniform1f(shaderUniform.variableID, shaderUniform.value1);
}
private static void updateShaderUniform(final ShaderVariableFloat2 shaderUniform) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
gl.getGL2GL3().glUniform2f(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2);
}
private static void updateShaderUniform(final ShaderVariableFloat3 shaderUniform) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
- gl.getGL2GL3().glUniform3f(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2, shaderUniform.value3);
+ gl.getGL2GL3().glUniform3f(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2,
+ shaderUniform.value3);
}
private static void updateShaderUniform(final ShaderVariableFloat4 shaderUniform) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
- gl.getGL2GL3().glUniform4f(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2, shaderUniform.value3,
- shaderUniform.value4);
+ gl.getGL2GL3().glUniform4f(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2,
+ shaderUniform.value3, shaderUniform.value4);
}
private static void updateShaderUniform(final ShaderVariableFloatArray shaderUniform) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
switch (shaderUniform.size) {
case 1:
- gl.getGL2GL3().glUniform1fv(shaderUniform.variableID, shaderUniform.value.remaining(), shaderUniform.value);
+ gl.getGL2GL3().glUniform1fv(shaderUniform.variableID, shaderUniform.value.remaining(),
+ shaderUniform.value);
break;
case 2:
- gl.getGL2GL3().glUniform2fv(shaderUniform.variableID, shaderUniform.value.remaining(), shaderUniform.value);
+ gl.getGL2GL3().glUniform2fv(shaderUniform.variableID, shaderUniform.value.remaining(),
+ shaderUniform.value);
break;
case 3:
- gl.getGL2GL3().glUniform3fv(shaderUniform.variableID, shaderUniform.value.remaining(), shaderUniform.value);
+ gl.getGL2GL3().glUniform3fv(shaderUniform.variableID, shaderUniform.value.remaining(),
+ shaderUniform.value);
break;
case 4:
- gl.getGL2GL3().glUniform4fv(shaderUniform.variableID, shaderUniform.value.remaining(), shaderUniform.value);
+ gl.getGL2GL3().glUniform4fv(shaderUniform.variableID, shaderUniform.value.remaining(),
+ shaderUniform.value);
break;
default:
throw new IllegalArgumentException("Wrong size: " + shaderUniform.size);
@@ -209,28 +219,31 @@ public abstract class JoglShaderUtil {
}
private static void updateShaderUniform(final ShaderVariableMatrix2 shaderUniform) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
shaderUniform.matrixBuffer.rewind();
- gl.getGL2GL3().glUniformMatrix2fv(shaderUniform.variableID, 1, shaderUniform.rowMajor, shaderUniform.matrixBuffer);
+ gl.getGL2GL3().glUniformMatrix2fv(shaderUniform.variableID, 1, shaderUniform.rowMajor,
+ shaderUniform.matrixBuffer);
}
private static void updateShaderUniform(final ShaderVariableMatrix3 shaderUniform) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
shaderUniform.matrixBuffer.rewind();
- gl.getGL2GL3().glUniformMatrix3fv(shaderUniform.variableID, 1, shaderUniform.rowMajor, shaderUniform.matrixBuffer);
+ gl.getGL2GL3().glUniformMatrix3fv(shaderUniform.variableID, 1, shaderUniform.rowMajor,
+ shaderUniform.matrixBuffer);
}
private static void updateShaderUniform(final ShaderVariableMatrix4 shaderUniform) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
shaderUniform.matrixBuffer.rewind();
- gl.getGL2GL3().glUniformMatrix4fv(shaderUniform.variableID, 1, shaderUniform.rowMajor, shaderUniform.matrixBuffer);
+ gl.getGL2GL3().glUniformMatrix4fv(shaderUniform.variableID, 1, shaderUniform.rowMajor,
+ shaderUniform.matrixBuffer);
}
private static void updateShaderUniform(final ShaderVariableMatrix4Array shaderUniform) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
shaderUniform.matrixBuffer.rewind();
// count == number of matrices we are sending, or iotw, limit / 16
@@ -247,10 +260,11 @@ public abstract class JoglShaderUtil {
* shader program context ID
*/
public static void updateAttributeLocation(final ShaderVariable variable, final int programID) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (variable.variableID == -1) {
- variable.variableID = gl.getGL2GL3().glGetAttribLocation(programID, variable.name); // TODO Check variable.name
+ variable.variableID = gl.getGL2GL3().glGetAttribLocation(programID, variable.name); // TODO Check
+ // variable.name
if (variable.variableID == -1 && !variable.errorLogged) {
logger.severe("Shader attribute [" + variable.name + "] could not be located in shader");
@@ -307,7 +321,7 @@ public abstract class JoglShaderUtil {
public static void useShaderProgram(final int id, final ShaderObjectsStateRecord record) {
if (record.shaderId != id) {
- GLU.getCurrentGL().getGL2().glUseProgramObjectARB(id);
+ GLContext.getCurrentGL().getGL2().glUseProgramObjectARB(id);
record.shaderId = id;
}
}
@@ -315,9 +329,9 @@ public abstract class JoglShaderUtil {
private static void enableVertexAttribute(final ShaderVariable var, final ShaderObjectsStateRecord record) {
if (!record.enabledAttributes.contains(var)) {
if (var.getSize() == 1) {
- GLU.getCurrentGL().getGL2GL3().glEnableVertexAttribArray(var.variableID);
+ GLContext.getCurrentGL().getGL2GL3().glEnableVertexAttribArray(var.variableID);
} else {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
for (int i = 0, max = var.getSize(); i < max; i++) {
gl.getGL2GL3().glEnableVertexAttribArray(var.variableID + i);
}
@@ -333,18 +347,24 @@ public abstract class JoglShaderUtil {
final RenderContext context = ContextManager.getCurrentContext();
final int vboId = JoglRenderer.setupVBO(variable.data, context);
JoglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId);
- GLU.getCurrentGL().getGL2GL3().glVertexAttribPointer(variable.variableID, variable.size, GL.GL_FLOAT,
- variable.normalized, variable.stride, 0);
+ GLContext
+ .getCurrentGL()
+ .getGL2GL3()
+ .glVertexAttribPointer(variable.variableID, variable.size, GL.GL_FLOAT, variable.normalized,
+ variable.stride, 0);
} else {
variable.data.getBuffer().rewind();
- GLU.getCurrentGL().getGL2GL3().glVertexAttribPointer(variable.variableID, variable.size, GL.GL_FLOAT,
- variable.normalized, variable.stride, variable.data.getBuffer());
+ GLContext
+ .getCurrentGL()
+ .getGL2GL3()
+ .glVertexAttribPointer(variable.variableID, variable.size, GL.GL_FLOAT, variable.normalized,
+ variable.stride, variable.data.getBuffer());
}
}
private static void updateShaderAttribute(final ShaderVariablePointerFloatMatrix variable,
final ShaderObjectsStateRecord record, final boolean useVBO) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final int size = variable.size;
final int length = variable.data.getBuffer().capacity() / size;
final RenderContext context = ContextManager.getCurrentContext();
@@ -355,12 +375,13 @@ 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, 0, pos);
+ gl.getGL2GL3().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, 0,
- variable.data.getBuffer());
+ gl.getGL2GL3().glVertexAttribPointer(variable.variableID + i, size, GL.GL_FLOAT, variable.normalized,
+ 0, variable.data.getBuffer());
}
}
}
@@ -372,13 +393,20 @@ public abstract class JoglShaderUtil {
final RenderContext context = ContextManager.getCurrentContext();
final int vboId = JoglRenderer.setupVBO(variable.data, context);
JoglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId);
- GLU.getCurrentGL().getGL2GL3().glVertexAttribPointer(variable.variableID, variable.size,
- variable.unsigned ? GL.GL_UNSIGNED_BYTE : GL.GL_BYTE, variable.normalized, variable.stride, 0);
+ GLContext
+ .getCurrentGL()
+ .getGL2GL3()
+ .glVertexAttribPointer(variable.variableID, variable.size,
+ variable.unsigned ? GL.GL_UNSIGNED_BYTE : GL.GL_BYTE, variable.normalized, variable.stride,
+ 0);
} else {
variable.data.getBuffer().rewind();
- GLU.getCurrentGL().getGL2GL3().glVertexAttribPointer(variable.variableID, variable.size,
- variable.unsigned ? GL.GL_UNSIGNED_BYTE : GL.GL_BYTE, variable.normalized, variable.stride,
- variable.data.getBuffer());
+ GLContext
+ .getCurrentGL()
+ .getGL2GL3()
+ .glVertexAttribPointer(variable.variableID, variable.size,
+ variable.unsigned ? GL.GL_UNSIGNED_BYTE : GL.GL_BYTE, variable.normalized, variable.stride,
+ variable.data.getBuffer());
}
}
@@ -389,13 +417,20 @@ public abstract class JoglShaderUtil {
final RenderContext context = ContextManager.getCurrentContext();
final int vboId = JoglRenderer.setupVBO(variable.data, context);
JoglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId);
- GLU.getCurrentGL().getGL2GL3().glVertexAttribPointer(variable.variableID, variable.size,
- variable.unsigned ? GL.GL_UNSIGNED_INT : GL2ES2.GL_INT, variable.normalized, variable.stride, 0);
+ GLContext
+ .getCurrentGL()
+ .getGL2GL3()
+ .glVertexAttribPointer(variable.variableID, variable.size,
+ variable.unsigned ? GL.GL_UNSIGNED_INT : GL2ES2.GL_INT, variable.normalized,
+ variable.stride, 0);
} else {
variable.data.getBuffer().rewind();
- GLU.getCurrentGL().getGL2GL3().glVertexAttribPointer(variable.variableID, variable.size,
- variable.unsigned ? GL.GL_UNSIGNED_INT : GL2ES2.GL_INT, variable.normalized, variable.stride,
- variable.data.getBuffer());
+ GLContext
+ .getCurrentGL()
+ .getGL2GL3()
+ .glVertexAttribPointer(variable.variableID, variable.size,
+ variable.unsigned ? GL.GL_UNSIGNED_INT : GL2ES2.GL_INT, variable.normalized,
+ variable.stride, variable.data.getBuffer());
}
}
@@ -406,13 +441,20 @@ public abstract class JoglShaderUtil {
final RenderContext context = ContextManager.getCurrentContext();
final int vboId = JoglRenderer.setupVBO(variable.data, context);
JoglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId);
- GLU.getCurrentGL().getGL2GL3().glVertexAttribPointer(variable.variableID, variable.size,
- variable.unsigned ? GL.GL_UNSIGNED_SHORT : GL.GL_SHORT, variable.normalized, variable.stride, 0);
+ GLContext
+ .getCurrentGL()
+ .getGL2GL3()
+ .glVertexAttribPointer(variable.variableID, variable.size,
+ variable.unsigned ? GL.GL_UNSIGNED_SHORT : GL.GL_SHORT, variable.normalized,
+ variable.stride, 0);
} else {
variable.data.getBuffer().rewind();
- GLU.getCurrentGL().getGL2GL3().glVertexAttribPointer(variable.variableID, variable.size,
- variable.unsigned ? GL.GL_UNSIGNED_SHORT : GL.GL_SHORT, variable.normalized, variable.stride,
- variable.data.getBuffer());
+ GLContext
+ .getCurrentGL()
+ .getGL2GL3()
+ .glVertexAttribPointer(variable.variableID, variable.size,
+ variable.unsigned ? GL.GL_UNSIGNED_SHORT : GL.GL_SHORT, variable.normalized,
+ variable.stride, variable.data.getBuffer());
}
}
}
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/util/JoglRendererUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/util/JoglRendererUtil.java
index 88f006e..4c87387 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/util/JoglRendererUtil.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/util/JoglRendererUtil.java
@@ -13,7 +13,7 @@ package com.ardor3d.scene.state.jogl.util;
import java.util.Stack;
import javax.media.opengl.GL;
-import javax.media.opengl.glu.GLU;
+import javax.media.opengl.GLContext;
import com.ardor3d.math.Rectangle2;
import com.ardor3d.math.type.ReadOnlyRectangle2;
@@ -22,7 +22,7 @@ import com.ardor3d.renderer.state.record.RendererRecord;
public abstract class JoglRendererUtil {
public static void switchMode(final RendererRecord rendRecord, final int mode) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (!rendRecord.isMatrixValid() || rendRecord.getMatrixMode() != mode) {
gl.getGL2().glMatrixMode(mode);
@@ -32,7 +32,7 @@ public abstract class JoglRendererUtil {
}
public static void setBoundVBO(final RendererRecord rendRecord, final int id) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (!rendRecord.isVboValid() || rendRecord.getCurrentVboId() != id) {
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, id);
@@ -42,7 +42,7 @@ public abstract class JoglRendererUtil {
}
public static void setBoundElementVBO(final RendererRecord rendRecord, final int id) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (!rendRecord.isElementVboValid() || rendRecord.getCurrentElementVboId() != id) {
gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, id);
@@ -52,7 +52,7 @@ public abstract class JoglRendererUtil {
}
public static void applyScissors(final RendererRecord rendRecord) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
final Stack<ReadOnlyRectangle2> clips = rendRecord.getScissorClips();
if (clips.size() > 0) {
@@ -93,7 +93,7 @@ public abstract class JoglRendererUtil {
}
public static void setClippingEnabled(final RendererRecord rendRecord, final boolean enabled) {
- final GL gl = GLU.getCurrentGL();
+ final GL gl = GLContext.getCurrentGL();
if (enabled && (!rendRecord.isClippingTestValid() || !rendRecord.isClippingTestEnabled())) {
gl.glEnable(GL.GL_SCISSOR_TEST);