diff options
Diffstat (limited to 'src')
15 files changed, 103 insertions, 33 deletions
diff --git a/src/classes/com/sun/opengl/impl/GLContextImpl.java b/src/classes/com/sun/opengl/impl/GLContextImpl.java index 014cc9cf5..5a4cd82fd 100644 --- a/src/classes/com/sun/opengl/impl/GLContextImpl.java +++ b/src/classes/com/sun/opengl/impl/GLContextImpl.java @@ -239,7 +239,7 @@ public abstract class GLContextImpl extends GLContext { } else if(GLProfile.isGLES1()) { clazzName="com.sun.opengl.impl.es2.GLES2"+suffix; } else { - throw new GLException("uncovered profile"); + throw new GLUnsupportedException("uncovered profile"); } return GLReflection.createInstance(clazzName, cstrArgTypes, cstrArgs); } catch (Exception e) { @@ -369,7 +369,7 @@ public abstract class GLContextImpl extends GLContext { use. Returns one of GLPbuffer.APPLE_FLOAT, GLPbuffer.ATI_FLOAT, or GLPbuffer.NV_FLOAT. */ public int getFloatingPointMode() throws GLException { - throw new GLException("Not supported on non-pbuffer contexts"); + throw new GLUnsupportedException("Not supported on non-pbuffer contexts"); } /** On some platforms the mismatch between OpenGL's coordinate diff --git a/src/classes/com/sun/opengl/impl/GLPbufferImpl.java b/src/classes/com/sun/opengl/impl/GLPbufferImpl.java index 1f48ae8a1..9589cc735 100644 --- a/src/classes/com/sun/opengl/impl/GLPbufferImpl.java +++ b/src/classes/com/sun/opengl/impl/GLPbufferImpl.java @@ -75,7 +75,7 @@ public class GLPbufferImpl implements GLPbuffer { public void setSize(int width, int height) { // FIXME - throw new GLException("Not yet implemented"); + throw new GLUnsupportedException("Not yet implemented"); } public NativeWindow getNativeWindow() { diff --git a/src/classes/com/sun/opengl/impl/GLReflection.java b/src/classes/com/sun/opengl/impl/GLReflection.java index 6898db82d..5e55aba31 100644 --- a/src/classes/com/sun/opengl/impl/GLReflection.java +++ b/src/classes/com/sun/opengl/impl/GLReflection.java @@ -48,12 +48,12 @@ public final class GLReflection { try { factoryClass = Class.forName(clazzName); if (factoryClass == null) { - throw new GLException(clazzName + " not available"); + throw new GLUnsupportedException(clazzName + " not available"); } try { factory = factoryClass.getDeclaredConstructor( cstrArgTypes ); } catch(NoSuchMethodException nsme) { - throw new GLException("Constructor: '" + clazzName + "("+cstrArgTypes+")' not found"); + throw new GLUnsupportedException("Constructor: '" + clazzName + "("+cstrArgTypes+")' not found"); } return factory; } catch (Exception e) { diff --git a/src/classes/com/sun/opengl/impl/egl/EGLContext.java b/src/classes/com/sun/opengl/impl/egl/EGLContext.java index 0e6d07a8e..3a23483cb 100755 --- a/src/classes/com/sun/opengl/impl/egl/EGLContext.java +++ b/src/classes/com/sun/opengl/impl/egl/EGLContext.java @@ -197,8 +197,8 @@ public class EGLContext extends GLContextImpl { return null; } - public void copy(GLContext source, int mask) throws GLException { - throw new GLException("Not yet implemented"); + public void copy(GLContext source, int mask) throws GLUnsupportedException { + throw new GLUnsupportedException("Not yet implemented"); } public void bindPbufferToTexture() { diff --git a/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java b/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java index 00f293ffb..9f6d6b789 100755 --- a/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java +++ b/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java @@ -123,7 +123,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { public GLDrawableImpl createOffscreenDrawable(GLCapabilities capabilities, GLCapabilitiesChooser chooser) { - throw new GLException("Not yet implemented"); + throw new GLUnsupportedException("Not yet implemented"); } public boolean canCreateGLPbuffer() { @@ -135,7 +135,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { final int initialWidth, final int initialHeight, final GLContext shareWith) { - throw new GLException("Pbuffer support not available on OpenGL ES"); + throw new GLUnsupportedException("Pbuffer support not available on OpenGL ES"); } public GLContext createExternalGLContext() { @@ -147,7 +147,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } public GLDrawable createExternalGLDrawable() { - throw new GLException("Not yet implemented"); + throw new GLUnsupportedException("Not yet implemented"); } public void loadGLULibrary() { @@ -347,6 +347,6 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { public GLContext createContextOnJava2DSurface(Object graphics, GLContext shareWith) throws GLException { - throw new GLException("Unimplemented on this platform"); + throw new GLUnsupportedException("Unimplemented on this platform"); } } diff --git a/src/classes/com/sun/opengl/impl/glu/tessellator/Render.java b/src/classes/com/sun/opengl/impl/glu/tessellator/Render.java index 999656b82..cd6e02255 100644 --- a/src/classes/com/sun/opengl/impl/glu/tessellator/Render.java +++ b/src/classes/com/sun/opengl/impl/glu/tessellator/Render.java @@ -297,7 +297,7 @@ class Render { int newState; int edgeState = -1; /* force edge state output for first vertex */ - tess.callBeginOrBeginData(GL2ES1.GL_TRIANGLES); + tess.callBeginOrBeginData(GL.GL_TRIANGLES); for (; f != null; f = f.trail) { /* Loop once for each edge (there will always be 3 edges) */ @@ -328,7 +328,7 @@ class Render { * edge "e". The fan *should* contain exactly "size" triangles * (otherwise we've goofed up somewhere). */ - tess.callBeginOrBeginData( GL2ES1.GL_TRIANGLE_FAN); + tess.callBeginOrBeginData( GL.GL_TRIANGLE_FAN); tess.callVertexOrVertexData( e.Org.data); tess.callVertexOrVertexData( e.Sym.Org.data); @@ -350,7 +350,7 @@ class Render { * edge "e". The strip *should* contain exactly "size" triangles * (otherwise we've goofed up somewhere). */ - tess.callBeginOrBeginData( GL2ES1.GL_TRIANGLE_STRIP); + tess.callBeginOrBeginData( GL.GL_TRIANGLE_STRIP); tess.callVertexOrVertexData( e.Org.data); tess.callVertexOrVertexData( e.Sym.Org.data); @@ -384,7 +384,7 @@ class Render { for (f = mesh.fHead.next; f != mesh.fHead; f = f.next) { if (f.inside) { - tess.callBeginOrBeginData( GL2ES1.GL_LINE_LOOP); + tess.callBeginOrBeginData( GL.GL_LINE_LOOP); e = f.anEdge; do { tess.callVertexOrVertexData( e.Org.data); @@ -536,9 +536,9 @@ class Render { return true; } - tess.callBeginOrBeginData( tess.boundaryOnly ? GL2ES1.GL_LINE_LOOP - : (tess.cacheCount > 3) ? GL2ES1.GL_TRIANGLE_FAN - : GL2ES1.GL_TRIANGLES); + tess.callBeginOrBeginData( tess.boundaryOnly ? GL.GL_LINE_LOOP + : (tess.cacheCount > 3) ? GL.GL_TRIANGLE_FAN + : GL.GL_TRIANGLES); tess.callVertexOrVertexData( v[0].data); if (sign > 0) { diff --git a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java index ff5fbbdff..8bf82b3d2 100644 --- a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java +++ b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java @@ -327,7 +327,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl public ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) { // FIXME: apparently the Apple extension doesn't require a custom memory allocator - throw new GLException("Not yet implemented"); + throw new GLUnsupportedException("Not yet implemented"); } public boolean isFunctionAvailable(String glFunctionName) diff --git a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java index c905ed48e..2880ee0ed 100644 --- a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java +++ b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java @@ -115,7 +115,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { public GLDrawable createExternalGLDrawable() { // FIXME - throw new GLException("Not yet implemented"); + throw new GLUnsupportedException("Not yet implemented"); } public void loadGLULibrary() { diff --git a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java index 7828e6a2c..9216e3e17 100644 --- a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java +++ b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java @@ -117,7 +117,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { // (undesirable) -- could maybe also do this with pbuffers /* if (!gl.isExtensionAvailable("GL_APPLE_float_pixels")) { - throw new GLException("Floating-point support (GL_APPLE_float_pixels) not available"); + throw new GLUnsupportedException("Floating-point support (GL_APPLE_float_pixels) not available"); } */ if(GLProfile.isGL2()) { diff --git a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java index 78a617f8e..a13aba0e4 100644 --- a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java +++ b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java @@ -129,7 +129,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { final int initialHeight, final GLContext shareWith) { if (!canCreateGLPbuffer()) { - throw new GLException("Pbuffer support not available with current graphics card"); + throw new GLUnsupportedException("Pbuffer support not available with current graphics card"); } final List returnList = new ArrayList(); final GLDrawableFactory factory = this; diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java b/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java index 3ba3f060f..d68f087b6 100644 --- a/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java +++ b/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java @@ -178,7 +178,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { final int initialHeight, final GLContext shareWith) { if (!canCreateGLPbuffer()) { - throw new GLException("Pbuffer support not available with current graphics card"); + throw new GLUnsupportedException("Pbuffer support not available with current graphics card"); } final List returnList = new ArrayList(); final GLDrawableFactory factory = this; @@ -340,7 +340,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { glXExtensions.indexOf("GLX_NV_float_buffer") < 0) { throw new GLException("Floating-point pbuffers on X11 currently require NVidia hardware"); } - res[idx++] = GLX.GLX_FLOAT_COMPONENTS_NV; + res[idx++] = GLXExt.GLX_FLOAT_COMPONENTS_NV; res[idx++] = GL.GL_TRUE; } } @@ -413,7 +413,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { caps.setNumSamples(ivalues[i]); break; - case GLX.GLX_FLOAT_COMPONENTS_NV: + case GLXExt.GLX_FLOAT_COMPONENTS_NV: caps.setPbufferFloatingPointBuffers(ivalues[i] != GL.GL_FALSE); break; diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXContext.java b/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXContext.java index 746b7bd26..377d92f98 100644 --- a/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXContext.java +++ b/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXContext.java @@ -54,12 +54,12 @@ public class X11PbufferGLXContext extends X11GLXContext { public void bindPbufferToTexture() { // FIXME: figure out how to implement this - throw new GLException("Not yet implemented"); + throw new GLUnsupportedException("Not yet implemented"); } public void releasePbufferFromTexture() { // FIXME: figure out how to implement this - throw new GLException("Not yet implemented"); + throw new GLUnsupportedException("Not yet implemented"); } diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java b/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java index 8caf2fa33..06aeba0b6 100644 --- a/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java +++ b/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java @@ -171,7 +171,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { // Pick innocent query values if multisampling or floating point buffers not available int sbAttrib = ((X11GLXDrawableFactory)getFactory()).isMultisampleAvailable() ? GLXExt.GLX_SAMPLE_BUFFERS: GLX.GLX_RED_SIZE; int samplesAttrib = ((X11GLXDrawableFactory)getFactory()).isMultisampleAvailable() ? GLXExt.GLX_SAMPLES: GLX.GLX_RED_SIZE; - int floatNV = getCapabilities().getPbufferFloatingPointBuffers() ? GLX.GLX_FLOAT_COMPONENTS_NV : GLX.GLX_RED_SIZE; + int floatNV = getCapabilities().getPbufferFloatingPointBuffers() ? GLXExt.GLX_FLOAT_COMPONENTS_NV : GLX.GLX_RED_SIZE; // Query the fbconfig to determine its GLCapabilities int[] iattribs = { diff --git a/src/classes/com/sun/opengl/util/texture/Texture.java b/src/classes/com/sun/opengl/util/texture/Texture.java index f0c36e398..ec3692196 100755 --- a/src/classes/com/sun/opengl/util/texture/Texture.java +++ b/src/classes/com/sun/opengl/util/texture/Texture.java @@ -519,11 +519,13 @@ public class Texture { } try { - // FIXME: need to get rid of this cast - GLUgl2 glu = (GLUgl2) GLU.createGLU(gl); - glu.gluBuild2DMipmaps(texTarget, data.getInternalFormat(), - data.getWidth(), data.getHeight(), - data.getPixelFormat(), data.getPixelType(), data.getBuffer()); + if(gl.isGL2()) { + // FIXME: need to get rid of this cast + GLUgl2 glu = (GLUgl2) GLU.createGLU(); + glu.gluBuild2DMipmaps(texTarget, data.getInternalFormat(), + data.getWidth(), data.getHeight(), + data.getPixelFormat(), data.getPixelType(), data.getBuffer()); + } } finally { gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, align[0]); // restore alignment } diff --git a/src/classes/javax/media/opengl/GLUnsupportedException.java b/src/classes/javax/media/opengl/GLUnsupportedException.java new file mode 100644 index 000000000..34a1c7340 --- /dev/null +++ b/src/classes/javax/media/opengl/GLUnsupportedException.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package javax.media.opengl; + +/** A generic exception for OpenGL errors used throughout the binding + as a substitute for {@link UnsupportedOperationException}. */ + +public class GLUnsupportedException extends UnsupportedOperationException { + /** Constructs a GLUnsupportedException object. */ + public GLUnsupportedException() { + super(); + } + + /** Constructs a GLUnsupportedException object with the specified detail + message. */ + public GLUnsupportedException(String message) { + super(message); + } + + /** Constructs a GLUnsupportedException object with the specified detail + message and root cause. */ + public GLUnsupportedException(String message, Throwable cause) { + super(message, cause); + } + + /** Constructs a GLUnsupportedException object with the specified root + cause. */ + public GLUnsupportedException(Throwable cause) { + super(cause); + } +} |