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
This commit is contained in:
parent
965e398053
commit
47c9991b41
|
@ -60,7 +60,7 @@ public class BufferChecks {
|
||||||
* Helper methods to ensure a function pointer is not-null (0)
|
* Helper methods to ensure a function pointer is not-null (0)
|
||||||
*/
|
*/
|
||||||
public static void checkFunctionAddress(long pointer) {
|
public static void checkFunctionAddress(long pointer) {
|
||||||
if (pointer == 0) {
|
if (LWJGLUtil.CHECKS && pointer == 0) {
|
||||||
throw new IllegalStateException("Function is not supported");
|
throw new IllegalStateException("Function is not supported");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,20 +69,22 @@ public class BufferChecks {
|
||||||
* Helper methods to ensure a ByteBuffer is null-terminated
|
* Helper methods to ensure a ByteBuffer is null-terminated
|
||||||
*/
|
*/
|
||||||
public static void checkNullTerminated(ByteBuffer buf) {
|
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");
|
throw new IllegalArgumentException("Missing null termination");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkNullTerminated(ByteBuffer buf, int count) {
|
public static void checkNullTerminated(ByteBuffer buf, int count) {
|
||||||
int nullFound = 0;
|
if ( LWJGLUtil.CHECKS ) {
|
||||||
for ( int i = buf.position(); i < buf.limit(); i++ ) {
|
int nullFound = 0;
|
||||||
if ( buf.get(i) == 0 )
|
for ( int i = buf.position(); i < buf.limit(); i++ ) {
|
||||||
nullFound++;
|
if ( buf.get(i) == 0 )
|
||||||
}
|
nullFound++;
|
||||||
|
}
|
||||||
|
|
||||||
if ( nullFound < count )
|
if ( nullFound < count )
|
||||||
throw new IllegalArgumentException("Missing null termination");
|
throw new IllegalArgumentException("Missing null termination");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Helper methods to ensure an IntBuffer is null-terminated */
|
/** Helper methods to ensure an IntBuffer is null-terminated */
|
||||||
|
@ -93,7 +95,7 @@ public class BufferChecks {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkNotNull(Object o) {
|
public static void checkNotNull(Object o) {
|
||||||
if (o == null)
|
if ( LWJGLUtil.CHECKS && o == null)
|
||||||
throw new IllegalArgumentException("Null argument");
|
throw new IllegalArgumentException("Null argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,37 +103,37 @@ public class BufferChecks {
|
||||||
* Helper methods to ensure a buffer is direct (and, implicitly, non-null).
|
* Helper methods to ensure a buffer is direct (and, implicitly, non-null).
|
||||||
*/
|
*/
|
||||||
public static void checkDirect(ByteBuffer buf) {
|
public static void checkDirect(ByteBuffer buf) {
|
||||||
if (!buf.isDirect()) {
|
if ( LWJGLUtil.CHECKS && !buf.isDirect()) {
|
||||||
throw new IllegalArgumentException("ByteBuffer is not direct");
|
throw new IllegalArgumentException("ByteBuffer is not direct");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkDirect(ShortBuffer buf) {
|
public static void checkDirect(ShortBuffer buf) {
|
||||||
if (!buf.isDirect()) {
|
if ( LWJGLUtil.CHECKS && !buf.isDirect()) {
|
||||||
throw new IllegalArgumentException("ShortBuffer is not direct");
|
throw new IllegalArgumentException("ShortBuffer is not direct");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkDirect(IntBuffer buf) {
|
public static void checkDirect(IntBuffer buf) {
|
||||||
if (!buf.isDirect()) {
|
if ( LWJGLUtil.CHECKS && !buf.isDirect()) {
|
||||||
throw new IllegalArgumentException("IntBuffer is not direct");
|
throw new IllegalArgumentException("IntBuffer is not direct");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkDirect(LongBuffer buf) {
|
public static void checkDirect(LongBuffer buf) {
|
||||||
if (!buf.isDirect()) {
|
if ( LWJGLUtil.CHECKS && !buf.isDirect()) {
|
||||||
throw new IllegalArgumentException("LongBuffer is not direct");
|
throw new IllegalArgumentException("LongBuffer is not direct");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkDirect(FloatBuffer buf) {
|
public static void checkDirect(FloatBuffer buf) {
|
||||||
if (!buf.isDirect()) {
|
if ( LWJGLUtil.CHECKS && !buf.isDirect()) {
|
||||||
throw new IllegalArgumentException("FloatBuffer is not direct");
|
throw new IllegalArgumentException("FloatBuffer is not direct");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkDirect(DoubleBuffer buf) {
|
public static void checkDirect(DoubleBuffer buf) {
|
||||||
if (!buf.isDirect()) {
|
if ( LWJGLUtil.CHECKS && !buf.isDirect()) {
|
||||||
throw new IllegalArgumentException("DoubleBuffer is not direct");
|
throw new IllegalArgumentException("DoubleBuffer is not direct");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,38 +156,50 @@ public class BufferChecks {
|
||||||
* @throws IllegalArgumentException
|
* @throws IllegalArgumentException
|
||||||
*/
|
*/
|
||||||
public static void checkBufferSize(Buffer buf, int size) {
|
public static void checkBufferSize(Buffer buf, int size) {
|
||||||
if (buf.remaining() < size) {
|
if ( LWJGLUtil.CHECKS && buf.remaining() < size) {
|
||||||
throwBufferSizeException(buf, size);
|
throwBufferSizeException(buf, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkBuffer(ByteBuffer buf, int size) {
|
public static void checkBuffer(ByteBuffer buf, int size) {
|
||||||
checkBufferSize(buf, size);
|
if ( LWJGLUtil.CHECKS ) {
|
||||||
checkDirect(buf);
|
checkBufferSize(buf, size);
|
||||||
|
checkDirect(buf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkBuffer(ShortBuffer buf, int size) {
|
public static void checkBuffer(ShortBuffer buf, int size) {
|
||||||
checkBufferSize(buf, size);
|
if ( LWJGLUtil.CHECKS ) {
|
||||||
checkDirect(buf);
|
checkBufferSize(buf, size);
|
||||||
|
checkDirect(buf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkBuffer(IntBuffer buf, int size) {
|
public static void checkBuffer(IntBuffer buf, int size) {
|
||||||
checkBufferSize(buf, size);
|
if ( LWJGLUtil.CHECKS ) {
|
||||||
checkDirect(buf);
|
checkBufferSize(buf, size);
|
||||||
|
checkDirect(buf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkBuffer(LongBuffer buf, int size) {
|
public static void checkBuffer(LongBuffer buf, int size) {
|
||||||
checkBufferSize(buf, size);
|
if ( LWJGLUtil.CHECKS ) {
|
||||||
checkDirect(buf);
|
checkBufferSize(buf, size);
|
||||||
|
checkDirect(buf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkBuffer(FloatBuffer buf, int size) {
|
public static void checkBuffer(FloatBuffer buf, int size) {
|
||||||
checkBufferSize(buf, size);
|
if ( LWJGLUtil.CHECKS ) {
|
||||||
checkDirect(buf);
|
checkBufferSize(buf, size);
|
||||||
|
checkDirect(buf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkBuffer(DoubleBuffer buf, int size) {
|
public static void checkBuffer(DoubleBuffer buf, int size) {
|
||||||
checkBufferSize(buf, size);
|
if ( LWJGLUtil.CHECKS ) {
|
||||||
checkDirect(buf);
|
checkBufferSize(buf, size);
|
||||||
|
checkDirect(buf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -266,7 +266,9 @@ public class LWJGLUtil {
|
||||||
|
|
||||||
/** Debug flag. */
|
/** Debug flag. */
|
||||||
public static final boolean DEBUG = getPrivilegedBoolean("org.lwjgl.util.Debug");
|
public static final boolean DEBUG = getPrivilegedBoolean("org.lwjgl.util.Debug");
|
||||||
|
|
||||||
|
public static final boolean CHECKS = !getPrivilegedBoolean("org.lwjgl.util.NoChecks");
|
||||||
|
|
||||||
static {
|
static {
|
||||||
LWJGLIcon16x16.flip();
|
LWJGLIcon16x16.flip();
|
||||||
LWJGLIcon32x32.flip();
|
LWJGLIcon32x32.flip();
|
||||||
|
|
|
@ -50,7 +50,7 @@ import java.awt.event.HierarchyListener;
|
||||||
* $Id$
|
* $Id$
|
||||||
* @version $Revision$
|
* @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;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ -109,13 +109,12 @@ public class AWTGLCanvas extends Canvas implements Drawable, ComponentListener,
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** This method should only be called internally. */
|
||||||
public Context createSharedContext() throws LWJGLException {
|
public Context createSharedContext() throws LWJGLException {
|
||||||
synchronized ( GlobalLock.lock ) {
|
synchronized ( SYNC_LOCK ) {
|
||||||
synchronized ( SYNC_LOCK ) {
|
if ( context == null ) throw new IllegalStateException("Canvas not yet displayable");
|
||||||
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 class AWTGLCanvas extends Canvas implements Drawable, ComponentListener,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void releaseContext() throws LWJGLException {
|
public boolean isCurrent() throws LWJGLException {
|
||||||
synchronized ( SYNC_LOCK ) {
|
synchronized ( SYNC_LOCK ) {
|
||||||
if ( context == null )
|
if ( context == null ) throw new IllegalStateException("Canvas not yet displayable");
|
||||||
throw new IllegalStateException("Canvas not yet displayable");
|
|
||||||
if ( context.isCurrent() )
|
return context.isCurrent();
|
||||||
Context.releaseCurrentContext();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,6 +232,15 @@ public class AWTGLCanvas extends Canvas implements Drawable, ComponentListener,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 */
|
/** Destroy the OpenGL context. This happens when the component becomes undisplayable */
|
||||||
public final void destroy() {
|
public final void destroy() {
|
||||||
synchronized ( SYNC_LOCK ) {
|
synchronized ( SYNC_LOCK ) {
|
||||||
|
@ -279,7 +286,7 @@ public class AWTGLCanvas extends Canvas implements Drawable, ComponentListener,
|
||||||
peer_info.lockAndGetHandle();
|
peer_info.lockAndGetHandle();
|
||||||
try {
|
try {
|
||||||
if ( context == null ) {
|
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;
|
first_run = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
package org.lwjgl.opengl;
|
||||||
|
|
||||||
|
import org.lwjgl.LWJGLException;
|
||||||
|
import org.lwjgl.LWJGLUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Spasi
|
||||||
|
* @since 22 Áðñ 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.");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -32,7 +32,6 @@
|
||||||
package org.lwjgl.opengl;
|
package org.lwjgl.opengl;
|
||||||
|
|
||||||
import java.nio.Buffer;
|
import java.nio.Buffer;
|
||||||
import java.nio.IntBuffer;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
class BaseReferences {
|
class BaseReferences {
|
||||||
|
@ -49,24 +48,19 @@ class BaseReferences {
|
||||||
int indirectBuffer;
|
int indirectBuffer;
|
||||||
|
|
||||||
BaseReferences(ContextCapabilities caps) {
|
BaseReferences(ContextCapabilities caps) {
|
||||||
IntBuffer temp = caps.scratch_int_buffer;
|
|
||||||
|
|
||||||
int max_vertex_attribs;
|
int max_vertex_attribs;
|
||||||
if (caps.OpenGL20 || caps.GL_ARB_vertex_shader) {
|
if (caps.OpenGL20 || caps.GL_ARB_vertex_shader)
|
||||||
GL11.glGetInteger(ARBVertexShader.GL_MAX_VERTEX_ATTRIBS_ARB, temp);
|
max_vertex_attribs = GL11.glGetInteger(ARBVertexShader.GL_MAX_VERTEX_ATTRIBS_ARB);
|
||||||
max_vertex_attribs = temp.get(0);
|
else
|
||||||
} else
|
|
||||||
max_vertex_attribs = 0;
|
max_vertex_attribs = 0;
|
||||||
glVertexAttribPointer_buffer = new Buffer[max_vertex_attribs];
|
glVertexAttribPointer_buffer = new Buffer[max_vertex_attribs];
|
||||||
|
|
||||||
int max_texture_units;
|
int max_texture_units;
|
||||||
if (caps.OpenGL20) {
|
if (caps.OpenGL20)
|
||||||
GL11.glGetInteger(GL20.GL_MAX_TEXTURE_IMAGE_UNITS, temp);
|
max_texture_units = GL11.glGetInteger(GL20.GL_MAX_TEXTURE_IMAGE_UNITS);
|
||||||
max_texture_units = temp.get(0);
|
else if (caps.OpenGL13 || caps.GL_ARB_multitexture)
|
||||||
} else if (caps.OpenGL13 || caps.GL_ARB_multitexture) {
|
max_texture_units = GL11.glGetInteger(GL13.GL_MAX_TEXTURE_UNITS);
|
||||||
GL11.glGetInteger(GL13.GL_MAX_TEXTURE_UNITS, temp);
|
else
|
||||||
max_texture_units = temp.get(0);
|
|
||||||
} else
|
|
||||||
max_texture_units = 1;
|
max_texture_units = 1;
|
||||||
glTexCoordPointer_buffer = new Buffer[max_texture_units];
|
glTexCoordPointer_buffer = new Buffer[max_texture_units];
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,14 +106,10 @@ public final class Display {
|
||||||
/** Swap interval */
|
/** Swap interval */
|
||||||
private static int 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 */
|
/** 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;
|
private static boolean parent_resized;
|
||||||
|
|
||||||
|
@ -137,31 +133,20 @@ public final class Display {
|
||||||
} catch (LWJGLException e) {
|
} catch (LWJGLException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
drawable = new Drawable() {
|
drawable = new AbstractDrawable() {
|
||||||
public Context getContext() {
|
|
||||||
synchronized ( GlobalLock.lock ) {
|
|
||||||
return isCreated() ? context : null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void makeCurrent() throws LWJGLException {
|
|
||||||
Display.makeCurrent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void releaseContext() throws LWJGLException {
|
|
||||||
Display.releaseContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
Display.destroy();
|
synchronized ( GlobalLock.lock ) {
|
||||||
|
if ( !isCreated() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
releaseDrawable();
|
||||||
|
super.destroy();
|
||||||
|
destroyWindow();
|
||||||
|
x = y = -1;
|
||||||
|
cached_icons = null;
|
||||||
|
reset();
|
||||||
|
removeShutdownHook();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -258,24 +243,23 @@ public final class Display {
|
||||||
* @throws LWJGLException if the display mode could not be set
|
* @throws LWJGLException if the display mode could not be set
|
||||||
*/
|
*/
|
||||||
public static void setDisplayMode(DisplayMode mode) throws LWJGLException {
|
public static void setDisplayMode(DisplayMode mode) throws LWJGLException {
|
||||||
synchronized (GlobalLock.lock) {
|
synchronized ( GlobalLock.lock ) {
|
||||||
if (mode == null)
|
if ( mode == null )
|
||||||
throw new NullPointerException("mode must be non-null");
|
throw new NullPointerException("mode must be non-null");
|
||||||
boolean was_fullscreen = isFullscreen();
|
boolean was_fullscreen = isFullscreen();
|
||||||
current_mode = mode;
|
current_mode = mode;
|
||||||
if (isCreated()) {
|
if ( isCreated() ) {
|
||||||
destroyWindow();
|
destroyWindow();
|
||||||
// If mode is not fullscreen capable, make sure we are in windowed mode
|
// If mode is not fullscreen capable, make sure we are in windowed mode
|
||||||
try {
|
try {
|
||||||
if (was_fullscreen && !isFullscreen())
|
if ( was_fullscreen && !isFullscreen() )
|
||||||
display_impl.resetDisplayMode();
|
display_impl.resetDisplayMode();
|
||||||
else if (isFullscreen())
|
else if ( isFullscreen() )
|
||||||
switchDisplayMode();
|
switchDisplayMode();
|
||||||
createWindow();
|
createWindow();
|
||||||
makeCurrentAndSetSwapInterval();
|
makeCurrentAndSetSwapInterval();
|
||||||
} catch (LWJGLException e) {
|
} catch (LWJGLException e) {
|
||||||
destroyContext();
|
drawable.destroy();
|
||||||
destroyPeerInfo();
|
|
||||||
display_impl.resetDisplayMode();
|
display_impl.resetDisplayMode();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
@ -288,9 +272,9 @@ public final class Display {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getWindowX() {
|
private static int getWindowX() {
|
||||||
if (!isFullscreen() && parent == null) {
|
if ( !isFullscreen() && parent == null ) {
|
||||||
// if no display location set, center window
|
// if no display location set, center window
|
||||||
if (x == -1) {
|
if ( x == -1 ) {
|
||||||
return Math.max(0, (initial_mode.getWidth() - current_mode.getWidth()) / 2);
|
return Math.max(0, (initial_mode.getWidth() - current_mode.getWidth()) / 2);
|
||||||
} else {
|
} else {
|
||||||
return x;
|
return x;
|
||||||
|
@ -301,7 +285,7 @@ public final class Display {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getWindowY() {
|
private static int getWindowY() {
|
||||||
if (!isFullscreen() && parent == null) {
|
if ( !isFullscreen() && parent == null ) {
|
||||||
// if no display location set, center window
|
// if no display location set, center window
|
||||||
if ( y == -1 ) {
|
if ( y == -1 ) {
|
||||||
return Math.max(0, (initial_mode.getHeight() - current_mode.getHeight()) / 2);
|
return Math.max(0, (initial_mode.getHeight() - current_mode.getHeight()) / 2);
|
||||||
|
@ -344,6 +328,7 @@ public final class Display {
|
||||||
|
|
||||||
private static void releaseDrawable() {
|
private static void releaseDrawable() {
|
||||||
try {
|
try {
|
||||||
|
Context context = drawable.context;
|
||||||
if ( context != null && context.isCurrent() ) {
|
if ( context != null && context.isCurrent() ) {
|
||||||
Context.releaseCurrentContext();
|
Context.releaseCurrentContext();
|
||||||
context.releaseDrawable();
|
context.releaseDrawable();
|
||||||
|
@ -483,13 +468,13 @@ public final class Display {
|
||||||
*/
|
*/
|
||||||
public static void setParent(Canvas parent) throws LWJGLException {
|
public static void setParent(Canvas parent) throws LWJGLException {
|
||||||
synchronized ( GlobalLock.lock ) {
|
synchronized ( GlobalLock.lock ) {
|
||||||
if (Display.parent != parent) {
|
if ( Display.parent != parent ) {
|
||||||
Display.parent = parent;
|
Display.parent = parent;
|
||||||
if ( !isCreated() )
|
if ( !isCreated() )
|
||||||
return;
|
return;
|
||||||
destroyWindow();
|
destroyWindow();
|
||||||
try {
|
try {
|
||||||
if (isFullscreen()) {
|
if ( isFullscreen() ) {
|
||||||
switchDisplayMode();
|
switchDisplayMode();
|
||||||
} else {
|
} else {
|
||||||
display_impl.resetDisplayMode();
|
display_impl.resetDisplayMode();
|
||||||
|
@ -497,8 +482,7 @@ public final class Display {
|
||||||
createWindow();
|
createWindow();
|
||||||
makeCurrentAndSetSwapInterval();
|
makeCurrentAndSetSwapInterval();
|
||||||
} catch (LWJGLException e) {
|
} catch (LWJGLException e) {
|
||||||
destroyContext();
|
drawable.destroy();
|
||||||
destroyPeerInfo();
|
|
||||||
display_impl.resetDisplayMode();
|
display_impl.resetDisplayMode();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
@ -539,18 +523,18 @@ public final class Display {
|
||||||
|
|
||||||
private static void setDisplayModeAndFullscreenInternal(boolean fullscreen, DisplayMode mode) throws LWJGLException {
|
private static void setDisplayModeAndFullscreenInternal(boolean fullscreen, DisplayMode mode) throws LWJGLException {
|
||||||
synchronized ( GlobalLock.lock ) {
|
synchronized ( GlobalLock.lock ) {
|
||||||
if (mode == null)
|
if ( mode == null )
|
||||||
throw new NullPointerException("mode must be non-null");
|
throw new NullPointerException("mode must be non-null");
|
||||||
DisplayMode old_mode = current_mode;
|
DisplayMode old_mode = current_mode;
|
||||||
current_mode = mode;
|
current_mode = mode;
|
||||||
boolean was_fullscreen = isFullscreen();
|
boolean was_fullscreen = isFullscreen();
|
||||||
Display.fullscreen = fullscreen;
|
Display.fullscreen = fullscreen;
|
||||||
if (was_fullscreen != isFullscreen() || !mode.equals(old_mode)) {
|
if ( was_fullscreen != isFullscreen() || !mode.equals(old_mode) ) {
|
||||||
if (!isCreated())
|
if ( !isCreated() )
|
||||||
return;
|
return;
|
||||||
destroyWindow();
|
destroyWindow();
|
||||||
try {
|
try {
|
||||||
if (isFullscreen()) {
|
if ( isFullscreen() ) {
|
||||||
switchDisplayMode();
|
switchDisplayMode();
|
||||||
} else {
|
} else {
|
||||||
display_impl.resetDisplayMode();
|
display_impl.resetDisplayMode();
|
||||||
|
@ -558,8 +542,7 @@ public final class Display {
|
||||||
createWindow();
|
createWindow();
|
||||||
makeCurrentAndSetSwapInterval();
|
makeCurrentAndSetSwapInterval();
|
||||||
} catch (LWJGLException e) {
|
} catch (LWJGLException e) {
|
||||||
destroyContext();
|
drawable.destroy();
|
||||||
destroyPeerInfo();
|
|
||||||
display_impl.resetDisplayMode();
|
display_impl.resetDisplayMode();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
@ -569,7 +552,7 @@ public final class Display {
|
||||||
|
|
||||||
/** @return whether the Display is in fullscreen mode */
|
/** @return whether the Display is in fullscreen mode */
|
||||||
public static boolean isFullscreen() {
|
public static boolean isFullscreen() {
|
||||||
synchronized (GlobalLock.lock) {
|
synchronized ( GlobalLock.lock ) {
|
||||||
return fullscreen && current_mode.isFullscreenCapable();
|
return fullscreen && current_mode.isFullscreenCapable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -671,7 +654,6 @@ public final class Display {
|
||||||
* Update the window. If the window is visible clears
|
* Update the window. If the window is visible clears
|
||||||
* the dirty flag and calls swapBuffers() and finally
|
* the dirty flag and calls swapBuffers() and finally
|
||||||
* polls the input devices.
|
* polls the input devices.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public static void update() {
|
public static void update() {
|
||||||
update(true);
|
update(true);
|
||||||
|
@ -730,12 +712,12 @@ public final class Display {
|
||||||
* @throws LWJGLException If the context could not be released
|
* @throws LWJGLException If the context could not be released
|
||||||
*/
|
*/
|
||||||
public static void releaseContext() throws LWJGLException {
|
public static void releaseContext() throws LWJGLException {
|
||||||
synchronized ( GlobalLock.lock ) {
|
drawable.releaseContext();
|
||||||
if ( !isCreated() )
|
}
|
||||||
throw new IllegalStateException("Display is not created");
|
|
||||||
if ( context.isCurrent() )
|
/** Returns true if the Display's context is current in the current thread. */
|
||||||
Context.releaseCurrentContext();
|
public static boolean isCurrent() throws LWJGLException {
|
||||||
}
|
return drawable.isCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -744,11 +726,7 @@ public final class Display {
|
||||||
* @throws LWJGLException If the context could not be made current
|
* @throws LWJGLException If the context could not be made current
|
||||||
*/
|
*/
|
||||||
public static void makeCurrent() throws LWJGLException {
|
public static void makeCurrent() throws LWJGLException {
|
||||||
synchronized ( GlobalLock.lock ) {
|
drawable.makeCurrent();
|
||||||
if ( !isCreated() )
|
|
||||||
throw new IllegalStateException("Display is not created");
|
|
||||||
context.makeCurrent();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void removeShutdownHook() {
|
private static void removeShutdownHook() {
|
||||||
|
@ -868,19 +846,19 @@ public final class Display {
|
||||||
throw new NullPointerException("pixel_format cannot be null");
|
throw new NullPointerException("pixel_format cannot be null");
|
||||||
removeShutdownHook();
|
removeShutdownHook();
|
||||||
registerShutdownHook();
|
registerShutdownHook();
|
||||||
if (isFullscreen())
|
if ( isFullscreen() )
|
||||||
switchDisplayMode();
|
switchDisplayMode();
|
||||||
try {
|
try {
|
||||||
peer_info = display_impl.createPeerInfo(pixel_format);
|
drawable.peer_info = display_impl.createPeerInfo(pixel_format);
|
||||||
try {
|
try {
|
||||||
createWindow();
|
createWindow();
|
||||||
try {
|
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 {
|
try {
|
||||||
makeCurrentAndSetSwapInterval();
|
makeCurrentAndSetSwapInterval();
|
||||||
initContext();
|
initContext();
|
||||||
} catch (LWJGLException e) {
|
} catch (LWJGLException e) {
|
||||||
destroyContext();
|
drawable.destroy();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
} catch (LWJGLException e) {
|
} catch (LWJGLException e) {
|
||||||
|
@ -888,7 +866,7 @@ public final class Display {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
} catch (LWJGLException e) {
|
} catch (LWJGLException e) {
|
||||||
destroyPeerInfo();
|
drawable.destroy();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
} catch (LWJGLException e) {
|
} catch (LWJGLException e) {
|
||||||
|
@ -899,13 +877,13 @@ public final class Display {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the initial color of the Display. This method is called before the Display is created and will set the
|
* 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.
|
* background color to the one specified in this method.
|
||||||
*
|
*
|
||||||
* @param red - color value between 0 - 1
|
* @param red - color value between 0 - 1
|
||||||
* @param green - color value between 0 - 1
|
* @param green - color value between 0 - 1
|
||||||
* @param blue - color value between 0 - 1
|
* @param blue - color value between 0 - 1
|
||||||
*/
|
*/
|
||||||
public static void setInitialBackground(float red, float green, float blue) {
|
public static void setInitialBackground(float red, float green, float blue) {
|
||||||
r = red;
|
r = red;
|
||||||
g = green;
|
g = green;
|
||||||
|
@ -977,41 +955,14 @@ public final class Display {
|
||||||
* regardless of whether the Display was the current rendering context.
|
* regardless of whether the Display was the current rendering context.
|
||||||
*/
|
*/
|
||||||
public static void destroy() {
|
public static void destroy() {
|
||||||
synchronized ( GlobalLock.lock ) {
|
drawable.destroy();
|
||||||
if ( !isCreated() ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
releaseDrawable();
|
|
||||||
destroyContext();
|
|
||||||
destroyWindow();
|
|
||||||
destroyPeerInfo();
|
|
||||||
x = y = -1;
|
|
||||||
cached_icons = null;
|
|
||||||
reset();
|
|
||||||
removeShutdownHook();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
* Reset display mode if fullscreen. This method is also called from the shutdown hook added
|
||||||
* in the static constructor
|
* in the static constructor
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private static void reset() {
|
private static void reset() {
|
||||||
display_impl.resetDisplayMode();
|
display_impl.resetDisplayMode();
|
||||||
current_mode = initial_mode;
|
current_mode = initial_mode;
|
||||||
|
@ -1070,7 +1021,7 @@ public final class Display {
|
||||||
y = new_y;
|
y = new_y;
|
||||||
|
|
||||||
// offset if already created
|
// offset if already created
|
||||||
if (isCreated() && !isFullscreen()) {
|
if ( isCreated() && !isFullscreen() ) {
|
||||||
reshape();
|
reshape();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,19 +42,8 @@ import org.lwjgl.LWJGLException;
|
||||||
|
|
||||||
public interface Drawable {
|
public interface Drawable {
|
||||||
|
|
||||||
/**
|
/** Returns true if the Drawable's context is current in the current thread. */
|
||||||
* [INTERNAL USE ONLY] Returns the Drawable's Context.
|
boolean isCurrent() throws LWJGLException;
|
||||||
*
|
|
||||||
* @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;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes the Drawable's context current in the current thread.
|
* Makes the Drawable's context current in the current thread.
|
||||||
|
@ -70,9 +59,7 @@ public interface Drawable {
|
||||||
*/
|
*/
|
||||||
void releaseContext() throws LWJGLException;
|
void releaseContext() throws LWJGLException;
|
||||||
|
|
||||||
/**
|
/** Destroys the Drawable. */
|
||||||
* Destroys the Drawable.
|
|
||||||
*/
|
|
||||||
void destroy();
|
void destroy();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package org.lwjgl.opengl;
|
||||||
|
|
||||||
|
import org.lwjgl.LWJGLException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Spasi
|
||||||
|
* @since 23 Áðñ 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;
|
||||||
|
|
||||||
|
}
|
|
@ -35,6 +35,7 @@ import java.nio.Buffer;
|
||||||
import java.nio.IntBuffer;
|
import java.nio.IntBuffer;
|
||||||
|
|
||||||
import org.lwjgl.BufferUtils;
|
import org.lwjgl.BufferUtils;
|
||||||
|
import org.lwjgl.LWJGLUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class to check buffer boundaries in GL methods. Many GL
|
* A class to check buffer boundaries in GL methods. Many GL
|
||||||
|
@ -60,93 +61,78 @@ class GLChecks {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int getBufferObjectSize(ContextCapabilities caps, int buffer_enum) {
|
static int getBufferObjectSize(ContextCapabilities caps, int buffer_enum) {
|
||||||
IntBuffer scratch_buffer = caps.scratch_int_buffer;
|
return GL15.glGetBufferParameter(buffer_enum, GL15.GL_BUFFER_SIZE);
|
||||||
GL15.glGetBufferParameter(buffer_enum, GL15.GL_BUFFER_SIZE, scratch_buffer);
|
|
||||||
return scratch_buffer.get(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int getBufferObjectSizeARB(ContextCapabilities caps, int buffer_enum) {
|
static int getBufferObjectSizeARB(ContextCapabilities caps, int buffer_enum) {
|
||||||
IntBuffer scratch_buffer = caps.scratch_int_buffer;
|
return ARBBufferObject.glGetBufferParameterARB(buffer_enum, ARBBufferObject.GL_BUFFER_SIZE_ARB);
|
||||||
ARBBufferObject.glGetBufferParameterARB(buffer_enum, ARBBufferObject.GL_BUFFER_SIZE_ARB, scratch_buffer);
|
|
||||||
return scratch_buffer.get(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int getBufferObjectSizeATI(ContextCapabilities caps, int buffer) {
|
static int getBufferObjectSizeATI(ContextCapabilities caps, int buffer) {
|
||||||
IntBuffer scratch_buffer = caps.scratch_int_buffer;
|
return ATIVertexArrayObject.glGetObjectBufferATI(buffer, ATIVertexArrayObject.GL_OBJECT_BUFFER_SIZE_ATI);
|
||||||
ATIVertexArrayObject.glGetObjectBufferATI(buffer, ATIVertexArrayObject.GL_OBJECT_BUFFER_SIZE_ATI, scratch_buffer);
|
|
||||||
return scratch_buffer.get(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int getNamedBufferObjectSize(ContextCapabilities caps, int buffer) {
|
static int getNamedBufferObjectSize(ContextCapabilities caps, int buffer) {
|
||||||
IntBuffer scratch_buffer = caps.scratch_int_buffer;
|
return EXTDirectStateAccess.glGetNamedBufferParameterEXT(buffer, GL15.GL_BUFFER_SIZE);
|
||||||
EXTDirectStateAccess.glGetNamedBufferParameterEXT(buffer, GL15.GL_BUFFER_SIZE, scratch_buffer);
|
|
||||||
return scratch_buffer.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
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 */
|
/** Helper method to ensure that array buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */
|
||||||
static void ensureArrayVBOdisabled(ContextCapabilities caps) {
|
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");
|
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 */
|
/** Helper method to ensure that array buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */
|
||||||
static void ensureArrayVBOenabled(ContextCapabilities caps) {
|
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");
|
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 */
|
/** 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) {
|
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");
|
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 */
|
/** 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) {
|
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");
|
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 */
|
/** Helper method to ensure that array buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */
|
||||||
static void ensureIndirectBOdisabled(ContextCapabilities caps) {
|
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");
|
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 */
|
/** Helper method to ensure that array buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */
|
||||||
static void ensureIndirectBOenabled(ContextCapabilities caps) {
|
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");
|
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 */
|
/** 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) {
|
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");
|
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 */
|
/** 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) {
|
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");
|
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 */
|
/** 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) {
|
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");
|
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 */
|
/** 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) {
|
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");
|
throw new OpenGLException("Cannot use offsets when Pixel Unpack Buffer Object is disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,19 +148,19 @@ class GLChecks {
|
||||||
* @return the size, in elements, of the image
|
* @return the size, in elements, of the image
|
||||||
*/
|
*/
|
||||||
static int calculateImageStorage(Buffer buffer, int format, int type, int width, int height, int depth) {
|
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) {
|
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) {
|
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) {
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -78,7 +78,7 @@ final class MacOSXDisplay implements DisplayImplementation {
|
||||||
AccessController.doPrivileged(new PrivilegedExceptionAction() {
|
AccessController.doPrivileged(new PrivilegedExceptionAction() {
|
||||||
public Object run() throws Exception {
|
public Object run() throws Exception {
|
||||||
Application.getApplication().addApplicationListener(new ApplicationAdapter() {
|
Application.getApplication().addApplicationListener(new ApplicationAdapter() {
|
||||||
public final void handleQuit(ApplicationEvent event) {
|
public void handleQuit(ApplicationEvent event) {
|
||||||
doHandleQuit();
|
doHandleQuit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -271,15 +271,16 @@ final class MacOSXDisplay implements DisplayImplementation {
|
||||||
*
|
*
|
||||||
* - elias
|
* - elias
|
||||||
*/
|
*/
|
||||||
|
AbstractDrawable drawable = (AbstractDrawable)Display.getDrawable();
|
||||||
if (Display.isFullscreen() && (frame != null && frame.getCanvas().syncCanvasPainted() || should_update)) {
|
if (Display.isFullscreen() && (frame != null && frame.getCanvas().syncCanvasPainted() || should_update)) {
|
||||||
try {
|
try {
|
||||||
MacOSXContextImplementation.resetView(Display.getDrawable().getContext().getPeerInfo(), Display.getDrawable().getContext());
|
MacOSXContextImplementation.resetView(drawable.peer_info, drawable.context);
|
||||||
} catch (LWJGLException e) {
|
} catch (LWJGLException e) {
|
||||||
LWJGLUtil.log("Failed to reset context: " + e);
|
LWJGLUtil.log("Failed to reset context: " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (should_update) {
|
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 */
|
/* This is necessary to make sure the context won't "forget" about the view size */
|
||||||
GL11.glGetInteger(GL11.GL_VIEWPORT, current_viewport);
|
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));
|
GL11.glViewport(current_viewport.get(0), current_viewport.get(1), current_viewport.get(2), current_viewport.get(3));
|
||||||
|
|
|
@ -35,7 +35,6 @@ import java.nio.IntBuffer;
|
||||||
|
|
||||||
import org.lwjgl.BufferUtils;
|
import org.lwjgl.BufferUtils;
|
||||||
import org.lwjgl.LWJGLException;
|
import org.lwjgl.LWJGLException;
|
||||||
import org.lwjgl.LWJGLUtil;
|
|
||||||
import org.lwjgl.Sys;
|
import org.lwjgl.Sys;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,7 +48,7 @@ import org.lwjgl.Sys;
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
* $Id$
|
* $Id$
|
||||||
*/
|
*/
|
||||||
public final class Pbuffer implements Drawable {
|
public final class Pbuffer extends AbstractDrawable {
|
||||||
/**
|
/**
|
||||||
* Indicates that Pbuffers can be created.
|
* Indicates that Pbuffers can be created.
|
||||||
*/
|
*/
|
||||||
|
@ -135,11 +134,6 @@ public final class Pbuffer implements Drawable {
|
||||||
*/
|
*/
|
||||||
public static final int DEPTH_BUFFER = RenderTexture.WGL_DEPTH_COMPONENT_NV;
|
public static final int DEPTH_BUFFER = RenderTexture.WGL_DEPTH_COMPONENT_NV;
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle to the native GL rendering context
|
|
||||||
*/
|
|
||||||
private final PeerInfo peer_info;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Width
|
* Width
|
||||||
*/
|
*/
|
||||||
|
@ -150,10 +144,6 @@ public final class Pbuffer implements Drawable {
|
||||||
*/
|
*/
|
||||||
private final int height;
|
private final int height;
|
||||||
|
|
||||||
private final Context context;
|
|
||||||
|
|
||||||
private boolean destroyed;
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Sys.initialize();
|
Sys.initialize();
|
||||||
}
|
}
|
||||||
|
@ -227,14 +217,11 @@ public final class Pbuffer implements Drawable {
|
||||||
this.width = width;
|
this.width = width;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
this.peer_info = createPbuffer(width, height, pixel_format, renderTexture);
|
this.peer_info = createPbuffer(width, height, pixel_format, renderTexture);
|
||||||
Context shared_context = null;
|
Context shared_context;
|
||||||
if (shared_drawable != null) {
|
if (shared_drawable != null)
|
||||||
shared_context = shared_drawable.getContext();
|
shared_context = ((DrawableLWJGL)shared_drawable).getContext();
|
||||||
} else {
|
else
|
||||||
Drawable display_drawable = Display.getDrawable();
|
shared_context = ((DrawableLWJGL)Display.getDrawable()).getContext(); // May be null
|
||||||
if (display_drawable != null)
|
|
||||||
shared_context = display_drawable.getContext();
|
|
||||||
}
|
|
||||||
this.context = new Context(peer_info, attribs, shared_context);
|
this.context = new Context(peer_info, attribs, shared_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,21 +238,6 @@ public final class Pbuffer implements Drawable {
|
||||||
renderTexture.pBufferAttribs);
|
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
|
* 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
|
* be used, but the results are undefined. The application is expected to release the buffer if needed, destroy it and recreate
|
||||||
|
@ -278,21 +250,6 @@ public final class Pbuffer implements Drawable {
|
||||||
return Display.getImplementation().isBufferLost(peer_info);
|
return Display.getImplementation().isBufferLost(peer_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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.
|
* Gets the Pbuffer capabilities.
|
||||||
*
|
*
|
||||||
|
@ -302,22 +259,6 @@ public final class Pbuffer implements Drawable {
|
||||||
return Display.getImplementation().getPbufferCapabilities();
|
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 -------------------------------
|
// ------------------------------- Render-to-Texture Methods -------------------------------
|
||||||
// -----------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
package org.lwjgl.opengl;
|
package org.lwjgl.opengl;
|
||||||
|
|
||||||
import org.lwjgl.LWJGLException;
|
import org.lwjgl.LWJGLException;
|
||||||
import org.lwjgl.LWJGLUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Spasi
|
* @author Spasi
|
||||||
|
@ -46,51 +45,14 @@ import org.lwjgl.LWJGLUtil;
|
||||||
*
|
*
|
||||||
* @author Spasi
|
* @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 {
|
public SharedDrawable(final Drawable drawable) throws LWJGLException {
|
||||||
this.context = drawable.createSharedContext();
|
this.context = ((DrawableLWJGL)drawable).createSharedContext();
|
||||||
}
|
|
||||||
|
|
||||||
public Context getContext() {
|
|
||||||
return context;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Context createSharedContext() {
|
public Context createSharedContext() {
|
||||||
throw new UnsupportedOperationException();
|
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");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -437,8 +437,9 @@ final class WindowsDisplay implements DisplayImplementation {
|
||||||
* is maximized helps some gfx cards recover from fullscreen
|
* is maximized helps some gfx cards recover from fullscreen
|
||||||
*/
|
*/
|
||||||
try {
|
try {
|
||||||
if (Display.getDrawable().getContext() != null && Display.getDrawable().getContext().isCurrent())
|
Context context = ((DrawableLWJGL)Display.getDrawable()).getContext();
|
||||||
Display.getDrawable().getContext().makeCurrent();
|
if (context != null && context.isCurrent())
|
||||||
|
context.makeCurrent();
|
||||||
} catch (LWJGLException e) {
|
} catch (LWJGLException e) {
|
||||||
LWJGLUtil.log("Exception occurred while trying to make context current: " + e);
|
LWJGLUtil.log("Exception occurred while trying to make context current: " + e);
|
||||||
}
|
}
|
||||||
|
@ -973,4 +974,4 @@ final class WindowsDisplay implements DisplayImplementation {
|
||||||
return "Rect: top = " + top + " bottom = " + bottom + " left = " + left + " right = " + right;
|
return "Rect: top = " + top + " bottom = " + bottom + " left = " + left + " right = " + right;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -78,8 +78,6 @@ abstract class BackgroundLoader {
|
||||||
|
|
||||||
System.out.println("** Sleeping, no texture created yet **");
|
System.out.println("** Sleeping, no texture created yet **");
|
||||||
|
|
||||||
long start = System.currentTimeMillis();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(2000);
|
Thread.sleep(2000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
|
|
@ -63,7 +63,6 @@ public class ContextCapabilitiesGenerator {
|
||||||
writer.println("public class " + Utils.CONTEXT_CAPS_CLASS_NAME + " {");
|
writer.println("public class " + Utils.CONTEXT_CAPS_CLASS_NAME + " {");
|
||||||
writer.println("\tstatic final boolean DEBUG = " + Boolean.toString(generate_error_checks) + ";");
|
writer.println("\tstatic final boolean DEBUG = " + Boolean.toString(generate_error_checks) + ";");
|
||||||
writer.println("\tfinal StateTracker tracker = new StateTracker();");
|
writer.println("\tfinal StateTracker tracker = new StateTracker();");
|
||||||
writer.println("\tfinal IntBuffer scratch_int_buffer = BufferUtils.createIntBuffer(16);");
|
|
||||||
writer.println();
|
writer.println();
|
||||||
if ( !context_specific ) {
|
if ( !context_specific ) {
|
||||||
writer.println("\tprivate static boolean " + STUBS_LOADED_NAME + " = false;");
|
writer.println("\tprivate static boolean " + STUBS_LOADED_NAME + " = false;");
|
||||||
|
|
|
@ -180,10 +180,7 @@ public class GeneratorVisitor extends SimpleDeclarationVisitor {
|
||||||
java_writer.println();
|
java_writer.println();
|
||||||
java_writer.println("package " + d.getPackage().getQualifiedName() + ";");
|
java_writer.println("package " + d.getPackage().getQualifiedName() + ";");
|
||||||
java_writer.println();
|
java_writer.println();
|
||||||
java_writer.println("import org.lwjgl.LWJGLException;");
|
java_writer.println("import org.lwjgl.*;");
|
||||||
java_writer.println("import org.lwjgl.BufferChecks;");
|
|
||||||
// DISABLED: indirect buffer support
|
|
||||||
//java_writer.println("import org.lwjgl.NondirectBufferWrapper;");
|
|
||||||
java_writer.println("import java.nio.*;");
|
java_writer.println("import java.nio.*;");
|
||||||
java_writer.println();
|
java_writer.println();
|
||||||
Utils.printDocComment(java_writer, d);
|
Utils.printDocComment(java_writer, d);
|
||||||
|
|
|
@ -261,9 +261,12 @@ public class JavaMethodsGenerator {
|
||||||
// DISABLED: indirect buffer support
|
// DISABLED: indirect buffer support
|
||||||
//printNondirectParameterCopies(writer, method, mode);
|
//printNondirectParameterCopies(writer, method, mode);
|
||||||
if (has_result) {
|
if (has_result) {
|
||||||
if ( method.getAnnotation(GLreturn.class) == null )
|
if ( method.getAnnotation(GLreturn.class) == null ) {
|
||||||
writer.println("\t\treturn " + Utils.RESULT_VAR_NAME + ";");
|
if ( ByteBuffer.class.equals(Utils.getJavaType(result_type)) )
|
||||||
else
|
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));
|
Utils.printGLReturnPost(writer, method, method.getAnnotation(GLreturn.class));
|
||||||
}
|
}
|
||||||
writer.println("\t}");
|
writer.println("\t}");
|
||||||
|
@ -490,7 +493,7 @@ public class JavaMethodsGenerator {
|
||||||
cachedReference != null &&
|
cachedReference != null &&
|
||||||
(mode != Mode.BUFFEROBJECT || param.getAnnotation(BufferObject.class) == null) &&
|
(mode != Mode.BUFFEROBJECT || param.getAnnotation(BufferObject.class) == null) &&
|
||||||
param.getAnnotation(Result.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) {
|
if(cachedReference.name().length() > 0) {
|
||||||
writer.print(cachedReference.name());
|
writer.print(cachedReference.name());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -71,6 +71,11 @@ public interface ATI_vertex_array_object {
|
||||||
@StripPostfix("params")
|
@StripPostfix("params")
|
||||||
void glGetObjectBufferivATI(@GLuint int buffer, @GLenum int pname, @OutParameter @Check IntBuffer 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 glFreeObjectBufferATI(@GLuint int buffer);
|
||||||
|
|
||||||
void glArrayObjectATI(@GLenum int array, int size, @GLenum int type, @GLsizei int stride, @GLuint int buffer, @GLuint int offset);
|
void glArrayObjectATI(@GLenum int array, int size, @GLenum int type, @GLsizei int stride, @GLuint int buffer, @GLuint int offset);
|
||||||
|
|
Loading…
Reference in New Issue