|
From: <sp...@us...> - 2010-04-22 23:21:55
|
Revision: 3334
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3334&view=rev
Author: spasi
Date: 2010-04-22 23:21:48 +0000 (Thu, 22 Apr 2010)
Log Message:
-----------
Fixed ByteOrder of @Return ByteBuffers.
Cleaned up Drawable interface and introduced a reusable base implementation.
Added support for disabling runtime function checks, buffer checks and state tracking. Activated with -Dorg.lwjgl.util.NoChecks=true
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java
trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java
trunk/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java
trunk/LWJGL/src/java/org/lwjgl/opengl/BaseReferences.java
trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
trunk/LWJGL/src/java/org/lwjgl/opengl/Drawable.java
trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengl/Pbuffer.java
trunk/LWJGL/src/java/org/lwjgl/opengl/SharedDrawable.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/multithread/BackgroundLoader.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_vertex_array_object.java
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/opengl/AbstractDrawable.java
trunk/LWJGL/src/java/org/lwjgl/opengl/DrawableLWJGL.java
Modified: trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2010-04-22 18:32:46 UTC (rev 3333)
+++ trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2010-04-22 23:21:48 UTC (rev 3334)
@@ -60,7 +60,7 @@
* Helper methods to ensure a function pointer is not-null (0)
*/
public static void checkFunctionAddress(long pointer) {
- if (pointer == 0) {
+ if (LWJGLUtil.CHECKS && pointer == 0) {
throw new IllegalStateException("Function is not supported");
}
}
@@ -69,20 +69,22 @@
* Helper methods to ensure a ByteBuffer is null-terminated
*/
public static void checkNullTerminated(ByteBuffer buf) {
- if (buf.get(buf.limit() - 1) != 0) {
+ if ( LWJGLUtil.CHECKS && buf.get(buf.limit() - 1) != 0) {
throw new IllegalArgumentException("Missing null termination");
}
}
public static void checkNullTerminated(ByteBuffer buf, int count) {
- int nullFound = 0;
- for ( int i = buf.position(); i < buf.limit(); i++ ) {
- if ( buf.get(i) == 0 )
- nullFound++;
+ if ( LWJGLUtil.CHECKS ) {
+ int nullFound = 0;
+ for ( int i = buf.position(); i < buf.limit(); i++ ) {
+ if ( buf.get(i) == 0 )
+ nullFound++;
+ }
+
+ if ( nullFound < count )
+ throw new IllegalArgumentException("Missing null termination");
}
-
- if ( nullFound < count )
- throw new IllegalArgumentException("Missing null termination");
}
/** Helper methods to ensure an IntBuffer is null-terminated */
@@ -93,7 +95,7 @@
}
public static void checkNotNull(Object o) {
- if (o == null)
+ if ( LWJGLUtil.CHECKS && o == null)
throw new IllegalArgumentException("Null argument");
}
@@ -101,37 +103,37 @@
* Helper methods to ensure a buffer is direct (and, implicitly, non-null).
*/
public static void checkDirect(ByteBuffer buf) {
- if (!buf.isDirect()) {
+ if ( LWJGLUtil.CHECKS && !buf.isDirect()) {
throw new IllegalArgumentException("ByteBuffer is not direct");
}
}
public static void checkDirect(ShortBuffer buf) {
- if (!buf.isDirect()) {
+ if ( LWJGLUtil.CHECKS && !buf.isDirect()) {
throw new IllegalArgumentException("ShortBuffer is not direct");
}
}
public static void checkDirect(IntBuffer buf) {
- if (!buf.isDirect()) {
+ if ( LWJGLUtil.CHECKS && !buf.isDirect()) {
throw new IllegalArgumentException("IntBuffer is not direct");
}
}
public static void checkDirect(LongBuffer buf) {
- if (!buf.isDirect()) {
+ if ( LWJGLUtil.CHECKS && !buf.isDirect()) {
throw new IllegalArgumentException("LongBuffer is not direct");
}
}
public static void checkDirect(FloatBuffer buf) {
- if (!buf.isDirect()) {
+ if ( LWJGLUtil.CHECKS && !buf.isDirect()) {
throw new IllegalArgumentException("FloatBuffer is not direct");
}
}
public static void checkDirect(DoubleBuffer buf) {
- if (!buf.isDirect()) {
+ if ( LWJGLUtil.CHECKS && !buf.isDirect()) {
throw new IllegalArgumentException("DoubleBuffer is not direct");
}
}
@@ -154,38 +156,50 @@
* @throws IllegalArgumentException
*/
public static void checkBufferSize(Buffer buf, int size) {
- if (buf.remaining() < size) {
+ if ( LWJGLUtil.CHECKS && buf.remaining() < size) {
throwBufferSizeException(buf, size);
}
}
public static void checkBuffer(ByteBuffer buf, int size) {
- checkBufferSize(buf, size);
- checkDirect(buf);
+ if ( LWJGLUtil.CHECKS ) {
+ checkBufferSize(buf, size);
+ checkDirect(buf);
+ }
}
public static void checkBuffer(ShortBuffer buf, int size) {
- checkBufferSize(buf, size);
- checkDirect(buf);
+ if ( LWJGLUtil.CHECKS ) {
+ checkBufferSize(buf, size);
+ checkDirect(buf);
+ }
}
public static void checkBuffer(IntBuffer buf, int size) {
- checkBufferSize(buf, size);
- checkDirect(buf);
+ if ( LWJGLUtil.CHECKS ) {
+ checkBufferSize(buf, size);
+ checkDirect(buf);
+ }
}
public static void checkBuffer(LongBuffer buf, int size) {
- checkBufferSize(buf, size);
- checkDirect(buf);
+ if ( LWJGLUtil.CHECKS ) {
+ checkBufferSize(buf, size);
+ checkDirect(buf);
+ }
}
public static void checkBuffer(FloatBuffer buf, int size) {
- checkBufferSize(buf, size);
- checkDirect(buf);
+ if ( LWJGLUtil.CHECKS ) {
+ checkBufferSize(buf, size);
+ checkDirect(buf);
+ }
}
public static void checkBuffer(DoubleBuffer buf, int size) {
- checkBufferSize(buf, size);
- checkDirect(buf);
+ if ( LWJGLUtil.CHECKS ) {
+ checkBufferSize(buf, size);
+ checkDirect(buf);
+ }
}
}
Modified: trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java 2010-04-22 18:32:46 UTC (rev 3333)
+++ trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java 2010-04-22 23:21:48 UTC (rev 3334)
@@ -266,7 +266,9 @@
/** Debug flag. */
public static final boolean DEBUG = getPrivilegedBoolean("org.lwjgl.util.Debug");
-
+
+ public static final boolean CHECKS = !getPrivilegedBoolean("org.lwjgl.util.NoChecks");
+
static {
LWJGLIcon16x16.flip();
LWJGLIcon32x32.flip();
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java 2010-04-22 18:32:46 UTC (rev 3333)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java 2010-04-22 23:21:48 UTC (rev 3334)
@@ -50,7 +50,7 @@
* $Id$
* @version $Revision$
*/
-public class AWTGLCanvas extends Canvas implements Drawable, ComponentListener, HierarchyListener {
+public class AWTGLCanvas extends Canvas implements DrawableLWJGL, ComponentListener, HierarchyListener {
private static final long serialVersionUID = 1L;
@@ -109,13 +109,12 @@
return context;
}
+ /** This method should only be called internally. */
public Context createSharedContext() throws LWJGLException {
- synchronized ( GlobalLock.lock ) {
- synchronized ( SYNC_LOCK ) {
- if ( context == null ) throw new IllegalStateException("Canvas not yet displayable");
+ synchronized ( SYNC_LOCK ) {
+ if ( context == null ) throw new IllegalStateException("Canvas not yet displayable");
- return new Context(peer_info, context.getContextAttribs(), context);
- }
+ return new Context(peer_info, context.getContextAttribs(), context);
}
}
@@ -213,12 +212,11 @@
}
}
- public void releaseContext() throws LWJGLException {
+ public boolean isCurrent() throws LWJGLException {
synchronized ( SYNC_LOCK ) {
- if ( context == null )
- throw new IllegalStateException("Canvas not yet displayable");
- if ( context.isCurrent() )
- Context.releaseCurrentContext();
+ if ( context == null ) throw new IllegalStateException("Canvas not yet displayable");
+
+ return context.isCurrent();
}
}
@@ -234,6 +232,15 @@
}
}
+ public void releaseContext() throws LWJGLException {
+ synchronized ( SYNC_LOCK ) {
+ if ( context == null )
+ throw new IllegalStateException("Canvas not yet displayable");
+ if ( context.isCurrent() )
+ Context.releaseCurrentContext();
+ }
+ }
+
/** Destroy the OpenGL context. This happens when the component becomes undisplayable */
public final void destroy() {
synchronized ( SYNC_LOCK ) {
@@ -279,7 +286,7 @@
peer_info.lockAndGetHandle();
try {
if ( context == null ) {
- this.context = new Context(peer_info, attribs, drawable != null ? drawable.getContext() : null);
+ this.context = new Context(peer_info, attribs, drawable != null ? ((DrawableLWJGL)drawable).getContext() : null);
first_run = true;
}
Added: trunk/LWJGL/src/java/org/lwjgl/opengl/AbstractDrawable.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/AbstractDrawable.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/AbstractDrawable.java 2010-04-22 23:21:48 UTC (rev 3334)
@@ -0,0 +1,82 @@
+package org.lwjgl.opengl;
+
+import org.lwjgl.LWJGLException;
+import org.lwjgl.LWJGLUtil;
+
+/**
+ * @author Spasi
+ * @since 22 \xC1\xF0\xF1 2010
+ */
+abstract class AbstractDrawable implements DrawableLWJGL {
+
+ /** Handle to the native GL rendering context */
+ protected PeerInfo peer_info;
+
+ /** The OpenGL Context. */
+ protected Context context;
+
+ protected AbstractDrawable() {
+ }
+
+ public Context getContext() {
+ synchronized ( GlobalLock.lock ) {
+ return context;
+ }
+ }
+
+ public Context createSharedContext() throws LWJGLException {
+ synchronized ( GlobalLock.lock ) {
+ checkDestroyed();
+ return new Context(peer_info, context.getContextAttribs(), context);
+ }
+ }
+
+ public boolean isCurrent() throws LWJGLException {
+ synchronized ( GlobalLock.lock ) {
+ checkDestroyed();
+ return context.isCurrent();
+ }
+ }
+
+ public void makeCurrent() throws LWJGLException {
+ synchronized ( GlobalLock.lock ) {
+ checkDestroyed();
+ context.makeCurrent();
+ }
+ }
+
+ public void releaseContext() throws LWJGLException {
+ synchronized ( GlobalLock.lock ) {
+ checkDestroyed();
+ if ( context.isCurrent() )
+ Context.releaseCurrentContext();
+ }
+ }
+
+ public void destroy() {
+ synchronized ( GlobalLock.lock ) {
+ if ( context == null )
+ return;
+
+ try {
+ releaseContext();
+
+ context.forceDestroy();
+ context = null;
+
+ if ( peer_info != null ) {
+ peer_info.destroy();
+ peer_info = null;
+ }
+ } catch (LWJGLException e) {
+ LWJGLUtil.log("Exception occurred while destroying Drawable: " + e);
+ }
+ }
+ }
+
+ protected final void checkDestroyed() {
+ if ( context == null )
+ throw new IllegalStateException("The Drawable has no context available.");
+ }
+
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/BaseReferences.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/BaseReferences.java 2010-04-22 18:32:46 UTC (rev 3333)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/BaseReferences.java 2010-04-22 23:21:48 UTC (rev 3334)
@@ -32,7 +32,6 @@
package org.lwjgl.opengl;
import java.nio.Buffer;
-import java.nio.IntBuffer;
import java.util.Arrays;
class BaseReferences {
@@ -49,24 +48,19 @@
int indirectBuffer;
BaseReferences(ContextCapabilities caps) {
- IntBuffer temp = caps.scratch_int_buffer;
-
int max_vertex_attribs;
- if (caps.OpenGL20 || caps.GL_ARB_vertex_shader) {
- GL11.glGetInteger(ARBVertexShader.GL_MAX_VERTEX_ATTRIBS_ARB, temp);
- max_vertex_attribs = temp.get(0);
- } else
+ if (caps.OpenGL20 || caps.GL_ARB_vertex_shader)
+ max_vertex_attribs = GL11.glGetInteger(ARBVertexShader.GL_MAX_VERTEX_ATTRIBS_ARB);
+ else
max_vertex_attribs = 0;
glVertexAttribPointer_buffer = new Buffer[max_vertex_attribs];
int max_texture_units;
- if (caps.OpenGL20) {
- GL11.glGetInteger(GL20.GL_MAX_TEXTURE_IMAGE_UNITS, temp);
- max_texture_units = temp.get(0);
- } else if (caps.OpenGL13 || caps.GL_ARB_multitexture) {
- GL11.glGetInteger(GL13.GL_MAX_TEXTURE_UNITS, temp);
- max_texture_units = temp.get(0);
- } else
+ if (caps.OpenGL20)
+ max_texture_units = GL11.glGetInteger(GL20.GL_MAX_TEXTURE_IMAGE_UNITS);
+ else if (caps.OpenGL13 || caps.GL_ARB_multitexture)
+ max_texture_units = GL11.glGetInteger(GL13.GL_MAX_TEXTURE_UNITS);
+ else
max_texture_units = 1;
glTexCoordPointer_buffer = new Buffer[max_texture_units];
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2010-04-22 18:32:46 UTC (rev 3333)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2010-04-22 23:21:48 UTC (rev 3334)
@@ -106,14 +106,10 @@
/** Swap interval */
private static int swap_interval;
- /** A unique context object, so we can track different contexts between creates() and destroys() */
- private static PeerInfo peer_info;
- private static Context context;
-
/** The Drawable instance that tracks the current Display context */
- private final static Drawable drawable;
+ private static final AbstractDrawable drawable;
- private static boolean window_created = false;
+ private static boolean window_created;
private static boolean parent_resized;
@@ -137,32 +133,21 @@
} catch (LWJGLException e) {
throw new RuntimeException(e);
}
- drawable = new Drawable() {
- public Context getContext() {
+ drawable = new AbstractDrawable() {
+ public void destroy() {
synchronized ( GlobalLock.lock ) {
- return isCreated() ? context : null;
- }
- }
+ if ( !isCreated() )
+ return;
- public Context createSharedContext() throws LWJGLException {
- synchronized ( GlobalLock.lock ) {
- if ( !isCreated() ) throw new IllegalStateException("Display must be created.");
-
- return new Context(peer_info, context.getContextAttribs(), context);
+ releaseDrawable();
+ super.destroy();
+ destroyWindow();
+ x = y = -1;
+ cached_icons = null;
+ reset();
+ removeShutdownHook();
}
}
-
- public void makeCurrent() throws LWJGLException {
- Display.makeCurrent();
- }
-
- public void releaseContext() throws LWJGLException {
- Display.releaseContext();
- }
-
- public void destroy() {
- Display.destroy();
- }
};
}
@@ -258,24 +243,23 @@
* @throws LWJGLException if the display mode could not be set
*/
public static void setDisplayMode(DisplayMode mode) throws LWJGLException {
- synchronized (GlobalLock.lock) {
- if (mode == null)
+ synchronized ( GlobalLock.lock ) {
+ if ( mode == null )
throw new NullPointerException("mode must be non-null");
boolean was_fullscreen = isFullscreen();
current_mode = mode;
- if (isCreated()) {
+ if ( isCreated() ) {
destroyWindow();
// If mode is not fullscreen capable, make sure we are in windowed mode
try {
- if (was_fullscreen && !isFullscreen())
+ if ( was_fullscreen && !isFullscreen() )
display_impl.resetDisplayMode();
- else if (isFullscreen())
+ else if ( isFullscreen() )
switchDisplayMode();
createWindow();
makeCurrentAndSetSwapInterval();
} catch (LWJGLException e) {
- destroyContext();
- destroyPeerInfo();
+ drawable.destroy();
display_impl.resetDisplayMode();
throw e;
}
@@ -288,9 +272,9 @@
}
private static int getWindowX() {
- if (!isFullscreen() && parent == null) {
+ if ( !isFullscreen() && parent == null ) {
// if no display location set, center window
- if (x == -1) {
+ if ( x == -1 ) {
return Math.max(0, (initial_mode.getWidth() - current_mode.getWidth()) / 2);
} else {
return x;
@@ -301,7 +285,7 @@
}
private static int getWindowY() {
- if (!isFullscreen() && parent == null) {
+ if ( !isFullscreen() && parent == null ) {
// if no display location set, center window
if ( y == -1 ) {
return Math.max(0, (initial_mode.getHeight() - current_mode.getHeight()) / 2);
@@ -344,6 +328,7 @@
private static void releaseDrawable() {
try {
+ Context context = drawable.context;
if ( context != null && context.isCurrent() ) {
Context.releaseCurrentContext();
context.releaseDrawable();
@@ -483,13 +468,13 @@
*/
public static void setParent(Canvas parent) throws LWJGLException {
synchronized ( GlobalLock.lock ) {
- if (Display.parent != parent) {
+ if ( Display.parent != parent ) {
Display.parent = parent;
if ( !isCreated() )
return;
destroyWindow();
try {
- if (isFullscreen()) {
+ if ( isFullscreen() ) {
switchDisplayMode();
} else {
display_impl.resetDisplayMode();
@@ -497,8 +482,7 @@
createWindow();
makeCurrentAndSetSwapInterval();
} catch (LWJGLException e) {
- destroyContext();
- destroyPeerInfo();
+ drawable.destroy();
display_impl.resetDisplayMode();
throw e;
}
@@ -539,18 +523,18 @@
private static void setDisplayModeAndFullscreenInternal(boolean fullscreen, DisplayMode mode) throws LWJGLException {
synchronized ( GlobalLock.lock ) {
- if (mode == null)
+ if ( mode == null )
throw new NullPointerException("mode must be non-null");
DisplayMode old_mode = current_mode;
current_mode = mode;
boolean was_fullscreen = isFullscreen();
Display.fullscreen = fullscreen;
- if (was_fullscreen != isFullscreen() || !mode.equals(old_mode)) {
- if (!isCreated())
+ if ( was_fullscreen != isFullscreen() || !mode.equals(old_mode) ) {
+ if ( !isCreated() )
return;
destroyWindow();
try {
- if (isFullscreen()) {
+ if ( isFullscreen() ) {
switchDisplayMode();
} else {
display_impl.resetDisplayMode();
@@ -558,8 +542,7 @@
createWindow();
makeCurrentAndSetSwapInterval();
} catch (LWJGLException e) {
- destroyContext();
- destroyPeerInfo();
+ drawable.destroy();
display_impl.resetDisplayMode();
throw e;
}
@@ -569,7 +552,7 @@
/** @return whether the Display is in fullscreen mode */
public static boolean isFullscreen() {
- synchronized (GlobalLock.lock) {
+ synchronized ( GlobalLock.lock ) {
return fullscreen && current_mode.isFullscreenCapable();
}
}
@@ -671,7 +654,6 @@
* Update the window. If the window is visible clears
* the dirty flag and calls swapBuffers() and finally
* polls the input devices.
- *
*/
public static void update() {
update(true);
@@ -730,25 +712,21 @@
* @throws LWJGLException If the context could not be released
*/
public static void releaseContext() throws LWJGLException {
- synchronized ( GlobalLock.lock ) {
- if ( !isCreated() )
- throw new IllegalStateException("Display is not created");
- if ( context.isCurrent() )
- Context.releaseCurrentContext();
- }
+ drawable.releaseContext();
}
+ /** Returns true if the Display's context is current in the current thread. */
+ public static boolean isCurrent() throws LWJGLException {
+ return drawable.isCurrent();
+ }
+
/**
* Make the Display the current rendering context for GL calls.
*
* @throws LWJGLException If the context could not be made current
*/
public static void makeCurrent() throws LWJGLException {
- synchronized ( GlobalLock.lock ) {
- if ( !isCreated() )
- throw new IllegalStateException("Display is not created");
- context.makeCurrent();
- }
+ drawable.makeCurrent();
}
private static void removeShutdownHook() {
@@ -868,19 +846,19 @@
throw new NullPointerException("pixel_format cannot be null");
removeShutdownHook();
registerShutdownHook();
- if (isFullscreen())
+ if ( isFullscreen() )
switchDisplayMode();
try {
- peer_info = display_impl.createPeerInfo(pixel_format);
+ drawable.peer_info = display_impl.createPeerInfo(pixel_format);
try {
createWindow();
try {
- context = new Context(peer_info, attribs, shared_drawable != null ? shared_drawable.getContext() : null);
+ drawable.context = new Context(drawable.peer_info, attribs, shared_drawable != null ? ((AbstractDrawable)shared_drawable).getContext() : null);
try {
makeCurrentAndSetSwapInterval();
initContext();
} catch (LWJGLException e) {
- destroyContext();
+ drawable.destroy();
throw e;
}
} catch (LWJGLException e) {
@@ -888,7 +866,7 @@
throw e;
}
} catch (LWJGLException e) {
- destroyPeerInfo();
+ drawable.destroy();
throw e;
}
} catch (LWJGLException e) {
@@ -899,13 +877,13 @@
}
/**
- * Set the initial color of the Display. This method is called before the Display is created and will set the
- * background color to the one specified in this method.
- *
- * @param red - color value between 0 - 1
- * @param green - color value between 0 - 1
- * @param blue - color value between 0 - 1
- */
+ * Set the initial color of the Display. This method is called before the Display is created and will set the
+ * background color to the one specified in this method.
+ *
+ * @param red - color value between 0 - 1
+ * @param green - color value between 0 - 1
+ * @param blue - color value between 0 - 1
+ */
public static void setInitialBackground(float red, float green, float blue) {
r = red;
g = green;
@@ -977,41 +955,14 @@
* regardless of whether the Display was the current rendering context.
*/
public static void destroy() {
- synchronized ( GlobalLock.lock ) {
- if ( !isCreated() ) {
- return;
- }
-
- releaseDrawable();
- destroyContext();
- destroyWindow();
- destroyPeerInfo();
- x = y = -1;
- cached_icons = null;
- reset();
- removeShutdownHook();
- }
+ drawable.destroy();
}
- private static void destroyPeerInfo() {
- peer_info.destroy();
- peer_info = null;
- }
-
- private static void destroyContext() {
- try {
- context.forceDestroy();
- } catch (LWJGLException e) {
- throw new RuntimeException(e);
- } finally {
- context = null;
- }
- }
-
/*
* Reset display mode if fullscreen. This method is also called from the shutdown hook added
* in the static constructor
*/
+
private static void reset() {
display_impl.resetDisplayMode();
current_mode = initial_mode;
@@ -1070,7 +1021,7 @@
y = new_y;
// offset if already created
- if (isCreated() && !isFullscreen()) {
+ if ( isCreated() && !isFullscreen() ) {
reshape();
}
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/Drawable.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/Drawable.java 2010-04-22 18:32:46 UTC (rev 3333)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Drawable.java 2010-04-22 23:21:48 UTC (rev 3334)
@@ -42,21 +42,10 @@
public interface Drawable {
- /**
- * [INTERNAL USE ONLY] Returns the Drawable's Context.
- *
- * @return the Drawable's Context
- */
- Context getContext();
+ /** Returns true if the Drawable's context is current in the current thread. */
+ boolean isCurrent() throws LWJGLException;
/**
- * [INTERNAL USE ONLY] Creates a new Context that is shared with the Drawable's Context.
- *
- * @return a Context shared with the Drawable's Context.
- */
- Context createSharedContext() throws LWJGLException;
-
- /**
* Makes the Drawable's context current in the current thread.
*
* @throws LWJGLException
@@ -70,9 +59,7 @@
*/
void releaseContext() throws LWJGLException;
- /**
- * Destroys the Drawable.
- */
+ /** Destroys the Drawable. */
void destroy();
}
Added: trunk/LWJGL/src/java/org/lwjgl/opengl/DrawableLWJGL.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/DrawableLWJGL.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/DrawableLWJGL.java 2010-04-22 23:21:48 UTC (rev 3334)
@@ -0,0 +1,25 @@
+package org.lwjgl.opengl;
+
+import org.lwjgl.LWJGLException;
+
+/**
+ * @author Spasi
+ * @since 23 \xC1\xF0\xF1 2010
+ */
+interface DrawableLWJGL extends Drawable {
+
+ /**
+ * [INTERNAL USE ONLY] Returns the Drawable's Context.
+ *
+ * @return the Drawable's Context
+ */
+ Context getContext();
+
+ /**
+ * [INTERNAL USE ONLY] Creates a new Context that is shared with the Drawable's Context.
+ *
+ * @return a Context shared with the Drawable's Context.
+ */
+ Context createSharedContext() throws LWJGLException;
+
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java 2010-04-22 18:32:46 UTC (rev 3333)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java 2010-04-22 23:21:48 UTC (rev 3334)
@@ -35,6 +35,7 @@
import java.nio.IntBuffer;
import org.lwjgl.BufferUtils;
+import org.lwjgl.LWJGLUtil;
/**
* A class to check buffer boundaries in GL methods. Many GL
@@ -60,93 +61,78 @@
}
static int getBufferObjectSize(ContextCapabilities caps, int buffer_enum) {
- IntBuffer scratch_buffer = caps.scratch_int_buffer;
- GL15.glGetBufferParameter(buffer_enum, GL15.GL_BUFFER_SIZE, scratch_buffer);
- return scratch_buffer.get(0);
+ return GL15.glGetBufferParameter(buffer_enum, GL15.GL_BUFFER_SIZE);
}
static int getBufferObjectSizeARB(ContextCapabilities caps, int buffer_enum) {
- IntBuffer scratch_buffer = caps.scratch_int_buffer;
- ARBBufferObject.glGetBufferParameterARB(buffer_enum, ARBBufferObject.GL_BUFFER_SIZE_ARB, scratch_buffer);
- return scratch_buffer.get(0);
+ return ARBBufferObject.glGetBufferParameterARB(buffer_enum, ARBBufferObject.GL_BUFFER_SIZE_ARB);
}
static int getBufferObjectSizeATI(ContextCapabilities caps, int buffer) {
- IntBuffer scratch_buffer = caps.scratch_int_buffer;
- ATIVertexArrayObject.glGetObjectBufferATI(buffer, ATIVertexArrayObject.GL_OBJECT_BUFFER_SIZE_ATI, scratch_buffer);
- return scratch_buffer.get(0);
+ return ATIVertexArrayObject.glGetObjectBufferATI(buffer, ATIVertexArrayObject.GL_OBJECT_BUFFER_SIZE_ATI);
}
static int getNamedBufferObjectSize(ContextCapabilities caps, int buffer) {
- IntBuffer scratch_buffer = caps.scratch_int_buffer;
- EXTDirectStateAccess.glGetNamedBufferParameterEXT(buffer, GL15.GL_BUFFER_SIZE, scratch_buffer);
- return scratch_buffer.get(0);
+ return EXTDirectStateAccess.glGetNamedBufferParameterEXT(buffer, GL15.GL_BUFFER_SIZE);
}
- private static boolean checkBufferObject(ContextCapabilities caps, int buffer_enum, boolean state) {
- IntBuffer scratch_buffer = caps.scratch_int_buffer;
- GL11.glGetInteger(buffer_enum, scratch_buffer);
- boolean is_enabled = scratch_buffer.get(0) != 0;
- return state == is_enabled;
- }
-
/** Helper method to ensure that array buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */
static void ensureArrayVBOdisabled(ContextCapabilities caps) {
- if(StateTracker.getReferencesStack(caps).getReferences().arrayBuffer != 0)
+ if( LWJGLUtil.CHECKS && StateTracker.getReferencesStack(caps).getReferences().arrayBuffer != 0 )
throw new OpenGLException("Cannot use Buffers when Array Buffer Object is enabled");
}
/** Helper method to ensure that array buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */
static void ensureArrayVBOenabled(ContextCapabilities caps) {
- if(StateTracker.getReferencesStack(caps).getReferences().arrayBuffer == 0)
+ if( LWJGLUtil.CHECKS && StateTracker.getReferencesStack(caps).getReferences().arrayBuffer == 0 )
throw new OpenGLException("Cannot use offsets when Array Buffer Object is disabled");
}
/** Helper method to ensure that element array buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */
static void ensureElementVBOdisabled(ContextCapabilities caps) {
- if(StateTracker.getReferencesStack(caps).getReferences().elementArrayBuffer != 0)
+ if( LWJGLUtil.CHECKS && StateTracker.getReferencesStack(caps).getReferences().elementArrayBuffer != 0 )
throw new OpenGLException("Cannot use Buffers when Element Array Buffer Object is enabled");
}
/** Helper method to ensure that element array buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */
static void ensureElementVBOenabled(ContextCapabilities caps) {
- if(StateTracker.getReferencesStack(caps).getReferences().elementArrayBuffer == 0)
+ if( LWJGLUtil.CHECKS && StateTracker.getReferencesStack(caps).getReferences().elementArrayBuffer == 0 )
throw new OpenGLException("Cannot use offsets when Element Array Buffer Object is disabled");
}
/** Helper method to ensure that array buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */
static void ensureIndirectBOdisabled(ContextCapabilities caps) {
- if ( StateTracker.getReferencesStack(caps).getReferences().indirectBuffer != 0 )
+ if ( LWJGLUtil.CHECKS && StateTracker.getReferencesStack(caps).getReferences().indirectBuffer != 0 )
throw new OpenGLException("Cannot use Buffers when Draw Indirect Object is enabled");
}
/** Helper method to ensure that array buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */
static void ensureIndirectBOenabled(ContextCapabilities caps) {
- if ( StateTracker.getReferencesStack(caps).getReferences().indirectBuffer == 0 )
+ if ( LWJGLUtil.CHECKS && StateTracker.getReferencesStack(caps).getReferences().indirectBuffer == 0 )
throw new OpenGLException("Cannot use offsets when Draw Indirect Object is disabled");
}
/** Helper method to ensure that pixel pack buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */
static void ensurePackPBOdisabled(ContextCapabilities caps) {
- if ( StateTracker.getReferencesStack(caps).getReferences().pixelPackBuffer != 0 )
+ if ( LWJGLUtil.CHECKS && StateTracker.getReferencesStack(caps).getReferences().pixelPackBuffer != 0 )
throw new OpenGLException("Cannot use Buffers when Pixel Pack Buffer Object is enabled");
}
/** Helper method to ensure that pixel pack buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */
static void ensurePackPBOenabled(ContextCapabilities caps) {
- if ( StateTracker.getReferencesStack(caps).getReferences().pixelPackBuffer == 0 )
+ if ( LWJGLUtil.CHECKS && StateTracker.getReferencesStack(caps).getReferences().pixelPackBuffer == 0 )
throw new OpenGLException("Cannot use offsets when Pixel Pack Buffer Object is disabled");
}
/** Helper method to ensure that pixel unpack buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */
static void ensureUnpackPBOdisabled(ContextCapabilities caps) {
- if ( StateTracker.getReferencesStack(caps).getReferences().pixelUnpackBuffer != 0 )
+ if ( LWJGLUtil.CHECKS && StateTracker.getReferencesStack(caps).getReferences().pixelUnpackBuffer != 0 )
throw new OpenGLException("Cannot use Buffers when Pixel Unpack Buffer Object is enabled");
}
/** Helper method to ensure that pixel unpack buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */
static void ensureUnpackPBOenabled(ContextCapabilities caps) {
- if ( StateTracker.getReferencesStack(caps).getReferences().pixelUnpackBuffer == 0 )
+ if ( LWJGLUtil.CHECKS && StateTracker.getReferencesStack(caps).getReferences().pixelUnpackBuffer == 0 )
throw new OpenGLException("Cannot use offsets when Pixel Unpack Buffer Object is disabled");
}
@@ -162,19 +148,19 @@
* @return the size, in elements, of the image
*/
static int calculateImageStorage(Buffer buffer, int format, int type, int width, int height, int depth) {
- return calculateImageStorage(format, type, width, height, depth) >> BufferUtils.getElementSizeExponent(buffer);
+ return LWJGLUtil.CHECKS ? calculateImageStorage(format, type, width, height, depth) >> BufferUtils.getElementSizeExponent(buffer) : 0;
}
static int calculateTexImage1DStorage(Buffer buffer, int format, int type, int width) {
- return calculateTexImage1DStorage(format, type, width) >> BufferUtils.getElementSizeExponent(buffer);
+ return LWJGLUtil.CHECKS ? calculateTexImage1DStorage(format, type, width) >> BufferUtils.getElementSizeExponent(buffer) : 0;
}
static int calculateTexImage2DStorage(Buffer buffer, int format, int type, int width, int height) {
- return calculateTexImage2DStorage(format, type, width, height) >> BufferUtils.getElementSizeExponent(buffer);
+ return LWJGLUtil.CHECKS ? calculateTexImage2DStorage(format, type, width, height) >> BufferUtils.getElementSizeExponent(buffer) : 0;
}
static int calculateTexImage3DStorage(Buffer buffer, int format, int type, int width, int height, int depth) {
- return calculateTexImage3DStorage(format, type, width, height, depth) >> BufferUtils.getElementSizeExponent(buffer);
+ return LWJGLUtil.CHECKS ? calculateTexImage3DStorage(format, type, width, height, depth) >> BufferUtils.getElementSizeExponent(buffer) : 0;
}
/**
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java 2010-04-22 18:32:46 UTC (rev 3333)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java 2010-04-22 23:21:48 UTC (rev 3334)
@@ -78,7 +78,7 @@
AccessController.doPrivileged(new PrivilegedExceptionAction() {
public Object run() throws Exception {
Application.getApplication().addApplicationListener(new ApplicationAdapter() {
- public final void handleQuit(ApplicationEvent event) {
+ public void handleQuit(ApplicationEvent event) {
doHandleQuit();
}
});
@@ -271,15 +271,16 @@
*
* - elias
*/
+ AbstractDrawable drawable = (AbstractDrawable)Display.getDrawable();
if (Display.isFullscreen() && (frame != null && frame.getCanvas().syncCanvasPainted() || should_update)) {
try {
- MacOSXContextImplementation.resetView(Display.getDrawable().getContext().getPeerInfo(), Display.getDrawable().getContext());
+ MacOSXContextImplementation.resetView(drawable.peer_info, drawable.context);
} catch (LWJGLException e) {
LWJGLUtil.log("Failed to reset context: " + e);
}
}
if (should_update) {
- Display.getDrawable().getContext().update();
+ drawable.context.update();
/* This is necessary to make sure the context won't "forget" about the view size */
GL11.glGetInteger(GL11.GL_VIEWPORT, current_viewport);
GL11.glViewport(current_viewport.get(0), current_viewport.get(1), current_viewport.get(2), current_viewport.get(3));
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/Pbuffer.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/Pbuffer.java 2010-04-22 18:32:46 UTC (rev 3333)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Pbuffer.java 2010-04-22 23:21:48 UTC (rev 3334)
@@ -35,7 +35,6 @@
import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLException;
-import org.lwjgl.LWJGLUtil;
import org.lwjgl.Sys;
/**
@@ -49,7 +48,7 @@
* @version $Revision$
* $Id$
*/
-public final class Pbuffer implements Drawable {
+public final class Pbuffer extends AbstractDrawable {
/**
* Indicates that Pbuffers can be created.
*/
@@ -136,11 +135,6 @@
public static final int DEPTH_BUFFER = RenderTexture.WGL_DEPTH_COMPONENT_NV;
/**
- * Handle to the native GL rendering context
- */
- private final PeerInfo peer_info;
-
- /**
* Width
*/
private final int width;
@@ -150,10 +144,6 @@
*/
private final int height;
- private final Context context;
-
- private boolean destroyed;
-
static {
Sys.initialize();
}
@@ -227,14 +217,11 @@
this.width = width;
this.height = height;
this.peer_info = createPbuffer(width, height, pixel_format, renderTexture);
- Context shared_context = null;
- if (shared_drawable != null) {
- shared_context = shared_drawable.getContext();
- } else {
- Drawable display_drawable = Display.getDrawable();
- if (display_drawable != null)
- shared_context = display_drawable.getContext();
- }
+ Context shared_context;
+ if (shared_drawable != null)
+ shared_context = ((DrawableLWJGL)shared_drawable).getContext();
+ else
+ shared_context = ((DrawableLWJGL)Display.getDrawable()).getContext(); // May be null
this.context = new Context(peer_info, attribs, shared_context);
}
@@ -251,21 +238,6 @@
renderTexture.pBufferAttribs);
}
- public Context getContext() {
- return context;
- }
-
- public Context createSharedContext() throws LWJGLException {
- synchronized ( GlobalLock.lock ) {
- return new Context(peer_info, context.getContextAttribs(), context);
- }
- }
-
- private void checkDestroyed() {
- if (destroyed)
- throw new IllegalStateException("Pbuffer is destroyed");
- }
-
/**
* Method to test for validity of the buffer. If this function returns true, the buffer contents is lost. The buffer can still
* be used, but the results are undefined. The application is expected to release the buffer if needed, destroy it and recreate
@@ -279,21 +251,6 @@
}
/**
- * Method to make the Pbuffer context current. All subsequent OpenGL calls will go to this buffer.
- * @throws LWJGLException if the context could not be made current
- */
- public synchronized void makeCurrent() throws LWJGLException {
- checkDestroyed();
- context.makeCurrent();
- }
-
- public void releaseContext() throws LWJGLException {
- checkDestroyed();
- if ( context.isCurrent() )
- Context.releaseCurrentContext();
- }
-
- /**
* Gets the Pbuffer capabilities.
*
* @return a bitmask of Pbuffer capabilities.
@@ -302,22 +259,6 @@
return Display.getImplementation().getPbufferCapabilities();
}
- /**
- * Destroys the Pbuffer. After this call, there will be no valid GL rendering context - regardless of whether this Pbuffer was
- * the current rendering context or not.
- */
- public synchronized void destroy() {
- if (destroyed)
- return;
- try {
- context.forceDestroy();
- peer_info.destroy();
- destroyed = true;
- } catch (LWJGLException e) {
- LWJGLUtil.log("Exception occurred while destroying pbuffer: " + e);
- }
- }
-
// -----------------------------------------------------------------------------------------
// ------------------------------- Render-to-Texture Methods -------------------------------
// -----------------------------------------------------------------------------------------
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/SharedDrawable.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/SharedDrawable.java 2010-04-22 18:32:46 UTC (rev 3333)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/SharedDrawable.java 2010-04-22 23:21:48 UTC (rev 3334)
@@ -32,7 +32,6 @@
package org.lwjgl.opengl;
import org.lwjgl.LWJGLException;
-import org.lwjgl.LWJGLUtil;
/**
* @author Spasi
@@ -46,51 +45,14 @@
*
* @author Spasi
*/
-public final class SharedDrawable implements Drawable {
+public final class SharedDrawable extends AbstractDrawable {
- private Context context;
-
- private boolean destroyed;
-
public SharedDrawable(final Drawable drawable) throws LWJGLException {
- this.context = drawable.createSharedContext();
+ this.context = ((DrawableLWJGL)drawable).createSharedContext();
}
- public Context getContext() {
- return context;
- }
-
public Context createSharedContext() {
throw new UnsupportedOperationException();
}
- public void makeCurrent() throws LWJGLException {
- checkDestroyed();
- context.makeCurrent();
-
- }
-
- public void releaseContext() throws LWJGLException {
- checkDestroyed();
- if ( context.isCurrent() )
- Context.releaseCurrentContext();
- }
-
- public void destroy() {
- if ( destroyed )
- return;
-
- try {
- context.forceDestroy();
- destroyed = true;
- } catch (LWJGLException e) {
- LWJGLUtil.log("Exception occurred while destroying SharedDrawable: " + e);
- }
- }
-
- private void checkDestroyed() {
- if ( destroyed )
- throw new IllegalStateException("SharedDrawable is destroyed");
- }
-
}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2010-04-22 18:32:46 UTC (rev 3333)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2010-04-22 23:21:48 UTC (rev 3334)
@@ -437,8 +437,9 @@
* is maximized helps some gfx cards recover from fullscreen
*/
try {
- if (Display.getDrawable().getContext() != null && Display.getDrawable().getContext().isCurrent())
- Display.getDrawable().getContext().makeCurrent();
+ Context context = ((DrawableLWJGL)Display.getDrawable()).getContext();
+ if (context != null && context.isCurrent())
+ context.makeCurrent();
} catch (LWJGLException e) {
LWJGLUtil.log("Exception occurred while trying to make context current: " + e);
}
@@ -973,4 +974,4 @@
return "Rect: top = " + top + " bottom = " + bottom + " left = " + left + " right = " + right;
}
}
-}
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/multithread/BackgroundLoader.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/multithread/BackgroundLoader.java 2010-04-22 18:32:46 UTC (rev 3333)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/multithread/BackgroundLoader.java 2010-04-22 23:21:48 UTC (rev 3334)
@@ -78,8 +78,6 @@
System.out.println("** Sleeping, no texture created yet **");
- long start = System.currentTimeMillis();
-
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java 2010-04-22 18:32:46 UTC (rev 3333)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java 2010-04-22 23:21:48 UTC (rev 3334)
@@ -63,7 +63,6 @@
writer.println("public class " + Utils.CONTEXT_CAPS_CLASS_NAME + " {");
writer.println("\tstatic final boolean DEBUG = " + Boolean.toString(generate_error_checks) + ";");
writer.println("\tfinal StateTracker tracker = new StateTracker();");
- writer.println("\tfinal IntBuffer scratch_int_buffer = BufferUtils.createIntBuffer(16);");
writer.println();
if ( !context_specific ) {
writer.println("\tprivate static boolean " + STUBS_LOADED_NAME + " = false;");
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-04-22 18:32:46 UTC (rev 3333)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-04-22 23:21:48 UTC (rev 3334)
@@ -180,10 +180,7 @@
java_writer.println();
java_writer.println("package " + d.getPackage().getQualifiedName() + ";");
java_writer.println();
- java_writer.println("import org.lwjgl.LWJGLException;");
- java_writer.println("import org.lwjgl.BufferChecks;");
- // DISABLED: indirect buffer support
- //java_writer.println("import org.lwjgl.NondirectBufferWrapper;");
+ java_writer.println("import org.lwjgl.*;");
java_writer.println("import java.nio.*;");
java_writer.println();
Utils.printDocComment(java_writer, d);
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2010-04-22 18:32:46 UTC (rev 3333)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2010-04-22 23:21:48 UTC (rev 3334)
@@ -261,9 +261,12 @@
// DISABLED: indirect buffer support
//printNondirectParameterCopies(writer, method, mode);
if (has_result) {
- if ( method.getAnnotation(GLreturn.class) == null )
- writer.println("\t\treturn " + Utils.RESULT_VAR_NAME + ";");
- else
+ if ( method.getAnnotation(GLreturn.class) == null ) {
+ if ( ByteBuffer.class.equals(Utils.getJavaType(result_type)) )
+ writer.println("\t\treturn " + Utils.RESULT_VAR_NAME + ".order(ByteOrder.nativeOrder());"); // safeNewBuffer returns a direct ByteBuffer with BIG_ENDIAN order.
+ else
+ writer.println("\t\treturn " + Utils.RESULT_VAR_NAME + ";");
+ } else
Utils.printGLReturnPost(writer, method, method.getAnnotation(GLreturn.class));
}
writer.println("\t}");
@@ -490,7 +493,7 @@
cachedReference != null &&
(mode != Mode.BUFFEROBJECT || param.getAnnotation(BufferObject.class) == null) &&
param.getAnnotation(Result.class) == null) {
- writer.print("\t\t" + Utils.CHECKS_CLASS_NAME + ".getReferences(caps).");
+ writer.print("\t\tif ( LWJGLUtil.CHECKS ) " + Utils.CHECKS_CLASS_NAME + ".getReferences(caps).");
if(cachedReference.name().length() > 0) {
writer.print(cachedReference.name());
} else {
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_vertex_array_object.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_vertex_array_object.java 2010-04-22 18:32:46 UTC (rev 3333)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_vertex_array_object.java 2010-04-22 23:21:48 UTC (rev 3334)
@@ -71,6 +71,11 @@
@StripPostfix("params")
void glGetObjectBufferivATI(@GLuint int buffer, @GLenum int pname, @OutParameter @Check IntBuffer params);
+ @Alternate("glGetObjectBufferivATI")
+ @GLreturn("params")
+ @StripPostfix("params")
+ void glGetObjectBufferivATI2(@GLuint int buffer, @GLenum int pname, @OutParameter IntBuffer params);
+
void glFreeObjectBufferATI(@GLuint int buffer);
void glArrayObjectATI(@GLenum int array, int size, @GLenum int type, @GLsizei int stride, @GLuint int buffer, @GLuint int offset);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|