summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/InternalBufferUtil.java.javame_cdc_fp58
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/InternalBufferUtil.java.javase40
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenDrawable.java2
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferDrawable.java2
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java2
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/x11/glx/X11ExternalGLXDrawable.java4
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java3
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java6
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java2
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/util/texture/spi/DDSImage.java.javame_cdc_fp3
-rw-r--r--src/jogl/classes/javax/media/opengl/GLDrawableFactory.java9
11 files changed, 96 insertions, 35 deletions
diff --git a/src/jogl/classes/com/sun/opengl/impl/InternalBufferUtil.java.javame_cdc_fp b/src/jogl/classes/com/sun/opengl/impl/InternalBufferUtil.java.javame_cdc_fp
index 2614e52d4..32c3cd70c 100644
--- a/src/jogl/classes/com/sun/opengl/impl/InternalBufferUtil.java.javame_cdc_fp
+++ b/src/jogl/classes/com/sun/opengl/impl/InternalBufferUtil.java.javame_cdc_fp
@@ -65,11 +65,69 @@ public class InternalBufferUtil {
return bb.asIntBuffer();
}
+ /** Allocates a new direct ShortBuffer with the specified number of
+ elements. The returned buffer will have its byte order set to
+ the host platform's native byte order. */
+ public static ShortBuffer newShortBuffer(int numElements) {
+ ByteBuffer bb = newByteBuffer(numElements * SIZEOF_SHORT);
+ return bb.asShortBuffer();
+ }
+
+ /** Allocates a new direct FloatBuffer with the specified number of
+ elements. The returned buffer will have its byte order set to
+ the host platform's native byte order. */
+ public static FloatBuffer newFloatBuffer(int numElements) {
+ ByteBuffer bb = newByteBuffer(numElements * SIZEOF_FLOAT);
+ return bb.asFloatBuffer();
+ }
+
//----------------------------------------------------------------------
// Copy routines (type-to-type)
//
/** Copies the <i>remaining</i> elements (as defined by
+ <code>limit() - position()</code>) in the passed FloatBuffer
+ into a newly-allocated direct ByteBuffer. The returned buffer
+ will have its byte order set to the host platform's native byte
+ order. The position of the newly-allocated buffer will be zero,
+ and the position of the passed buffer is unchanged (though its
+ mark is changed). */
+ public static ByteBuffer copyFloatBufferAsByteBuffer(FloatBuffer orig) {
+ ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_FLOAT);
+ dest.asFloatBuffer().put(orig);
+ dest.rewind();
+ return dest;
+ }
+
+ /** Copies the <i>remaining</i> elements (as defined by
+ <code>limit() - position()</code>) in the passed IntBuffer into
+ a newly-allocated direct ByteBuffer. The returned buffer will
+ have its byte order set to the host platform's native byte
+ order. The position of the newly-allocated buffer will be zero,
+ and the position of the passed buffer is unchanged (though its
+ mark is changed). */
+ public static ByteBuffer copyIntBufferAsByteBuffer(IntBuffer orig) {
+ ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_INT);
+ dest.asIntBuffer().put(orig);
+ dest.rewind();
+ return dest;
+ }
+
+ /** Copies the <i>remaining</i> elements (as defined by
+ <code>limit() - position()</code>) in the passed ShortBuffer
+ into a newly-allocated direct ByteBuffer. The returned buffer
+ will have its byte order set to the host platform's native byte
+ order. The position of the newly-allocated buffer will be zero,
+ and the position of the passed buffer is unchanged (though its
+ mark is changed). */
+ public static ByteBuffer copyShortBufferAsByteBuffer(ShortBuffer orig) {
+ ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_SHORT);
+ dest.asShortBuffer().put(orig);
+ dest.rewind();
+ return dest;
+ }
+
+ /** Copies the <i>remaining</i> elements (as defined by
<code>limit() - position()</code>) in the passed ByteBuffer into
a newly-allocated direct ByteBuffer. The returned buffer will
have its byte order set to the host platform's native byte
diff --git a/src/jogl/classes/com/sun/opengl/impl/InternalBufferUtil.java.javase b/src/jogl/classes/com/sun/opengl/impl/InternalBufferUtil.java.javase
index f9f443e13..59d44f04d 100644
--- a/src/jogl/classes/com/sun/opengl/impl/InternalBufferUtil.java.javase
+++ b/src/jogl/classes/com/sun/opengl/impl/InternalBufferUtil.java.javase
@@ -75,6 +75,14 @@ public class InternalBufferUtil {
return bb.asIntBuffer();
}
+ /** Allocates a new direct ShortBuffer with the specified number of
+ elements. The returned buffer will have its byte order set to
+ the host platform's native byte order. */
+ public static ShortBuffer newShortBuffer(int numElements) {
+ ByteBuffer bb = newByteBuffer(numElements * SIZEOF_SHORT);
+ return bb.asShortBuffer();
+ }
+
/** Allocates a new direct FloatBuffer with the specified number of
elements. The returned buffer will have its byte order set to
the host platform's native byte order. */
@@ -84,24 +92,6 @@ public class InternalBufferUtil {
}
//----------------------------------------------------------------------
- // Copy routines (type-to-type)
- //
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed ByteBuffer into
- a newly-allocated direct ByteBuffer. The returned buffer will
- have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ByteBuffer copyByteBuffer(ByteBuffer orig) {
- ByteBuffer dest = newByteBuffer(orig.remaining());
- dest.put(orig);
- dest.rewind();
- return dest;
- }
-
- //----------------------------------------------------------------------
// Copy routines (type-to-ByteBuffer)
//
@@ -147,6 +137,20 @@ public class InternalBufferUtil {
return dest;
}
+ /** Copies the <i>remaining</i> elements (as defined by
+ <code>limit() - position()</code>) in the passed ByteBuffer into
+ a newly-allocated direct ByteBuffer. The returned buffer will
+ have its byte order set to the host platform's native byte
+ order. The position of the newly-allocated buffer will be zero,
+ and the position of the passed buffer is unchanged (though its
+ mark is changed). */
+ public static ByteBuffer copyByteBuffer(ByteBuffer orig) {
+ ByteBuffer dest = newByteBuffer(orig.remaining());
+ dest.put(orig);
+ dest.rewind();
+ return dest;
+ }
+
//----------------------------------------------------------------------
// Conversion routines
//
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenDrawable.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenDrawable.java
index 73dcf526c..c7c2bcab2 100644
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenDrawable.java
+++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenDrawable.java
@@ -45,8 +45,6 @@ import javax.media.nativewindow.egl.*;
import com.sun.opengl.impl.*;
import com.sun.nativewindow.impl.NullWindow;
-import java.nio.LongBuffer;
-
public class EGLOnscreenDrawable extends EGLDrawable {
protected EGLOnscreenDrawable(EGLDrawableFactory factory, NativeWindow component) throws GLException {
super(factory, component);
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferDrawable.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferDrawable.java
index 0ab1838b2..bcf3294c1 100644
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferDrawable.java
+++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferDrawable.java
@@ -45,8 +45,6 @@ import javax.media.nativewindow.egl.*;
import com.sun.opengl.impl.*;
import com.sun.nativewindow.impl.NullWindow;
-import java.nio.LongBuffer;
-
public class EGLPbufferDrawable extends EGLDrawable {
private int width, height;
private int texFormat;
diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java
index d15ba3423..1c5c54b14 100644
--- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java
+++ b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java
@@ -275,7 +275,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl implements
}
protected Buffer getGammaRamp() {
- ShortBuffer rampData = ShortBuffer.allocate(3 * GAMMA_RAMP_LENGTH);
+ ShortBuffer rampData = ShortBuffer.wrap(new short[3 * GAMMA_RAMP_LENGTH]);
long screenDC = WGL.GetDC(0);
boolean res = WGL.GetDeviceGammaRamp(screenDC, rampData);
WGL.ReleaseDC(0, screenDC);
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11ExternalGLXDrawable.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11ExternalGLXDrawable.java
index 7f65c0d89..9a5e42382 100755
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11ExternalGLXDrawable.java
+++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11ExternalGLXDrawable.java
@@ -45,7 +45,7 @@ import com.sun.opengl.impl.*;
import com.sun.nativewindow.impl.NullWindow;
import com.sun.nativewindow.impl.x11.*;
-import java.nio.LongBuffer;
+import com.sun.gluegen.runtime.PointerBuffer;
public class X11ExternalGLXDrawable extends X11GLXDrawable {
private int fbConfigID;
@@ -193,7 +193,7 @@ public class X11ExternalGLXDrawable extends X11GLXDrawable {
};
float[] fattributes = new float[0];
int[] nelementsTmp = new int[1];
- LongBuffer fbConfigs = GLX.glXChooseFBConfigCopied(display, screen, iattributes, 0, nelementsTmp, 0);
+ PointerBuffer fbConfigs = GLX.glXChooseFBConfigCopied(display, screen, iattributes, 0, nelementsTmp, 0);
int nelements = nelementsTmp[0];
if (nelements <= 0) {
throw new GLException("context creation error: couldn't find a suitable frame buffer configuration");
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java
index 08e8b2b2f..de211af79 100644
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java
+++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java
@@ -49,7 +49,6 @@ import com.sun.opengl.impl.x11.glx.*;
import com.sun.nativewindow.impl.NullWindow;
import com.sun.nativewindow.impl.NWReflection;
import com.sun.nativewindow.impl.x11.*;
-import com.sun.nativewindow.impl.jawt.x11.*;
public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements DynamicLookupHelper {
public X11GLXDrawableFactory() {
@@ -229,7 +228,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna
protected Buffer getGammaRamp() {
int size = getGammaRampLength();
- ShortBuffer rampData = ShortBuffer.allocate(3 * size);
+ ShortBuffer rampData = ShortBuffer.wrap(new short[3 * size]);
rampData.position(0);
rampData.limit(size);
ShortBuffer redRampData = rampData.slice();
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java
index 9acf580c4..0fcb9b3ff 100644
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java
@@ -41,6 +41,8 @@ import javax.media.opengl.*;
import com.sun.opengl.impl.*;
import com.sun.opengl.impl.x11.glx.*;
+import com.sun.gluegen.runtime.PointerBuffer;
+
/** Subclass of GraphicsConfigurationFactory used when non-AWT tookits
are used on X11 platforms. Toolkits will likely need to delegate
to this one to change the accepted and returned types of the
@@ -89,7 +91,7 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
int[] attribs = X11GLXGraphicsConfiguration.GLCapabilities2AttribList(caps, true, isMultisampleAvailable, usePBuffer, 0, 0);
int[] count = { -1 };
- java.nio.LongBuffer fbcfgsL = GLX.glXChooseFBConfigCopied(display, screen, attribs, 0, count, 0);
+ PointerBuffer fbcfgsL = GLX.glXChooseFBConfigCopied(display, screen, attribs, 0, count, 0);
if (fbcfgsL == null || fbcfgsL.limit()<1) {
throw new Exception("Could not fetch FBConfig for "+caps);
}
@@ -166,7 +168,7 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
boolean usePBuffer) {
int recommendedIndex = -1;
GLCapabilities[] caps = null;
- java.nio.LongBuffer fbcfgsL = null;
+ PointerBuffer fbcfgsL = null;
int chosen=-1;
int retFBID=-1;
XVisualInfo retXVisualInfo = null;
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java
index 1aafe89c8..753e9d884 100644
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java
+++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java
@@ -46,8 +46,6 @@ import com.sun.opengl.impl.x11.glx.*;
import com.sun.nativewindow.impl.NullWindow;
import com.sun.nativewindow.impl.x11.*;
-import java.nio.LongBuffer;
-
public class X11PbufferGLXDrawable extends X11GLXDrawable {
protected X11PbufferGLXDrawable(GLDrawableFactory factory, AbstractGraphicsScreen screen,
GLCapabilities caps,
diff --git a/src/jogl/classes/com/sun/opengl/util/texture/spi/DDSImage.java.javame_cdc_fp b/src/jogl/classes/com/sun/opengl/util/texture/spi/DDSImage.java.javame_cdc_fp
index eadae84f8..ce3d97733 100755
--- a/src/jogl/classes/com/sun/opengl/util/texture/spi/DDSImage.java.javame_cdc_fp
+++ b/src/jogl/classes/com/sun/opengl/util/texture/spi/DDSImage.java.javame_cdc_fp
@@ -43,8 +43,7 @@ import java.io.*;
import java.nio.*;
import javax.media.opengl.*;
-import javax.media.opengl.util.*;
-import com.sun.opengl.impl.io.*;
+import com.sun.opengl.util.*;
import com.sun.opengl.util.texture.*;
/** A reader and writer for DirectDraw Surface (.dds) files, which are
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
index d95d6d492..cee721fa6 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
@@ -88,6 +88,8 @@ public abstract class GLDrawableFactory {
private static final GLDrawableFactory eglFactory;
private static final GLDrawableFactory nativeOSFactory;
private static final String nativeOSType;
+ static final String macosxFactoryClassNameCGL = "com.sun.opengl.impl.macosx.cgl.MacOSXCGLDrawableFactory";
+ static final String macosxFactoryClassNameAWTCGL = "com.sun.opengl.impl.macosx.cgl.awt.MacOSXAWTCGLDrawableFactory";
/**
* Instantiate singleton factories if available, EGLES1, EGLES2 and the OS native ones.
@@ -118,8 +120,11 @@ public abstract class GLDrawableFactory {
} else if ( nativeOSType.equals(NativeWindowFactory.TYPE_WINDOWS) ) {
factoryClassName = "com.sun.opengl.impl.windows.wgl.WindowsWGLDrawableFactory";
} else if ( nativeOSType.equals(NativeWindowFactory.TYPE_MACOSX) ) {
- // FIXME: remove this residual dependence on the AWT
- factoryClassName = "com.sun.opengl.impl.macosx.cgl.awt.MacOSXAWTCGLDrawableFactory";
+ if(NWReflection.isClassAvailable(macosxFactoryClassNameAWTCGL)) {
+ factoryClassName = macosxFactoryClassNameAWTCGL;
+ } else {
+ factoryClassName = macosxFactoryClassNameCGL;
+ }
} else {
throw new GLException("Unsupported NativeWindow type: "+nativeOSType);
}