|
From: <sp...@us...> - 2008-08-19 16:46:22
|
Revision: 3116
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3116&view=rev
Author: spasi
Date: 2008-08-19 16:46:03 +0000 (Tue, 19 Aug 2008)
Log Message:
-----------
Added support for OpenGL 3.0 functionality
Added support for OpenGL 3.0 context creation (MAJOR/MINOR versions, DEBUG mode, FORWARD_COMBATIBLE mode)
Added support for OpenGL 3.0 context sharing
Added support for OpenGL 3.0 extension detection
Improved support for floating point PixelFormats (ARB_color_buffer_float)
Added support for packed floating point PixelFormats (EXT_packed_float)
Added support for sRGB PixelFormats (ARB_framebuffer_sRGB)
Added support for pseudo-FORWARD_COMBATIBLE mode (deprecated functions not loaded)
Added support for EXT_direct_state_access
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java
trunk/LWJGL/src/java/org/lwjgl/NondirectBufferWrapper.java
trunk/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java
trunk/LWJGL/src/java/org/lwjgl/opengl/AWTSurfaceLock.java
trunk/LWJGL/src/java/org/lwjgl/opengl/AWTUtil.java
trunk/LWJGL/src/java/org/lwjgl/opengl/Context.java
trunk/LWJGL/src/java/org/lwjgl/opengl/ContextImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
trunk/LWJGL/src/java/org/lwjgl/opengl/DisplayImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java
trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java
trunk/LWJGL/src/java/org/lwjgl/opengl/KeyboardEventQueue.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxAWTGLCanvasPeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxContextImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplayPeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxEvent.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxKeyboard.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxMouse.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxPbufferPeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxPeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXAWTGLCanvasPeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXCanvasListener.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXCanvasPeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXContextImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplayPeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXPbufferPeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXPeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/opengl/Pbuffer.java
trunk/LWJGL/src/java/org/lwjgl/opengl/PeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/opengl/PixelFormat.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsAWTGLCanvasPeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsContextImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplayPeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsFileVersion.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsKeyboard.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsMouse.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsPbufferPeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsPeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextGeneratorProcessorFactory.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
trunk/LWJGL/src/native/linux/context.c
trunk/LWJGL/src/native/linux/extgl_glx.c
trunk/LWJGL/src/native/linux/extgl_glx.h
trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxContextImplementation.c
trunk/LWJGL/src/native/macosx/context.m
trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXContextImplementation.m
trunk/LWJGL/src/native/windows/context.c
trunk/LWJGL/src/native/windows/context.h
trunk/LWJGL/src/native/windows/extgl_wgl.c
trunk/LWJGL/src/native/windows/extgl_wgl.h
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsContextImplementation.c
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsPeerInfo.c
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_imaging.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_window_pos.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_secondary_color.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_transform_feedback.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL13.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL14.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_conditional_render.java
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxContextAttribs.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXContextAttribs.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsContextAttribs.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/Dependent.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/DeprecatedGL.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLtime.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL30.java
Modified: trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2008-08-12 21:02:06 UTC (rev 3115)
+++ trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2008-08-19 16:46:03 UTC (rev 3116)
@@ -57,11 +57,6 @@
}
/**
- * Default buffer size for most buffer checks.
- */
- private static final int DEFAULT_BUFFER_SIZE = 4;
-
- /**
* Helper methods to ensure a function pointer is not-null (0)
*/
public static void checkFunctionAddress(long pointer) {
@@ -129,7 +124,7 @@
private static void throwBufferSizeException(Buffer buf, int size) {
throw new IllegalArgumentException("Number of remaining buffer elements is " + buf.remaining() + ", must be at least " + size);
}
-
+
/**
* Helper method to ensure a buffer is big enough to receive data from a
* glGet* operation.
Modified: trunk/LWJGL/src/java/org/lwjgl/NondirectBufferWrapper.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/NondirectBufferWrapper.java 2008-08-12 21:02:06 UTC (rev 3115)
+++ trunk/LWJGL/src/java/org/lwjgl/NondirectBufferWrapper.java 2008-08-19 16:46:03 UTC (rev 3116)
@@ -52,7 +52,7 @@
private final static int INITIAL_BUFFER_SIZE = 1;
private final static ThreadLocal thread_buffer = new ThreadLocal() {
- protected final Object initialValue() {
+ protected Object initialValue() {
return new CachedBuffers(INITIAL_BUFFER_SIZE);
}
};
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java 2008-08-12 21:02:06 UTC (rev 3115)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java 2008-08-19 16:46:03 UTC (rev 3116)
@@ -31,33 +31,29 @@
*/
package org.lwjgl.opengl;
-import java.awt.Canvas;
-import java.awt.Dimension;
-import java.awt.Graphics;
-import java.awt.GraphicsDevice;
-import java.awt.GraphicsEnvironment;
-import java.awt.Point;
+import org.lwjgl.LWJGLException;
+import org.lwjgl.LWJGLUtil;
+import org.lwjgl.Sys;
+
+import java.awt.*;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.event.HierarchyEvent;
import java.awt.event.HierarchyListener;
-import org.lwjgl.LWJGLException;
-import org.lwjgl.LWJGLUtil;
-import org.lwjgl.Sys;
-
/**
- * <p>
+ * <p/>
* An AWT rendering context.
- * <p>
- * @version $Revision$
+ * <p/>
+ *
* @author $Author$
- * $Id$
+ * $Id$
+ * @version $Revision$
*/
public class AWTGLCanvas extends Canvas implements Drawable, ComponentListener, HierarchyListener {
private static final long serialVersionUID = 1L;
-
+
private final static AWTCanvasImplementation implementation;
private boolean update_context;
private Object SYNC_LOCK = new Object();
@@ -67,7 +63,10 @@
/** The drawable to share context with */
private final Drawable drawable;
-
+
+ /** The ContextAttribs to use when creating the context */
+ private final ContextAttribs attribs;
+
/** Context handle */
private PeerInfo peer_info;
private Context context;
@@ -87,7 +86,7 @@
}
static AWTCanvasImplementation createImplementation() {
- switch (LWJGLUtil.getPlatform()) {
+ switch ( LWJGLUtil.getPlatform() ) {
case LWJGLUtil.PLATFORM_LINUX:
return new LinuxCanvasImplementation();
case LWJGLUtil.PLATFORM_WINDOWS:
@@ -100,25 +99,21 @@
}
private void setUpdate() {
- synchronized(SYNC_LOCK) {
+ synchronized ( SYNC_LOCK ) {
update_context = true;
}
}
- /**
- * This method should only be called internally.
- */
+ /** This method should only be called internally. */
public Context getContext() {
return context;
}
-
- /**
- * Constructor using the default PixelFormat.
- */
+
+ /** Constructor using the default PixelFormat. */
public AWTGLCanvas() throws LWJGLException {
this(new PixelFormat());
}
-
+
/**
* Create an AWTGLCanvas with the requested PixelFormat on the default GraphicsDevice.
*
@@ -131,7 +126,7 @@
/**
* Create an AWTGLCanvas with the requested PixelFormat on the default GraphicsDevice.
*
- * @param device the device to create the canvas on.
+ * @param device the device to create the canvas on.
* @param pixel_format The desired pixel format. May not be null
*/
public AWTGLCanvas(GraphicsDevice device, PixelFormat pixel_format) throws LWJGLException {
@@ -141,94 +136,99 @@
/**
* Create an AWTGLCanvas with the requested PixelFormat on the specified GraphicsDevice.
*
- * @param device the device to create the canvas on.
+ * @param device the device to create the canvas on.
* @param pixel_format The desired pixel format. May not be null
- * @param drawable The Drawable to share context with
+ * @param drawable The Drawable to share context with
*/
public AWTGLCanvas(GraphicsDevice device, PixelFormat pixel_format, Drawable drawable) throws LWJGLException {
+ this(device, pixel_format, drawable, null);
+ }
+
+ /**
+ * Create an AWTGLCanvas with the requested PixelFormat on the specified GraphicsDevice.
+ *
+ * @param device the device to create the canvas on.
+ * @param pixel_format The desired pixel format. May not be null
+ * @param drawable The Drawable to share context with
+ * @param attribs The ContextAttribs to use when creating the context. (optional, may be null)
+ */
+ public AWTGLCanvas(GraphicsDevice device, PixelFormat pixel_format, Drawable drawable, ContextAttribs attribs) throws LWJGLException {
super(implementation.findConfiguration(device, pixel_format));
- if (pixel_format == null)
+ if ( pixel_format == null )
throw new NullPointerException("Pixel format must be non-null");
addHierarchyListener(this);
addComponentListener(this);
this.drawable = drawable;
this.pixel_format = pixel_format;
+ this.attribs = attribs;
}
-
+
/* (non-Javadoc)
- * @see java.awt.Canvas#addNotify()
- */
+ * @see java.awt.Canvas#addNotify()
+ */
public void addNotify() {
super.addNotify();
}
-
+
/* (non-Javadoc)
- * @see java.awt.Component#removeNotify()
- */
+ * @see java.awt.Component#removeNotify()
+ */
public void removeNotify() {
- synchronized (SYNC_LOCK) {
+ synchronized ( SYNC_LOCK ) {
destroyContext();
super.removeNotify();
}
- }
-
- /**
- * Set swap interval.
- */
+ }
+
+ /** Set swap interval. */
public void setSwapInterval(int swap_interval) {
- synchronized(SYNC_LOCK) {
- if (context == null)
+ synchronized ( SYNC_LOCK ) {
+ if ( context == null )
throw new IllegalStateException("Canvas not yet displayable");
Context.setSwapInterval(swap_interval);
}
}
-
- /**
- * Enable vsync
- */
+
+ /** Enable vsync */
public void setVSyncEnabled(boolean enabled) {
setSwapInterval(enabled ? 1 : 0);
}
-
- /**
- * Swap the canvas' buffer
- */
+
+ /** Swap the canvas' buffer */
public void swapBuffers() throws LWJGLException {
- synchronized(SYNC_LOCK) {
- if (context == null)
+ synchronized ( SYNC_LOCK ) {
+ if ( context == null )
throw new IllegalStateException("Canvas not yet displayable");
Context.swapBuffers();
}
}
-
+
public void releaseContext() throws LWJGLException {
- synchronized(SYNC_LOCK) {
- if (context == null)
+ synchronized ( SYNC_LOCK ) {
+ if ( context == null )
throw new IllegalStateException("Canvas not yet displayable");
- if (context.isCurrent())
+ if ( context.isCurrent() )
Context.releaseCurrentContext();
}
}
-
+
/**
* Make the canvas' context current. It is highly recommended that the context
* is only made current inside the AWT thread (for example in an overridden paintGL()).
*/
public void makeCurrent() throws LWJGLException {
- synchronized(SYNC_LOCK) {
- if (context == null)
+ synchronized ( SYNC_LOCK ) {
+ if ( context == null )
throw new IllegalStateException("Canvas not yet displayable");
context.makeCurrent();
}
}
-
- /**
- * Destroy the OpenGL context. This happens when the component becomes undisplayable
- */
+
+ /** Destroy the OpenGL context. This happens when the component becomes undisplayable */
private void destroyContext() {
- synchronized(SYNC_LOCK) {
+ synchronized ( SYNC_LOCK ) {
try {
- if (context != null) {
+ if ( context != null ) {
context.forceDestroy();
context = null;
reentry_count = 0;
@@ -243,15 +243,13 @@
/**
* Override this to do initialising of the context.
- * It will be called once from paint(), immediately after
+ * It will be called once from paint(), immediately after
* the context is created and made current.
*/
protected void initGL() {
}
- /**
- * Override this to do painting
- */
+ /** Override this to do painting */
protected void paintGL() {
}
@@ -261,36 +259,36 @@
*/
public final void paint(Graphics g) {
LWJGLException exception = null;
- synchronized (SYNC_LOCK) {
- if (!isDisplayable())
+ synchronized ( SYNC_LOCK ) {
+ if ( !isDisplayable() )
return;
try {
- if (peer_info == null) {
+ if ( peer_info == null ) {
this.peer_info = implementation.createPeerInfo(this, pixel_format);
}
peer_info.lockAndGetHandle();
try {
- if (context == null) {
- this.context = new Context(peer_info, drawable != null ? drawable.getContext() : null);
+ if ( context == null ) {
+ this.context = new Context(peer_info, attribs, drawable != null ? drawable.getContext() : null);
first_run = true;
}
- if (reentry_count == 0)
+ if ( reentry_count == 0 )
context.makeCurrent();
reentry_count++;
try {
- if (update_context) {
+ if ( update_context ) {
context.update();
update_context = false;
}
- if (first_run) {
+ if ( first_run ) {
first_run = false;
initGL();
}
paintGL();
} finally {
reentry_count--;
- if (reentry_count == 0)
+ if ( reentry_count == 0 )
Context.releaseCurrentContext();
}
} finally {
@@ -300,7 +298,7 @@
exception = e;
}
}
- if (exception != null)
+ if ( exception != null )
exceptionOccurred(exception);
}
@@ -314,9 +312,7 @@
LWJGLUtil.log("Unhandled exception occurred, skipping paint(): " + exception);
}
- /**
- * override update to avoid clearing
- */
+ /** override update to avoid clearing */
public void update(Graphics g) {
paint(g);
}
@@ -363,4 +359,5 @@
public void hierarchyChanged(HierarchyEvent e) {
setUpdate();
}
-}
+
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/AWTSurfaceLock.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/AWTSurfaceLock.java 2008-08-12 21:02:06 UTC (rev 3115)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/AWTSurfaceLock.java 2008-08-19 16:46:03 UTC (rev 3116)
@@ -54,7 +54,7 @@
private boolean firstLockSucceeded = false;
- public AWTSurfaceLock() {
+ AWTSurfaceLock() {
lock_buffer = createHandle();
}
@@ -98,7 +98,7 @@
private static native boolean lockAndInitHandle(ByteBuffer lock_buffer, Canvas component) throws LWJGLException;
- protected void unlock() throws LWJGLException {
+ void unlock() throws LWJGLException {
nUnlock(lock_buffer);
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/AWTUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/AWTUtil.java 2008-08-12 21:02:06 UTC (rev 3115)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/AWTUtil.java 2008-08-19 16:46:03 UTC (rev 3116)
@@ -113,7 +113,7 @@
final GraphicsConfiguration config = component.getGraphicsConfiguration();
if (config != null) {
PointerInfo pointer_info = (PointerInfo)AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public final Object run() throws Exception {
+ public Object run() throws Exception {
return MouseInfo.getPointerInfo();
}
});
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/Context.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/Context.java 2008-08-12 21:02:06 UTC (rev 3115)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Context.java 2008-08-19 16:46:03 UTC (rev 3116)
@@ -31,43 +31,44 @@
*/
package org.lwjgl.opengl;
-import java.nio.ByteBuffer;
-
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.Sys;
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+
/**
* <p/>
* Context encapsulates an OpenGL context.
* <p/>
- *
+ * <p/>
* This class is thread-safe.
*
* @author elias_naur <eli...@us...>
* @version $Revision$
- * $Id$
+ * $Id$
*/
final class Context {
- /**
- * The platform specific implementation of context methods
- */
+
+ /** The platform specific implementation of context methods */
private final static ContextImplementation implementation;
/** The current Context */
private final static ThreadLocal current_context_local = new ThreadLocal();
-
- /**
- * Handle to the native GL rendering context
- */
+
+ /** Handle to the native GL rendering context */
private final ByteBuffer handle;
private final PeerInfo peer_info;
+ private final IntBuffer attribList;
+ private final boolean forwardCombatible;
+
/** Whether the context has been destroyed */
private boolean destroyed;
private boolean destroy_requested;
-
+
/** The thread that has this context current, or null. */
private Thread thread;
@@ -77,7 +78,7 @@
}
private static ContextImplementation createImplementation() {
- switch (LWJGLUtil.getPlatform()) {
+ switch ( LWJGLUtil.getPlatform() ) {
case LWJGLUtil.PLATFORM_LINUX:
return new LinuxContextImplementation();
case LWJGLUtil.PLATFORM_WINDOWS:
@@ -97,20 +98,26 @@
return (Context)current_context_local.get();
}
- /**
- * Create a context with the specified peer info and shared context
- */
- public Context(PeerInfo peer_info, Context shared_context) throws LWJGLException {
+ /** Create a context with the specified peer info and shared context */
+ Context(PeerInfo peer_info, ContextAttribs attribs, Context shared_context) throws LWJGLException {
Context context_lock = shared_context != null ? shared_context : this;
- // If shared_context is not null, synchronize on it to make sure it is not deleted
+ // If shared_context is not null, synchronize on it to make sure it is not deleted
// while this context is created. Otherwise, simply synchronize on ourself to avoid NPE
- synchronized (context_lock) {
- if (shared_context != null && shared_context.destroyed)
+ synchronized ( context_lock ) {
+ if ( shared_context != null && shared_context.destroyed )
throw new IllegalArgumentException("Shared context is destroyed");
GLContext.loadOpenGLLibrary();
try {
this.peer_info = peer_info;
- this.handle = implementation.create(peer_info, shared_context != null ? shared_context.handle : null);
+ if ( attribs != null ) {
+ attribList = attribs.getAttribList();
+ forwardCombatible = attribs.isForwardCombatible();
+ } else {
+ attribList = null;
+ forwardCombatible = false;
+ }
+
+ this.handle = implementation.create(peer_info, attribList, shared_context != null ? shared_context.handle : null);
} catch (LWJGLException e) {
GLContext.unloadOpenGLLibrary();
throw e;
@@ -118,16 +125,14 @@
}
}
- /**
- * Release the current context (if any). After this call, no context is current.
- */
+ /** Release the current context (if any). After this call, no context is current. */
public static void releaseCurrentContext() throws LWJGLException {
Context current_context = getCurrentContext();
- if (current_context != null) {
+ if ( current_context != null ) {
implementation.releaseCurrentContext();
GLContext.useContext(null);
current_context_local.set(null);
- synchronized (current_context) {
+ synchronized ( current_context ) {
current_context.thread = null;
current_context.checkDestroy();
}
@@ -141,64 +146,56 @@
* on every releaseCurrentContext results in artifacts.
*/
public synchronized void releaseDrawable() throws LWJGLException {
- if (destroyed)
+ if ( destroyed )
throw new IllegalStateException("Context is destroyed");
implementation.releaseDrawable(getHandle());
}
- /**
- * Update the context. Should be called whenever it's drawable is moved or resized
- */
+ /** Update the context. Should be called whenever it's drawable is moved or resized */
public synchronized void update() {
- if (destroyed)
+ if ( destroyed )
throw new IllegalStateException("Context is destroyed");
implementation.update(getHandle());
}
-
- /**
- * Swap the buffers on the current context. Only valid for double-buffered contexts
- */
+
+ /** Swap the buffers on the current context. Only valid for double-buffered contexts */
public static void swapBuffers() throws LWJGLException {
implementation.swapBuffers();
}
-
+
private boolean canAccess() {
return thread == null || Thread.currentThread() == thread;
}
private void checkAccess() {
- if (!canAccess())
+ if ( !canAccess() )
throw new IllegalStateException("From thread " + Thread.currentThread() + ": " + thread + " already has the context current");
}
- /**
- * Make the context current
- */
+ /** Make the context current */
public synchronized void makeCurrent() throws LWJGLException {
checkAccess();
- if (destroyed)
+ if ( destroyed )
throw new IllegalStateException("Context is destroyed");
thread = Thread.currentThread();
current_context_local.set(this);
implementation.makeCurrent(peer_info, handle);
- GLContext.useContext(this);
+ GLContext.useContext(this, forwardCombatible);
}
ByteBuffer getHandle() {
return handle;
}
- /**
- * Query whether the context is current
- */
+ /** Query whether the context is current */
public synchronized boolean isCurrent() throws LWJGLException {
- if (destroyed)
+ if ( destroyed )
throw new IllegalStateException("Context is destroyed");
return implementation.isCurrent(handle);
}
private void checkDestroy() {
- if (!destroyed && destroy_requested) {
+ if ( !destroyed && destroy_requested ) {
try {
releaseDrawable();
implementation.destroy(peer_info, handle);
@@ -215,16 +212,13 @@
* Set the buffer swap interval. This call is a best-attempt at changing
* the monitor swap interval, which is the minimum periodicity of color buffer swaps,
* measured in video frame periods, and is not guaranteed to be successful.
- *
+ * <p/>
* A video frame period is the time required to display a full frame of video data.
- *
- * @param sync true to synchronize; false to ignore synchronization
*/
public static void setSwapInterval(int value) {
implementation.setSwapInterval(value);
}
-
-
+
/**
* Destroy the context. This method behaves the same as destroy() with the extra
* requirement that the context must be either current to the current thread or not
@@ -234,24 +228,25 @@
checkAccess();
destroy();
}
-
+
/**
* Request destruction of the Context. If the context is current, no context will be current after this call.
* The context is destroyed when no thread has it current.
*/
public synchronized void destroy() throws LWJGLException {
- if (destroyed)
+ if ( destroyed )
return;
destroy_requested = true;
boolean was_current = isCurrent();
int error = GL11.GL_NO_ERROR;
- if (was_current) {
- if (GLContext.getCapabilities() != null && GLContext.getCapabilities().OpenGL11)
+ if ( was_current ) {
+ if ( GLContext.getCapabilities() != null && GLContext.getCapabilities().OpenGL11 )
error = GL11.glGetError();
releaseCurrentContext();
}
checkDestroy();
- if (was_current && error != GL11.GL_NO_ERROR)
+ if ( was_current && error != GL11.GL_NO_ERROR )
throw new OpenGLException(error);
}
-}
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java 2008-08-19 16:46:03 UTC (rev 3116)
@@ -0,0 +1,213 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengl;
+
+import org.lwjgl.BufferUtils;
+import org.lwjgl.LWJGLUtil;
+
+import java.nio.IntBuffer;
+
+/**
+ * This class represents the context attributes passed to CreateContextAttribs of the XGL_create_context extension.
+ * These attributes can be used to indicate at context creation which OpenGL interface will be used. This includes the
+ * OpenGL version, the layer plane on which rendering takes place and also optional debug and forward combatibility modes.
+ * (read the XGL_create_context spec for details)
+ * <p/>
+ * Use of this class is optional. If an OpenGL context is created without passing an instance of this class
+ * (or XGL_create_context is not supported), the old context creation code will be used. Use of ContextAttribs is required
+ * to create an OpenGL 3.0 or newer context. Support for debug and forward compatible mobes is not guaranteed by the OpenGL
+ * implementation. Developers may encounter debug contexts being the same as non-debug contexts or forward combatible
+ * contexts having support for deprecated functionality.
+ * <p/>
+ * Warning: This functionality is currently available on the Windows platform only. However, if the forwardCombatible
+ * attribute is used, LWJGL will not load the deprecated functionality (as defined in the OpenGL 3.0 specification). This
+ * means that developers can start working on cleaning up their applications without an OpenGL 3.0 complaint driver.
+ *
+ * @author spasi <sp...@us...>
+ */
+public abstract class ContextAttribs {
+
+ private int majorVersion;
+ private int minorVersion;
+
+ private int layerPlane;
+
+ private boolean debug;
+ private boolean forwardCombatible;
+
+ protected ContextAttribs(final int majorVersion, final int minorVersion) {
+ if ( majorVersion < 0 ||
+ 3 < majorVersion ||
+ minorVersion < 0 ||
+ (majorVersion == 3 && 0 < minorVersion) ||
+ (majorVersion == 2 && 1 < minorVersion) ||
+ (majorVersion == 1 && 5 < minorVersion) )
+ throw new IllegalArgumentException("Invalid OpenGL version specified: " + majorVersion + '.' + minorVersion);
+
+ this.majorVersion = majorVersion;
+ this.minorVersion = minorVersion;
+
+ this.layerPlane = 0;
+
+ this.debug = false;
+ this.forwardCombatible = false;
+ }
+
+ protected ContextAttribs(final ContextAttribs attribs) {
+ this.majorVersion = attribs.majorVersion;
+ this.minorVersion = attribs.minorVersion;
+
+ this.layerPlane = attribs.layerPlane;
+
+ this.debug = attribs.debug;
+ this.forwardCombatible = attribs.forwardCombatible;
+ }
+
+ public static ContextAt...
[truncated message content] |
|
From: <sp...@us...> - 2008-08-19 17:47:31
|
Revision: 3117
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3117&view=rev
Author: spasi
Date: 2008-08-19 17:47:24 +0000 (Tue, 19 Aug 2008)
Log Message:
-----------
ContextAttribs: changed factory to constructor initialization
Fixed compatible spelling
Small pbuffer fix
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/Context.java
trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java
trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxContextAttribs.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXContextAttribs.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsContextAttribs.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/DeprecatedGL.java
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Pbuffer.c
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribsImplementation.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/Context.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/Context.java 2008-08-19 16:46:03 UTC (rev 3116)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Context.java 2008-08-19 17:47:24 UTC (rev 3117)
@@ -62,7 +62,7 @@
private final PeerInfo peer_info;
private final IntBuffer attribList;
- private final boolean forwardCombatible;
+ private final boolean forwardCompatible;
/** Whether the context has been destroyed */
private boolean destroyed;
@@ -111,10 +111,10 @@
this.peer_info = peer_info;
if ( attribs != null ) {
attribList = attribs.getAttribList();
- forwardCombatible = attribs.isForwardCombatible();
+ forwardCompatible = attribs.isForwardCompatible();
} else {
attribList = null;
- forwardCombatible = false;
+ forwardCompatible = false;
}
this.handle = implementation.create(peer_info, attribList, shared_context != null ? shared_context.handle : null);
@@ -180,7 +180,7 @@
thread = Thread.currentThread();
current_context_local.set(this);
implementation.makeCurrent(peer_info, handle);
- GLContext.useContext(this, forwardCombatible);
+ GLContext.useContext(this, forwardCompatible);
}
ByteBuffer getHandle() {
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java 2008-08-19 16:46:03 UTC (rev 3116)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java 2008-08-19 17:47:24 UTC (rev 3117)
@@ -45,16 +45,16 @@
* Use of this class is optional. If an OpenGL context is created without passing an instance of this class
* (or XGL_create_context is not supported), the old context creation code will be used. Use of ContextAttribs is required
* to create an OpenGL 3.0 or newer context. Support for debug and forward compatible mobes is not guaranteed by the OpenGL
- * implementation. Developers may encounter debug contexts being the same as non-debug contexts or forward combatible
+ * implementation. Developers may encounter debug contexts being the same as non-debug contexts or forward compatible
* contexts having support for deprecated functionality.
* <p/>
- * Warning: This functionality is currently available on the Windows platform only. However, if the forwardCombatible
+ * Warning: This functionality is currently available on the Windows platform only. However, if the forwardCompatible
* attribute is used, LWJGL will not load the deprecated functionality (as defined in the OpenGL 3.0 specification). This
* means that developers can start working on cleaning up their applications without an OpenGL 3.0 complaint driver.
*
* @author spasi <sp...@us...>
*/
-public abstract class ContextAttribs {
+public final class ContextAttribs {
private int majorVersion;
private int minorVersion;
@@ -62,9 +62,13 @@
private int layerPlane;
private boolean debug;
- private boolean forwardCombatible;
+ private boolean forwardCompatible;
- protected ContextAttribs(final int majorVersion, final int minorVersion) {
+ public ContextAttribs() {
+ this(1, 0);
+ }
+
+ public ContextAttribs(final int majorVersion, final int minorVersion) {
if ( majorVersion < 0 ||
3 < majorVersion ||
minorVersion < 0 ||
@@ -79,103 +83,76 @@
this.layerPlane = 0;
this.debug = false;
- this.forwardCombatible = false;
+ this.forwardCompatible = false;
}
- protected ContextAttribs(final ContextAttribs attribs) {
+ private ContextAttribs(final ContextAttribs attribs) {
this.majorVersion = attribs.majorVersion;
this.minorVersion = attribs.minorVersion;
this.layerPlane = attribs.layerPlane;
this.debug = attribs.debug;
- this.forwardCombatible = attribs.forwardCombatible;
+ this.forwardCompatible = attribs.forwardCompatible;
}
- public static ContextAttribs create() {
- return create(1, 0);
- }
-
- public static ContextAttribs create(final int majorVersion, final int minorVersion) {
- switch ( LWJGLUtil.getPlatform() ) {
- case LWJGLUtil.PLATFORM_LINUX:
- return new LinuxContextAttribs(majorVersion, minorVersion);
- case LWJGLUtil.PLATFORM_WINDOWS:
- return new WindowsContextAttribs(majorVersion, minorVersion);
- case LWJGLUtil.PLATFORM_MACOSX:
- return new MacOSXContextAttribs(majorVersion, minorVersion);
- default:
- throw new IllegalStateException("Unsupported platform");
- }
- }
-
- private static ContextAttribs create(final ContextAttribs attribs) {
- switch ( LWJGLUtil.getPlatform() ) {
- case LWJGLUtil.PLATFORM_LINUX:
- return new LinuxContextAttribs(attribs);
- case LWJGLUtil.PLATFORM_WINDOWS:
- return new WindowsContextAttribs(attribs);
- case LWJGLUtil.PLATFORM_MACOSX:
- return new MacOSXContextAttribs(attribs);
- default:
- throw new IllegalStateException("Unsupported platform");
- }
- }
-
- public final int getMajorVersion() {
+ public int getMajorVersion() {
return majorVersion;
}
- public final int getMinorVersion() {
+ public int getMinorVersion() {
return minorVersion;
}
- public final int getLayerPlane() {
+ public int getLayerPlane() {
return layerPlane;
}
- public final boolean isDebug() {
+ public boolean isDebug() {
return debug;
}
- public final boolean isForwardCombatible() {
- return forwardCombatible;
+ public boolean isForwardCompatible() {
+ return forwardCompatible;
}
- public final ContextAttribs withLayer(final int layerPlane) {
+ public ContextAttribs withLayer(final int layerPlane) {
if ( layerPlane < 0 )
throw new IllegalArgumentException("Invalid layer plane specified: " + layerPlane);
- final ContextAttribs attribs = create(this);
+ final ContextAttribs attribs = new ContextAttribs(this);
attribs.layerPlane = layerPlane;
return attribs;
}
- public final ContextAttribs withDebug(final boolean debug) {
- final ContextAttribs attribs = create(this);
+ public ContextAttribs withDebug(final boolean debug) {
+ final ContextAttribs attribs = new ContextAttribs(this);
attribs.debug = debug;
return attribs;
}
- public final ContextAttribs withForwardCombatible(final boolean forwardCombatible) {
- final ContextAttribs attribs = create(this);
- attribs.forwardCombatible = forwardCombatible;
+ public ContextAttribs withForwardCompatible(final boolean forwardCompatible) {
+ final ContextAttribs attribs = new ContextAttribs(this);
+ attribs.forwardCompatible = forwardCompatible;
return attribs;
}
- protected abstract int getMajorVersionAttrib();
+ private static ContextAttribsImplementation getImplementation() {
+ switch ( LWJGLUtil.getPlatform() ) {
+ case LWJGLUtil.PLATFORM_LINUX:
+ return new LinuxContextAttribs();
+ case LWJGLUtil.PLATFORM_WINDOWS:
+ return new WindowsContextAttribs();
+ case LWJGLUtil.PLATFORM_MACOSX:
+ return new MacOSXContextAttribs();
+ default:
+ throw new IllegalStateException("Unsupported platform");
+ }
+ }
- protected abstract int getMinorVersionAttrib();
+ IntBuffer getAttribList() {
+ ContextAttribsImplementation implementation = getImplementation();
- protected abstract int getLayerPlaneAttrib();
-
- protected abstract int getFlagsAttrib();
-
- protected abstract int getDebugBit();
-
- protected abstract int getForwardCombatibleBit();
-
- final IntBuffer getAttribList() {
int attribCount = 0;
if ( !(majorVersion == 1 && minorVersion == 0) )
@@ -185,9 +162,9 @@
int flags = 0;
if ( debug )
- flags |= getDebugBit();
- if ( forwardCombatible )
- flags |= getForwardCombatibleBit();
+ flags |= implementation.getDebugBit();
+ if ( forwardCompatible )
+ flags |= implementation.getForwardCompatibleBit();
if ( 0 < flags )
attribCount++;
@@ -197,13 +174,13 @@
final IntBuffer attribs = BufferUtils.createIntBuffer((attribCount * 2) + 1);
if ( !(majorVersion == 1 && minorVersion == 0) ) {
- attribs.put(getMajorVersionAttrib()).put(majorVersion);
- attribs.put(getMinorVersionAttrib()).put(minorVersion);
+ attribs.put(implementation.getMajorVersionAttrib()).put(majorVersion);
+ attribs.put(implementation.getMinorVersionAttrib()).put(minorVersion);
}
if ( 0 < layerPlane )
- attribs.put(getLayerPlaneAttrib()).put(layerPlane);
+ attribs.put(implementation.getLayerPlaneAttrib()).put(layerPlane);
if ( 0 < flags )
- attribs.put(getFlagsAttrib()).put(flags);
+ attribs.put(implementation.getFlagsAttrib()).put(flags);
attribs.put(0);
attribs.rewind();
Added: trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribsImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribsImplementation.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribsImplementation.java 2008-08-19 17:47:24 UTC (rev 3117)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.lwjgl.opengl;
+
+/** @author spasi <sp...@us...> */
+interface ContextAttribsImplementation {
+
+ int getMajorVersionAttrib();
+
+ int getMinorVersionAttrib();
+
+ int getLayerPlaneAttrib();
+
+ int getFlagsAttrib();
+
+ int getDebugBit();
+
+ int getForwardCompatibleBit();
+
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java 2008-08-19 16:46:03 UTC (rev 3116)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java 2008-08-19 17:47:24 UTC (rev 3117)
@@ -291,16 +291,16 @@
* of caps and function pointers will be used. <p>The reference to the context is held in a weak reference; therefore if no
* strong reference exists to the GL context it will automatically be forgotten by the VM at an indeterminate point in the
* future, freeing up a little RAM.
- * <p>If forwardCombatible is true, function pointers of deprecated GL11-GL21 functionality will not be loaded. Calling a deprecated
+ * <p>If forwardCompatible is true, function pointers of deprecated GL11-GL21 functionality will not be loaded. Calling a deprecated
* function using the specified context will result in an <code>IllegalStateException</code>.
*
* @param context The context object, which uniquely identifies a GL context. If context is null, the native stubs are
* unloaded.
- * @param forwardCombatible If the context is a forward combatible context (does not expose deprecated functionality, see XGL_ARB_create_context)
+ * @param forwardCompatible If the context is a forward compatible context (does not expose deprecated functionality, see XGL_ARB_create_context)
*
* @throws LWJGLException if context non-null, and the gl library can't be loaded or the basic GL11 functions can't be loaded
*/
- public static synchronized void useContext(Object context, boolean forwardCombatible) throws LWJGLException {
+ public static synchronized void useContext(Object context, boolean forwardCompatible) throws LWJGLException {
if ( context == null ) {
ContextCapabilities.unloadAllStubs();
setCapabilities(null);
@@ -321,7 +321,7 @@
* as part of its capability discovery, but GL functions cannot be called before
* a capabilities object has been set.
*/
- new ContextCapabilities(forwardCombatible);
+ new ContextCapabilities(forwardCompatible);
capability_cache.put(context, getCapabilities());
} else
setCapabilities(capabilities);
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxContextAttribs.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxContextAttribs.java 2008-08-19 16:46:03 UTC (rev 3116)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxContextAttribs.java 2008-08-19 17:47:24 UTC (rev 3117)
@@ -38,7 +38,7 @@
*
* @author spasi <sp...@us...>
*/
-final class LinuxContextAttribs extends ContextAttribs {
+final class LinuxContextAttribs implements ContextAttribsImplementation {
private static final int GLX_CONTEXT_MAJOR_VERSION_ARB = 0x2091;
private static final int GLX_CONTEXT_MINOR_VERSION_ARB = 0x2092;
@@ -48,35 +48,30 @@
private static final int GLX_CONTEXT_DEBUG_BIT_ARB = 0x0001;
private static final int GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 0x0002;
- LinuxContextAttribs(final int majorVersion, final int minorVersion) {
- super(majorVersion, minorVersion);
+ LinuxContextAttribs() {
}
- LinuxContextAttribs(final ContextAttribs attribs) {
- super(attribs);
- }
-
- protected int getMajorVersionAttrib() {
+ public int getMajorVersionAttrib() {
return GLX_CONTEXT_MAJOR_VERSION_ARB;
}
- protected int getMinorVersionAttrib() {
+ public int getMinorVersionAttrib() {
return GLX_CONTEXT_MINOR_VERSION_ARB;
}
- protected int getLayerPlaneAttrib() {
+ public int getLayerPlaneAttrib() {
return GLX_CONTEXT_LAYER_PLANE_ARB;
}
- protected int getFlagsAttrib() {
+ public int getFlagsAttrib() {
return GLX_CONTEXT_FLAGS_ARB;
}
- protected int getDebugBit() {
+ public int getDebugBit() {
return GLX_CONTEXT_DEBUG_BIT_ARB;
}
- protected int getForwardCombatibleBit() {
+ public int getForwardCompatibleBit() {
return GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXContextAttribs.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXContextAttribs.java 2008-08-19 16:46:03 UTC (rev 3116)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXContextAttribs.java 2008-08-19 17:47:24 UTC (rev 3117)
@@ -38,7 +38,7 @@
*
* @author spasi <sp...@us...>
*/
-final class MacOSXContextAttribs extends ContextAttribs {
+final class MacOSXContextAttribs implements ContextAttribsImplementation {
private static final int XGL_CONTEXT_MAJOR_VERSION_ARB = 0x2091;
private static final int XGL_CONTEXT_MINOR_VERSION_ARB = 0x2092;
@@ -48,35 +48,30 @@
private static final int XGL_CONTEXT_DEBUG_BIT_ARB = 0x0001;
private static final int XGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 0x0002;
- MacOSXContextAttribs(final int majorVersion, final int minorVersion) {
- super(majorVersion, minorVersion);
+ MacOSXContextAttribs() {
}
- MacOSXContextAttribs(final ContextAttribs attribs) {
- super(attribs);
- }
-
- protected int getMajorVersionAttrib() {
+ public int getMajorVersionAttrib() {
return XGL_CONTEXT_MAJOR_VERSION_ARB;
}
- protected int getMinorVersionAttrib() {
+ public int getMinorVersionAttrib() {
return XGL_CONTEXT_MINOR_VERSION_ARB;
}
- protected int getLayerPlaneAttrib() {
+ public int getLayerPlaneAttrib() {
return XGL_CONTEXT_LAYER_PLANE_ARB;
}
- protected int getFlagsAttrib() {
+ public int getFlagsAttrib() {
return XGL_CONTEXT_FLAGS_ARB;
}
- protected int getDebugBit() {
+ public int getDebugBit() {
return XGL_CONTEXT_DEBUG_BIT_ARB;
}
- protected int getForwardCombatibleBit() {
+ public int getForwardCompatibleBit() {
return XGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsContextAttribs.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsContextAttribs.java 2008-08-19 16:46:03 UTC (rev 3116)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsContextAttribs.java 2008-08-19 17:47:24 UTC (rev 3117)
@@ -36,7 +36,7 @@
*
* @author spasi <sp...@us...>
*/
-final class WindowsContextAttribs extends ContextAttribs {
+final class WindowsContextAttribs implements ContextAttribsImplementation {
private static final int WGL_CONTEXT_MAJOR_VERSION_ARB = 0x2091;
private static final int WGL_CONTEXT_MINOR_VERSION_ARB = 0x2092;
@@ -46,35 +46,30 @@
private static final int WGL_CONTEXT_DEBUG_BIT_ARB = 0x0001;
private static final int WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 0x0002;
- WindowsContextAttribs(final int majorVersion, final int minorVersion) {
- super(majorVersion, minorVersion);
+ WindowsContextAttribs() {
}
- WindowsContextAttribs(final ContextAttribs attribs) {
- super(attribs);
- }
-
- protected int getMajorVersionAttrib() {
+ public int getMajorVersionAttrib() {
return WGL_CONTEXT_MAJOR_VERSION_ARB;
}
- protected int getMinorVersionAttrib() {
+ public int getMinorVersionAttrib() {
return WGL_CONTEXT_MINOR_VERSION_ARB;
}
- protected int getLayerPlaneAttrib() {
+ public int getLayerPlaneAttrib() {
return WGL_CONTEXT_LAYER_PLANE_ARB;
}
- protected int getFlagsAttrib() {
+ public int getFlagsAttrib() {
return WGL_CONTEXT_FLAGS_ARB;
}
- protected int getDebugBit() {
+ public int getDebugBit() {
return WGL_CONTEXT_DEBUG_BIT_ARB;
}
- protected int getForwardCombatibleBit() {
+ public int getForwardCompatibleBit() {
return WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
}
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java 2008-08-19 16:46:03 UTC (rev 3116)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java 2008-08-19 17:47:24 UTC (rev 3117)
@@ -70,8 +70,8 @@
}
public static void generateInitializerPrologue(PrintWriter writer) {
- writer.println("\t" + Utils.CONTEXT_CAPS_CLASS_NAME + "(boolean forwardCombatible) throws LWJGLException {");
- writer.println("\t\tSet " + CACHED_EXTS_VAR_NAME + " = " + ALL_INIT_METHOD_NAME + "(forwardCombatible);");
+ writer.println("\t" + Utils.CONTEXT_CAPS_CLASS_NAME + "(boolean forwardCompatible) throws LWJGLException {");
+ writer.println("\t\tSet " + CACHED_EXTS_VAR_NAME + " = " + ALL_INIT_METHOD_NAME + "(forwardCompatible);");
}
private static String translateFieldName(String interface_name) {
@@ -116,13 +116,13 @@
}
public static void generateInitStubsPrologue(PrintWriter writer, boolean context_specific) {
- writer.println("\tprivate Set " + ALL_INIT_METHOD_NAME + "(boolean forwardCombatible) throws LWJGLException {");
+ writer.println("\tprivate Set " + ALL_INIT_METHOD_NAME + "(boolean forwardCompatible) throws LWJGLException {");
if ( !context_specific ) {
writer.println("\t\tif (" + STUBS_LOADED_NAME + ")");
writer.println("\t\t\treturn GLContext.getSupportedExtensions();");
writer.println("\t\torg.lwjgl.opengl.GL11." + Utils.STUB_INITIALIZER_NAME + "();");
} else {
- writer.println("\t\tif (!" + getAddressesInitializerName("GL11") + "(forwardCombatible))");
+ writer.println("\t\tif (!" + getAddressesInitializerName("GL11") + "(forwardCompatible))");
writer.println("\t\t\tthrow new LWJGLException(\"GL11 not supported\");");
}
// Try to initialize GL30.glGetStringi here, in case we have created an OpenGL 3.0 context
@@ -154,7 +154,7 @@
writer.print(translateFieldName(d.getSimpleName()) + "\")");
writer.print(" && !" + getAddressesInitializerName(d.getSimpleName()) + "(");
if ( d.getAnnotation(DeprecatedGL.class) != null )
- writer.print("forwardCombatible");
+ writer.print("forwardCompatible");
if ( d.getAnnotation(Dependent.class) != null ) {
if ( d.getAnnotation(DeprecatedGL.class) != null )
writer.print(",");
@@ -186,7 +186,7 @@
DeprecatedGL deprecated = d.getAnnotation(DeprecatedGL.class);
Dependent dependent = d.getAnnotation(Dependent.class);
if ( deprecated != null )
- writer.print("boolean forwardCombatible");
+ writer.print("boolean forwardCompatible");
if ( dependent != null ) {
if ( deprecated != null )
writer.print(",");
@@ -202,7 +202,7 @@
writer.print("\t\t\t(");
if ( deprecated != null )
- writer.print("forwardCombatible || ");
+ writer.print("forwardCompatible || ");
if ( dependent != null )
writer.print("!supported_extensions.contains(\"" + dependent.value() + "\") || ");
if ( deprecated != null || dependent != null )
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/DeprecatedGL.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/DeprecatedGL.java 2008-08-19 16:46:03 UTC (rev 3116)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/DeprecatedGL.java 2008-08-19 17:47:24 UTC (rev 3117)
@@ -33,7 +33,7 @@
/**
* Use this annotation on extensions with deprecated functionality.
- * Functions in such extensions marked with this annotation will not be loaded in a forward combatible context.
+ * Functions in such extensions marked with this annotation will not be loaded in a forward compatible context.
*
* @author spasi <sp...@us...>
*/
Modified: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Pbuffer.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Pbuffer.c 2008-08-19 16:46:03 UTC (rev 3116)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Pbuffer.c 2008-08-19 17:47:24 UTC (rev 3117)
@@ -68,7 +68,7 @@
return false;
}
dummy_hdc = GetDC(dummy_hwnd);
- pixel_format_id = findPixelFormatOnDC(env, dummy_hdc, origin_x, origin_y, pixel_format, pixelFormatCaps, false, true, false, false, false);
+ pixel_format_id = findPixelFormatOnDC(env, dummy_hdc, origin_x, origin_y, pixel_format, pixelFormatCaps, false, true, false, false);
if (pixel_format_id == -1) {
closeWindow(&dummy_hwnd, &dummy_hdc);
return false;
@@ -137,7 +137,6 @@
WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
int pixel_format_id;
jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format);
- bool floating_point = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z"));
if ( pBufferAttribs != NULL ) {
pBufferAttribs_ptr = (const int *)(*env)->GetDirectBufferAddress(env, pBufferAttribs);
@@ -152,7 +151,7 @@
return;
}
dummy_hdc = GetDC(dummy_hwnd);
- pixel_format_id = findPixelFormatOnDC(env, dummy_hdc, origin_x, origin_y, pixel_format, pixelFormatCaps, false, false, true, false, floating_point);
+ pixel_format_id = findPixelFormatOnDC(env, dummy_hdc, origin_x, origin_y, pixel_format, pixelFormatCaps, false, false, true, false);
if (pixel_format_id == -1) {
closeWindow(&dummy_hwnd, &dummy_hdc);
return;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2008-10-27 14:04:16
|
Revision: 3138
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3138&view=rev
Author: elias_naur
Date: 2008-10-27 14:04:12 +0000 (Mon, 27 Oct 2008)
Log Message:
-----------
Windows: Only clip mouse to window borders if the lwjgl window is the foreground window
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2008-10-13 19:51:26 UTC (rev 3137)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2008-10-27 14:04:12 UTC (rev 3138)
@@ -511,7 +511,11 @@
private static native long getDC(long hwnd);
private static native long getDesktopWindow();
+ private static native long getForegroundWindow();
+
static void centerCursor(long hwnd) {
+ if (getForegroundWindow() != hwnd)
+ return;
getGlobalClientRect(hwnd, rect);
int local_offset_x = rect.left;
int local_offset_y = rect.top;
@@ -721,7 +725,7 @@
}
private void updateClipping() {
- if ((isFullscreen || (mouse != null && mouse.isGrabbed())) && !isMinimized && isFocused) {
+ if ((isFullscreen || (mouse != null && mouse.isGrabbed())) && !isMinimized && isFocused && getForegroundWindow() == getHwnd()) {
try {
setupCursorClipping(getHwnd());
} catch (LWJGLException e) {
Modified: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2008-10-13 19:51:26 UTC (rev 3137)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2008-10-27 14:04:12 UTC (rev 3138)
@@ -198,6 +198,10 @@
buffer[1] = point.y;
}
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getForegroundWindow(JNIEnv *env, jclass unused) {
+ return (INT_PTR)GetForegroundWindow();
+}
+
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getDesktopWindow(JNIEnv *env, jclass unused) {
return (INT_PTR)GetDesktopWindow();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2008-10-28 09:57:38
|
Revision: 3139
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3139&view=rev
Author: elias_naur
Date: 2008-10-28 09:53:16 +0000 (Tue, 28 Oct 2008)
Log Message:
-----------
Windows: Merged native handling of undecorated and fullscreen window property
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
trunk/LWJGL/src/native/windows/context.c
trunk/LWJGL/src/native/windows/context.h
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2008-10-27 14:04:12 UTC (rev 3138)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2008-10-28 09:53:16 UTC (rev 3139)
@@ -163,8 +163,7 @@
did_maximize = false;
this.parent = parent;
long parent_hwnd = parent != null ? getHwnd(parent) : 0;
- boolean isUndecorated = isUndecorated();
- this.hwnd = nCreateWindow(fullscreen, x, y, mode.getWidth(), mode.getHeight(), isUndecorated, parent != null, parent_hwnd);
+ this.hwnd = nCreateWindow(x, y, mode.getWidth(), mode.getHeight(), fullscreen || isUndecorated(), parent != null, parent_hwnd);
if (hwnd == 0) {
throw new LWJGLException("Failed to create window");
}
@@ -188,7 +187,7 @@
throw e;
}
}
- private native long nCreateWindow(boolean fullscreen, int x, int y, int width, int height, boolean undecorated, boolean child_window, long parent_hwnd) throws LWJGLException;
+ private static native long nCreateWindow(int x, int y, int width, int height, boolean undecorated, boolean child_window, long parent_hwnd) throws LWJGLException;
private static boolean isUndecorated() {
return Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated");
@@ -421,8 +420,7 @@
private static native void nUpdate();
public void reshape(int x, int y, int width, int height) {
- if (!isFullscreen)
- nReshape(getHwnd(), x, y, width, height, isUndecorated(), parent != null);
+ nReshape(getHwnd(), x, y, width, height, isFullscreen || isUndecorated(), parent != null);
}
private static native void nReshape(long hwnd, int x, int y, int width, int height, boolean undecorated, boolean child);
public native DisplayMode[] getAvailableDisplayModes() throws LWJGLException;
Modified: trunk/LWJGL/src/native/windows/context.c
===================================================================
--- trunk/LWJGL/src/native/windows/context.c 2008-10-27 14:04:12 UTC (rev 3138)
+++ trunk/LWJGL/src/native/windows/context.c 2008-10-28 09:53:16 UTC (rev 3139)
@@ -112,14 +112,11 @@
}
}
-void getWindowFlags(DWORD *windowflags_return, DWORD *exstyle_return, bool fullscreen, bool undecorated, bool child_window) {
+void getWindowFlags(DWORD *windowflags_return, DWORD *exstyle_return, bool undecorated, bool child_window) {
DWORD exstyle, windowflags;
- if (fullscreen) {
+ if (undecorated) {
exstyle = WS_EX_APPWINDOW;
windowflags = WS_POPUP;
- } else if (undecorated) {
- exstyle = WS_EX_APPWINDOW;
- windowflags = WS_POPUP;
} else if (child_window) {
exstyle = 0;
windowflags = WS_CHILDWINDOW;
@@ -132,23 +129,14 @@
*exstyle_return = exstyle;
}
-/*
- * Create a window with the specified title, position, size, and
- * fullscreen attribute. The window will have DirectInput associated
- * with it.
- *
- * Returns true for success, or false for failure
- */
-HWND createWindow(LPCTSTR window_class_name, int x, int y, int width, int height, bool fullscreen, bool undecorated, bool child_window, HWND parent)
+HWND createWindow(LPCTSTR window_class_name, int x, int y, int width, int height, bool undecorated, bool child_window, HWND parent)
{
RECT clientSize;
DWORD exstyle, windowflags;
HWND new_hwnd;
- getWindowFlags(&windowflags, &exstyle, fullscreen, undecorated, child_window);
+ getWindowFlags(&windowflags, &exstyle, undecorated, child_window);
- // If we're not a fullscreen window, adjust the height to account for the
- // height of the title bar (unless undecorated)
clientSize.bottom = height;
clientSize.left = 0;
clientSize.right = width;
@@ -497,5 +485,5 @@
HWND createDummyWindow(int origin_x, int origin_y) {
if (!registerDummyWindow())
return NULL;
- return createWindow(_CONTEXT_PRIVATE_CLASS_NAME, origin_x, origin_y, 1, 1, false, false, false, NULL);
-}
\ No newline at end of file
+ return createWindow(_CONTEXT_PRIVATE_CLASS_NAME, origin_x, origin_y, 1, 1, false, false, NULL);
+}
Modified: trunk/LWJGL/src/native/windows/context.h
===================================================================
--- trunk/LWJGL/src/native/windows/context.h 2008-10-27 14:04:12 UTC (rev 3138)
+++ trunk/LWJGL/src/native/windows/context.h 2008-10-28 09:53:16 UTC (rev 3139)
@@ -80,7 +80,7 @@
/**
* Return appropriate window and extended style flags from the given fullscreen and undecorated property
*/
-extern void getWindowFlags(DWORD *windowflags_return, DWORD *exstyle_return, bool fullscreen, bool undecorated, bool child_window);
+extern void getWindowFlags(DWORD *windowflags_return, DWORD *exstyle_return, bool undecorated, bool child_window);
/*
* Create a window with the specified position, size, and
@@ -89,7 +89,7 @@
*
* Returns true for success, or false for failure
*/
-extern HWND createWindow(LPCTSTR window_class_name, int x, int y, int width, int height, bool fullscreen, bool undecorated, bool child_window, HWND parent);
+extern HWND createWindow(LPCTSTR window_class_name, int x, int y, int width, int height, bool undecorated, bool child_window, HWND parent);
extern int findPixelFormatOnDC(JNIEnv *env, HDC hdc, int origin_x, int origin_y, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer);
Modified: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2008-10-27 14:04:12 UTC (rev 3138)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2008-10-28 09:53:16 UTC (rev 3139)
@@ -151,7 +151,7 @@
return org_lwjgl_WindowsSysImplementation_JNI_VERSION;
}
-JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nCreateWindow(JNIEnv *env, jobject self, jboolean fullscreen, jint x, jint y, jint width, jint height, jboolean undecorated, jboolean child_window, jlong parent_hwnd) {
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nCreateWindow(JNIEnv *env, jclass unused, jint x, jint y, jint width, jint height, jboolean undecorated, jboolean child_window, jlong parent_hwnd) {
HWND hwnd;
static bool oneShotInitialised = false;
if (!oneShotInitialised) {
@@ -162,7 +162,7 @@
oneShotInitialised = true;
}
- hwnd = createWindow(WINDOWCLASSNAME, x, y, width, height, fullscreen, undecorated, child_window, (HWND)parent_hwnd);
+ hwnd = createWindow(WINDOWCLASSNAME, x, y, width, height, undecorated, child_window, (HWND)parent_hwnd);
return (INT_PTR)hwnd;
}
@@ -299,7 +299,7 @@
DWORD exstyle, windowflags;
RECT clientSize;
- getWindowFlags(&windowflags, &exstyle, false, undecorated, child);
+ getWindowFlags(&windowflags, &exstyle, undecorated, child);
// If we're not a fullscreen window, adjust the height to account for the
// height of the title bar:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2008-12-22 12:22:40
|
Revision: 3165
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3165&view=rev
Author: elias_naur
Date: 2008-12-22 11:55:28 +0000 (Mon, 22 Dec 2008)
Log Message:
-----------
Windows 64: Enabled lwjgl64.dll and fixed crash
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java
trunk/LWJGL/src/native/common/common_tools.c
Modified: trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java 2008-12-14 19:10:45 UTC (rev 3164)
+++ trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java 2008-12-22 11:55:28 UTC (rev 3165)
@@ -64,6 +64,10 @@
}
private static native long nGetTime();
+ public final boolean has64Bit() {
+ return true;
+ }
+
private static long getHwnd() {
if (!Display.isCreated())
return 0;
Modified: trunk/LWJGL/src/native/common/common_tools.c
===================================================================
--- trunk/LWJGL/src/native/common/common_tools.c 2008-12-14 19:10:45 UTC (rev 3164)
+++ trunk/LWJGL/src/native/common/common_tools.c 2008-12-22 11:55:28 UTC (rev 3165)
@@ -68,7 +68,7 @@
}
static jstring sprintfJavaString(JNIEnv *env, const char *format, va_list ap) {
-#define BUFFER_SIZE 4000
+#define BUFFER_SIZE 400
char buffer[BUFFER_SIZE];
jstring str;
#ifdef _MSC_VER
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2009-03-25 17:44:06
|
Revision: 3190
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3190&view=rev
Author: spasi
Date: 2009-03-25 17:43:56 +0000 (Wed, 25 Mar 2009)
Log Message:
-----------
Added support for OpenGL 3.1
Added support for a bunch of new OpenGL extensions.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_cg_shader.java
Added Paths:
-----------
trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_texture_texture4.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_vertex_shader_tesselator.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_compatibility.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_meminfo.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_provoking_vertex.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_texture_swizzle.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_vertex_array_bgra.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_explicit_multisample.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_transform_feedback2.java
Property Changed:
----------------
trunk/LWJGL/src/
Property changes on: trunk/LWJGL/src
___________________________________________________________________
Added: svn:ignore
+ generated
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java 2009-03-21 08:14:23 UTC (rev 3189)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java 2009-03-25 17:43:56 UTC (rev 3190)
@@ -200,6 +200,8 @@
}
// ----------------------[ 3.X ]----------------------
+ if ( 3 < majorVersion || (3 == majorVersion && 1 <= minorVersion) )
+ supported_extensions.add("OpenGL31");
if ( 3 <= majorVersion )
supported_extensions.add("OpenGL30");
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java 2009-03-25 17:43:56 UTC (rev 3190)
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengl;
+
+import org.lwjgl.util.generator.*;
+
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+
+public interface AMD_performance_monitor {
+
+ /** Accepted by the <pame> parameter of GetPerfMonitorCounterInfoAMD */
+ int GL_COUNTER_TYPE_AMD = 0x8BC0;
+ int GL_COUNTER_RANGE_AMD = 0x8BC1;
+
+ /**
+ * Returned as a valid value in <data> parameter of
+ * GetPerfMonitorCounterInfoAMD if <pname> = COUNTER_TYPE_AMD
+ */
+ int GL_UNSIGNED_INT = 0x1405;
+ int GL_FLOAT = 0x1406;
+ int GL_UNSIGNED_INT64_AMD = 0x8BC2;
+ int GL_PERCENTAGE_AMD = 0x8BC3;
+
+ /** Accepted by the <pname> parameter of GetPerfMonitorCounterDataAMD */
+
+ int GL_PERFMON_RESULT_AVAILABLE_AMD = 0x8BC4;
+ int GL_PERFMON_RESULT_SIZE_AMD = 0x8BC5;
+ int GL_PERFMON_RESULT_AMD = 0x8BC6;
+
+ void glGetPerfMonitorGroupsAMD(@OutParameter @Check(value = "1", canBeNull = true) @GLint IntBuffer numGroups,
+ @AutoSize("groups") @GLsizei int groupsSize, @GLuint IntBuffer groups);
+
+ void glGetPerfMonitorCountersAMD(@GLuint int group,
+ @OutParameter @Check(value = "1") @GLint IntBuffer numCounters,
+ @OutParameter @Check(value = "1") @GLint IntBuffer maxActiveCounters,
+ @AutoSize("counters") @GLsizei int countersSize,
+ @GLuint IntBuffer counters);
+
+ void glGetPerfMonitorGroupStringAMD(@GLuint int group,
+ @AutoSize("groupString") @GLsizei int bufSize,
+ @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length,
+ @GLchar ByteBuffer groupString);
+
+ void glGetPerfMonitorCounterStringAMD(@GLuint int group, @GLuint int counter,
+ @AutoSize("counterString") @GLsizei int bufSize,
+ @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length,
+ @GLchar ByteBuffer counterString);
+
+ void glGetPerfMonitorCounterInfoAMD(@GLuint int group, @GLuint int counter, @GLenum int pname, @Check(value = "16") @GLvoid ByteBuffer data);
+
+ void glGenPerfMonitorsAMD(@AutoSize("monitors") @GLsizei int n, @OutParameter @GLuint IntBuffer monitors);
+
+ void glDeletePerfMonitorsAMD(@AutoSize("monitors") @GLsizei int n, @GLuint IntBuffer monitors);
+
+ void glSelectPerfMonitorCountersAMD(@GLuint int monitor, boolean enable, @GLuint int group, @AutoSize("counterList")int numCounters, @GLuint IntBuffer counterList);
+
+ void glBeginPerfMonitorAMD(@GLuint int monitor);
+
+ void glEndPerfMonitorAMD(@GLuint int monitor);
+
+ void glGetPerfMonitorCounterDataAMD(@GLuint int monitor, @GLenum int pname,
+ @AutoSize("data") @GLsizei int dataSize, @GLuint IntBuffer data,
+ @OutParameter @Check(value = "1", canBeNull = true) @GLint IntBuffer bytesWritten);
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_texture_texture4.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_texture_texture4.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_texture_texture4.java 2009-03-25 17:43:56 UTC (rev 3190)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengl;
+
+public interface AMD_texture_texture4 {
+}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_vertex_shader_tesselator.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_vertex_shader_tesselator.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_vertex_shader_tesselator.java 2009-03-25 17:43:56 UTC (rev 3190)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengl;
+
+import org.lwjgl.util.generator.GLenum;
+
+public interface AMD_vertex_shader_tesselator {
+
+ /** Returned by the <type> parameter of GetActiveUniform: */
+ int GL_SAMPLER_BUFFER_AMD = 0x9001;
+ int GL_INT_SAMPLER_BUFFER_AMD = 0x9002;
+ int GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD = 0x9003;
+
+ /** Accepted by TessellationModeAMD */
+ int GL_DISCRETE_AMD = 0x9006;
+ int GL_CONTINUOUS_AMD = 0x9007;
+
+ /** Accepted by GetIntegerv */
+ int GL_TESSELLATION_MODE_AMD = 0x9004;
+
+ /** Accepted by GetFloatv */
+ int GL_TESSELLATION_FACTOR_AMD = 0x9005;
+
+ void glTessellationFactorAMD(float factor);
+
+ void glTessellationModeAMD(@GLenum int mode);
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_compatibility.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_compatibility.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_compatibility.java 2009-03-25 17:43:56 UTC (rev 3190)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengl;
+
+public interface ARB_compatibility {
+}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java 2009-03-25 17:43:56 UTC (rev 3190)
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengl;
+
+import org.lwjgl.util.generator.*;
+
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+
+public interface ARB_uniform_buffer_object {
+
+ /**
+ * Accepted by the <target> parameters of BindBuffer, BufferData,
+ * BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, and
+ * GetBufferPointerv:
+ */
+ int GL_UNIFORM_BUFFER_ARB = 0x8A11;
+
+ /**
+ * Accepted by the <pname> parameter of GetIntegeri_v, GetBooleanv,
+ * GetIntegerv, GetFloatv, and GetDoublev:
+ */
+ int GL_UNIFORM_BUFFER_BINDING_ARB = 0x8A28;
+
+ /** Accepted by the <pname> parameter of GetIntegeri_v: */
+ int GL_UNIFORM_BUFFER_START_ARB = 0x8A29;
+ int GL_UNIFORM_BUFFER_SIZE_ARB = 0x8A2A;
+
+ /**
+ * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
+ * GetFloatv, and GetDoublev:
+ */
+ int GL_MAX_VERTEX_UNIFORM_BLOCKS_ARB = 0x8A2B;
+ int GL_MAX_GEOMETRY_UNIFORM_BLOCKS_ARB = 0x8A2C;
+ int GL_MAX_FRAGMENT_UNIFORM_BLOCKS_ARB = 0x8A2D;
+ int GL_MAX_COMBINED_UNIFORM_BLOCKS_ARB = 0x8A2E;
+ int GL_MAX_UNIFORM_BUFFER_BINDINGS_ARB = 0x8A2F;
+ int GL_MAX_UNIFORM_BLOCK_SIZE_ARB = 0x8A30;
+ int GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS_ARB = 0x8A31;
+ int GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_ARB = 0x8A32;
+ int GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS_ARB = 0x8A33;
+ int GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT_ARB = 0x8A34;
+
+ /** Accepted by the <pname> parameter of GetProgramiv: */
+ int GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH_ARB = 0x8A35;
+ int GL_ACTIVE_UNIFORM_BLOCKS_ARB = 0x8A36;
+
+ /** Accepted by the <pname> parameter of GetActiveUniformsivARB: */
+ int GL_UNIFORM_TYPE_ARB = 0x8A37;
+ int GL_UNIFORM_SIZE_ARB = 0x8A38;
+ int GL_UNIFORM_NAME_LENGTH_ARB = 0x8A39;
+ int GL_UNIFORM_BLOCK_INDEX_ARB = 0x8A3A;
+ int GL_UNIFORM_OFFSET_ARB = 0x8A3B;
+ int GL_UNIFORM_ARRAY_STRIDE_ARB = 0x8A3C;
+ int GL_UNIFORM_MATRIX_STRIDE_ARB = 0x8A3D;
+ int GL_UNIFORM_IS_ROW_MAJOR_ARB = 0x8A3E;
+
+ /** Accepted by the <pname> parameter of GetActiveUniformBlockivARB: */
+ int GL_UNIFORM_BLOCK_BINDING_ARB = 0x8A3F;
+ int GL_UNIFORM_BLOCK_DATA_SIZE_ARB = 0x8A40;
+ int GL_UNIFORM_BLOCK_NAME_LENGTH_ARB = 0x8A41;
+ int GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS_ARB = 0x8A42;
+ int GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES_ARB = 0x8A43;
+ int GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER_ARB = 0x8A44;
+ int GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER_ARB = 0x8A45;
+ int GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER_ARB = 0x8A46;
+
+ /** Returned by GetActiveUniformsivARB and GetUniformBlockIndexARB */
+ int GL_INVALID_INDEX_ARB = 0xFFFFFFFF; // TODO: Check if this is correct
+
+ void glGetUniformIndicesARB(@GLuint int program, @AutoSize("uniformIndices") @GLsizei int uniformCount,
+ @Const @NullTerminated @GLchar ByteBuffer uniformNames,
+ @OutParameter @GLuint IntBuffer uniformIndices);
+
+ @StripPostfix("params")
+ void glGetActiveUniformsivARB(@GLuint int program, @AutoSize("uniformIndices") @GLsizei int uniformCount,
+ @Const @GLuint IntBuffer uniformIndices,
+ @GLenum int pname,
+ @Check(value = "1") @GLint IntBuffer params); // TODO: We need to AutoSize "params" using "uniformCount"
+
+ void glGetActiveUniformNameARB(@GLuint int program, @GLuint int uniformIndex, @AutoSize("uniformName") @GLsizei int bufSize,
+ @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length,
+ @GLchar ByteBuffer uniformName);
+
+ @GLuint
+ int glGetUniformBlockIndexARB(@GLuint int program, @Const @NullTerminated @GLchar ByteBuffer uniformBlockName);
+
+ @StripPostfix("params")
+ void glGetActiveUniformBlockivARB(@GLuint int program, @GLuint int uniformBlockIndex, @GLenum int pname,
+ @OutParameter @Check(value = "16") @GLint IntBuffer params);
+
+ void glGetActiveUniformBlockNameARB(@GLuint int program, @GLuint int uniformBlockIndex, @AutoSize("uniformBlockName") @GLsizei int bufSize,
+ @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length,
+ @GLchar ByteBuffer uniformBlockName);
+
+ void glBindBufferRange(@GLenum int target, @GLuint int index, @GLuint int buffer, @GLintptr long offset, @GLsizeiptr long size);
+
+ void glBindBufferBase(@GLenum int target, @GLuint int index, @GLuint int buffer);
+
+ void glGetIntegeri_v(@GLenum int value, @GLuint int index, @OutParameter @Check("4")IntBuffer data);
+
+ void glUniformBlockBindingARB(@GLuint int program, @GLuint int uniformBlockIndex, @GLuint int uniformBlockBinding);
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_meminfo.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_meminfo.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_meminfo.java 2009-03-25 17:43:56 UTC (rev 3190)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengl;
+
+public interface ATI_meminfo {
+
+ /** Accepted by the <value> parameter of GetIntegerv: */
+ int GL_VBO_FREE_MEMORY_ATI = 0x87FB;
+ int GL_TEXTURE_FREE_MEMORY_ATI = 0x87FC;
+ int GL_RENDERBUFFER_FREE_MEMORY_ATI = 0x87FD;
+
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_cg_shader.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_cg_shader.java 2009-03-21 08:14:23 UTC (rev 3189)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_cg_shader.java 2009-03-25 17:43:56 UTC (rev 3190)
@@ -31,7 +31,7 @@
*/
package org.lwjgl.opengl;
-public interface EXT_cg_shader {
+public interface EXT_Cg_shader {
/**
* You can pass GL_CG_VERTEX_SHADER_EXT to glCreateShaderARB instead of GL_VERTEX_SHADER_ARB to create a vertex shader object
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_provoking_vertex.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_provoking_vertex.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_provoking_vertex.java 2009-03-25 17:43:56 UTC (rev 3190)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengl;
+
+import org.lwjgl.util.generator.GLenum;
+
+public interface EXT_provoking_vertex {
+
+ /** Accepted by the <mode> parameter of ProvokingVertexEXT: */
+ int GL_FIRST_VERTEX_CONVENTION_EXT = 0x8E4D;
+ int GL_LAST_VERTEX_CONVENTION_EXT = 0x8E4E;
+
+ /**
+ * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
+ * GetFloatv, and GetDoublev:
+ */
+ int GL_PROVOKING_VERTEX_EXT = 0x8E4F;
+ int GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT = 0x8E4C;
+
+ void glProvokingVertexEXT(@GLenum int mode);
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_texture_swizzle.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_texture_swizzle.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_texture_swizzle.java 2009-03-25 17:43:56 UTC (rev 3190)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengl;
+
+public interface EXT_texture_swizzle {
+
+ /**
+ * Accepted by the <pname> parameters of TexParameteri,
+ * TexParameterf, TexParameteriv, TexParameterfv,
+ * GetTexParameterfv, and GetTexParameteriv:
+ */
+ int GL_TEXTURE_SWIZZLE_R_EXT = 0x8E42;
+ int GL_TEXTURE_SWIZZLE_G_EXT = 0x8E43;
+ int GL_TEXTURE_SWIZZLE_B_EXT = 0x8E44;
+ int GL_TEXTURE_SWIZZLE_A_EXT = 0x8E45;
+
+ /**
+ * Accepted by the <pname> parameters of TexParameteriv,
+ * TexParameterfv, GetTexParameterfv, and GetTexParameteriv:
+ */
+ int GL_TEXTURE_SWIZZLE_RGBA_EXT = 0x8E46;
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_vertex_array_bgra.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_vertex_array_bgra.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_vertex_array_bgra.java 2009-03-25 17:43:56 UTC (rev 3190)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR AN...
[truncated message content] |
|
From: <sp...@us...> - 2009-03-26 11:08:49
|
Revision: 3191
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3191&view=rev
Author: spasi
Date: 2009-03-26 11:08:43 +0000 (Thu, 26 Mar 2009)
Log Message:
-----------
Force forward compatible mode when we have GL3.1+ but miss ARB_compatibility.
Added support for ARB_framebuffer_object.
Added support for GLX_ARB_create_context. (WIP)
Improved postfix stripping in the generator.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/StripPostfix.java
trunk/LWJGL/src/native/linux/extgl_glx.c
trunk/LWJGL/src/native/linux/extgl_glx.h
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_explicit_multisample.java
Added Paths:
-----------
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java
Property Changed:
----------------
trunk/LWJGL/src/native/
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java 2009-03-25 17:43:56 UTC (rev 3190)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java 2009-03-26 11:08:43 UTC (rev 3191)
@@ -187,4 +187,16 @@
return attribs;
}
+ public String toString() {
+ StringBuffer sb = new StringBuffer(32);
+
+ sb.append("ContextAttribs:");
+ sb.append(" Version=").append(majorVersion).append('.').append(minorVersion);
+ sb.append(" - Layer=").append(layerPlane);
+ sb.append(" - Debug=").append(debug);
+ sb.append(" - ForwardCompatible=").append(forwardCompatible);
+
+ return sb.toString();
+ }
+
}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java 2009-03-25 17:43:56 UTC (rev 3190)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java 2009-03-26 11:08:43 UTC (rev 3191)
@@ -37,7 +37,6 @@
import java.util.Collection;
import java.util.EnumSet;
import java.util.Iterator;
-import java.lang.annotation.Annotation;
import com.sun.mirror.declaration.InterfaceDeclaration;
import com.sun.mirror.declaration.MethodDeclaration;
@@ -117,6 +116,23 @@
public static void generateInitStubsPrologue(PrintWriter writer, boolean context_specific) {
writer.println("\tprivate Set " + ALL_INIT_METHOD_NAME + "(boolean forwardCompatible) throws LWJGLException {");
+
+ // Load the basic pointers we need to detect OpenGL version and supported extensions.
+ writer.println("\t\tGL11_glGetString_pointer = GLContext.getFunctionAddress(\"glGetString\");");
+
+ // Initialize GL11.glGetIntegerv and GL30.glGetStringi here, in case we have created an OpenGL 3.0 context.
+ // (they will be used in GLContext.getSupportedExtensions)
+ writer.println("\t\tGL11_glGetIntegerv_pointer = GLContext.getFunctionAddress(\"glGetIntegerv\");");
+ writer.println("\t\tGL30_glGetStringi_pointer = GLContext.getFunctionAddress(\"glGetStringi\");");
+
+ // Get the supported extensions set.
+ writer.println("\t\tGLContext.setCapabilities(this);");
+ writer.println("\t\tSet " + CACHED_EXTS_VAR_NAME + " = GLContext.getSupportedExtensions();");
+
+ // Force forward compatible mode when OpenGL version is 3.1 or higher and ARB_compatibility is not available.
+ writer.println("\t\tif ( supported_extensions.contains(\"OpenGL31\") && !supported_extensions.contains(\"GL_ARB_compatibility\") )");
+ writer.println("\t\t\tforwardCompatible = true;");
+
if ( !context_specific ) {
writer.println("\t\tif (" + STUBS_LOADED_NAME + ")");
writer.println("\t\t\treturn GLContext.getSupportedExtensions();");
@@ -125,11 +141,6 @@
writer.println("\t\tif (!" + getAddressesInitializerName("GL11") + "(forwardCompatible))");
writer.println("\t\t\tthrow new LWJGLException(\"GL11 not supported\");");
}
- // Try to initialize GL30.glGetStringi here, in case we have created an OpenGL 3.0 context
- // (it will be used in GLContext.getSupportedExtensions)
- writer.println("\t\tGL30_glGetStringi_pointer = GLContext.getFunctionAddress(\"glGetStringi\");");
- writer.println("\t\tGLContext.setCapabilities(this);");
- writer.println("\t\tSet " + CACHED_EXTS_VAR_NAME + " = GLContext.getSupportedExtensions();");
}
public static void generateInitStubsEpilogue(PrintWriter writer, boolean context_specific) {
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2009-03-25 17:43:56 UTC (rev 3190)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2009-03-26 11:08:43 UTC (rev 3191)
@@ -277,7 +277,7 @@
postfix_parameter.getType().accept(translator);
String postfix = translator.getSignature();
String method_name = method.getSimpleName();
- String extension_postfix = getExtensionPostfix(interface_decl);
+ String extension_postfix = "NULL".equals(strip_annotation.extension()) ? getExtensionPostfix(interface_decl) : strip_annotation.extension();
String result;
if (method_name.endsWith(postfix + "v" + extension_postfix))
result = method_name.substring(0, method_name.length() - (postfix.length() + 1 + extension_postfix.length()));
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/StripPostfix.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/StripPostfix.java 2009-03-25 17:43:56 UTC (rev 3190)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/StripPostfix.java 2009-03-26 11:08:43 UTC (rev 3191)
@@ -47,4 +47,5 @@
@Target(ElementType.METHOD)
public @interface StripPostfix {
String value(); // The parameter to deduce the postfix from
+ String extension() default "NULL";
}
Property changes on: trunk/LWJGL/src/native
___________________________________________________________________
Added: svn:ignore
+ generated
Modified: trunk/LWJGL/src/native/linux/extgl_glx.c
===================================================================
--- trunk/LWJGL/src/native/linux/extgl_glx.c 2009-03-25 17:43:56 UTC (rev 3190)
+++ trunk/LWJGL/src/native/linux/extgl_glx.c 2009-03-26 11:08:43 UTC (rev 3191)
@@ -74,6 +74,9 @@
/* GLX_SGI_swap_control */
glXSwapIntervalSGIPROC lwjgl_glXSwapIntervalSGI = NULL;
+/* GLX_ARB_create_context */
+glXCreateContextAttribsARBPROC lwjgl_glXCreateContextAttribsARB = NULL;
+
static void * lib_gl_handle = NULL;
typedef void * (APIENTRY * glXGetProcAddressARBPROC) (const GLubyte *procName);
@@ -142,6 +145,12 @@
symbols_flags.GLX_SGI_swap_control = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions);
}
+static void extgl_InitGLXARBCreateContext() {
+ ExtFunction functions[] = {
+ {"glXCreateContextAttribsARB", (void*)&lwjgl_glXCreateContextAttribsARB}};
+ symbols_flags.GLX_ARB_create_context = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions);
+}
+
static void extgl_InitGLXSupportedExtensions(Display *disp, int screen, GLXExtensions *extension_flags) {
/* extension_flags.GLX_EXT_visual_info = GLXQueryExtension(disp, screen, "GLX_EXT_visual_info");
extension_flags.GLX_EXT_visual_rating = GLXQueryExtension(disp, screen, "GLX_EXT_visual_rating");*/
@@ -150,6 +159,7 @@
extension_flags->GLX_ARB_fbconfig_float = GLXQueryExtension(disp, screen, "GLX_ARB_fbconfig_float");
extension_flags->GLX_EXT_fbconfig_packed_float = GLXQueryExtension(disp, screen, "GLX_EXT_fbconfig_packed_float");
extension_flags->GLX_ARB_framebuffer_sRGB = GLXQueryExtension(disp, screen, "GLX_ARB_framebuffer_sRGB") || GLXQueryExtension(disp, screen, "GLX_EXT_framebuffer_sRGB");
+ extension_flags->GLX_ARB_create_context = GLXQueryExtension(disp, screen, "GLX_ARB_create_context");
}
bool extgl_Open(JNIEnv *env) {
@@ -181,6 +191,7 @@
extgl_InitGLX12();
extgl_InitGLX13();
extgl_InitGLXSGISwapControl();
+ extgl_InitGLXARBCreateContext();
return true;
}
@@ -214,6 +225,7 @@
return false;
extension_flags->GLX12 = glx12;
extension_flags->GLX13 = major > 1 || (major == 1 && minor >= 3);
+ extension_flags->GLX14 = major > 1 || (major == 1 && minor >= 4);
extgl_InitGLXSupportedExtensions(disp, screen, extension_flags);
return true;
}
Modified: trunk/LWJGL/src/native/linux/extgl_glx.h
===================================================================
--- trunk/LWJGL/src/native/linux/extgl_glx.h 2009-03-25 17:43:56 UTC (rev 3190)
+++ trunk/LWJGL/src/native/linux/extgl_glx.h 2009-03-26 11:08:43 UTC (rev 3191)
@@ -323,9 +323,13 @@
/* GLX_SGI_swap_control */
typedef void (APIENTRY * glXSwapIntervalSGIPROC)(int interval);
+/* GLX_ARB_create_context */
+typedef GLXContext (APIENTRY * glXCreateContextAttribsARBPROC) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
+
typedef struct {
bool GLX12;
bool GLX13;
+ bool GLX14;
/* bool GLX_EXT_visual_info;
bool GLX_EXT_visual_rating;*/
bool GLX_SGI_swap_control;
@@ -333,6 +337,7 @@
bool GLX_ARB_fbconfig_float;
bool GLX_EXT_fbconfig_packed_float;
bool GLX_ARB_framebuffer_sRGB;
+ bool GLX_ARB_create_context;
} GLXExtensions;
/* Add _ to global symbols to avoid symbol clash with the OpenGL library */
@@ -378,6 +383,8 @@
extern glXSwapIntervalSGIPROC lwjgl_glXSwapIntervalSGI;
+extern glXCreateContextAttribsARBPROC lwjgl_glXCreateContextAttribsARB;
+
extern bool extgl_InitGLX(Display *disp, int screen, GLXExtensions *extension_flags);
#endif
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java 2009-03-26 11:08:43 UTC (rev 3191)
@@ -0,0 +1,242 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengl;
+
+import org.lwjgl.util.generator.*;
+
+import java.nio.IntBuffer;
+
+@Extension(postfix = "")
+public interface ARB_framebuffer_object {
+
+ /**
+ * Accepted by the <target> parameter of BindFramebuffer,
+ * CheckFramebufferStatus, FramebufferTexture{1D|2D|3D},
+ * FramebufferRenderbuffer, and
+ * GetFramebufferAttachmentParameteriv:
+ */
+ int GL_FRAMEBUFFER = 0x8D40;
+ int GL_READ_FRAMEBUFFER = 0x8CA8;
+ int GL_DRAW_FRAMEBUFFER = 0x8CA9;
+
+ /**
+ * Accepted by the <target> parameter of BindRenderbuffer,
+ * RenderbufferStorage, and GetRenderbufferParameteriv, and
+ * returned by GetFramebufferAttachmentParameteriv:
+ */
+ int GL_RENDERBUFFER = 0x8D41;
+
+ /**
+ * Accepted by the <internalformat> parameter of
+ * RenderbufferStorage:
+ */
+ int GL_STENCIL_INDEX1 = 0x8D46;
+ int GL_STENCIL_INDEX4 = 0x8D47;
+ int GL_STENCIL_INDEX8 = 0x8D48;
+ int GL_STENCIL_INDEX16 = 0x8D49;
+
+ /** Accepted by the <pname> parameter of GetRenderbufferParameteriv: */
+ int GL_RENDERBUFFER_WIDTH = 0x8D42;
+ int GL_RENDERBUFFER_HEIGHT = 0x8D43;
+ int GL_RENDERBUFFER_INTERNAL_FORMAT = 0x8D44;
+ int GL_RENDERBUFFER_RED_SIZE = 0x8D50;
+ int GL_RENDERBUFFER_GREEN_SIZE = 0x8D51;
+ int GL_RENDERBUFFER_BLUE_SIZE = 0x8D52;
+ int GL_RENDERBUFFER_ALPHA_SIZE = 0x8D53;
+ int GL_RENDERBUFFER_DEPTH_SIZE = 0x8D54;
+ int GL_RENDERBUFFER_STENCIL_SIZE = 0x8D55;
+ int GL_RENDERBUFFER_SAMPLES = 0x8CAB;
+
+ /**
+ * Accepted by the <pname> parameter of
+ * GetFramebufferAttachmentParameteriv:
+ */
+ int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0;
+ int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1;
+ int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2;
+ int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3;
+ int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 0x8CD4;
+ int GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 0x8210;
+ int GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 0x8211;
+ int GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE = 0x8212;
+ int GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 0x8213;
+ int GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 0x8214;
+ int GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 0x8215;
+ int GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 0x8216;
+ int GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 0x8217;
+
+ /** Returned in <params> by GetFramebufferAttachmentParameteriv: */
+ int GL_SRGB = 0x8C40;
+ int GL_UNSIGNED_NORMALIZED = 0x8C17;
+ int GL_FRAMEBUFFER_DEFAULT = 0x8218;
+ int GL_INDEX = 0x8222;
+
+ /**
+ * Accepted by the <attachment> parameter of
+ * FramebufferTexture{1D|2D|3D}, FramebufferRenderbuffer, and
+ * GetFramebufferAttachmentParameteriv
+ */
+ int GL_COLOR_ATTACHMENT0 = 0x8CE0;
+ int GL_COLOR_ATTACHMENT1 = 0x8CE1;
+ int GL_COLOR_ATTACHMENT2 = 0x8CE2;
+ int GL_COLOR_ATTACHMENT3 = 0x8CE3;
+ int GL_COLOR_ATTACHMENT4 = 0x8CE4;
+ int GL_COLOR_ATTACHMENT5 = 0x8CE5;
+ int GL_COLOR_ATTACHMENT6 = 0x8CE6;
+ int GL_COLOR_ATTACHMENT7 = 0x8CE7;
+ int GL_COLOR_ATTACHMENT8 = 0x8CE8;
+ int GL_COLOR_ATTACHMENT9 = 0x8CE9;
+ int GL_COLOR_ATTACHMENT10 = 0x8CEA;
+ int GL_COLOR_ATTACHMENT11 = 0x8CEB;
+ int GL_COLOR_ATTACHMENT12 = 0x8CEC;
+ int GL_COLOR_ATTACHMENT13 = 0x8CED;
+ int GL_COLOR_ATTACHMENT14 = 0x8CEE;
+ int GL_COLOR_ATTACHMENT15 = 0x8CEF;
+ int GL_DEPTH_ATTACHMENT = 0x8D00;
+ int GL_STENCIL_ATTACHMENT = 0x8D20;
+ int GL_DEPTH_STENCIL_ATTACHMENT = 0x821A;
+
+ /**
+ * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
+ * GetFloatv, and GetDoublev:
+ */
+ int GL_MAX_SAMPLES = 0x8D57;
+
+ /** Returned by CheckFramebufferStatus(): */
+ int GL_FRAMEBUFFER_COMPLETE = 0x8CD5;
+ int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6;
+ int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7;
+ int GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = 0x8CDB;
+ int GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER = 0x8CDC;
+ int GL_FRAMEBUFFER_UNSUPPORTED = 0x8CDD;
+ int GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 0x8D56;
+ int GL_FRAMEBUFFER_UNDEFINED = 0x8219;
+
+ /**
+ * Accepted by the <pname> parameters of GetIntegerv, GetFloatv,
+ * and GetDoublev:
+ */
+ int GL_FRAMEBUFFER_BINDING = 0x8CA6; // alias DRAW_FRAMEBUFFER_BINDING
+ int GL_DRAW_FRAMEBUFFER_BINDING = 0x8CA6;
+ int GL_READ_FRAMEBUFFER_BINDING = 0x8CAA;
+ int GL_RENDERBUFFER_BINDING = 0x8CA7;
+ int GL_MAX_COLOR_ATTACHMENTS = 0x8CDF;
+ int GL_MAX_RENDERBUFFER_SIZE = 0x84E8;
+
+ /** Returned by GetError(): */
+ int GL_INVALID_FRAMEBUFFER_OPERATION = 0x0506;
+
+ /**
+ * Accepted by the <format> parameter of DrawPixels, ReadPixels,
+ * TexImage1D, TexImage2D, TexImage3D, TexSubImage1D, TexSubImage2D,
+ * TexSubImage3D, and GetTexImage, by the <type> parameter of
+ * CopyPixels, by the <internalformat> parameter of TexImage1D,
+ * TexImage2D, TexImage3D, CopyTexImage1D, CopyTexImage2D, and
+ * RenderbufferStorage, and returned in the <data> parameter of
+ * GetTexLevelParameter and GetRenderbufferParameteriv:
+ */
+ int GL_DEPTH_STENCIL = 0x84F9;
+
+ /**
+ * Accepted by the <type> parameter of DrawPixels, ReadPixels,
+ * TexImage1D, TexImage2D, TexImage3D, TexSubImage1D, TexSubImage2D,
+ * TexSubImage3D, and GetTexImage:
+ */
+ int GL_UNSIGNED_INT_24_8 = 0x84FA;
+
+ /**
+ * Accepted by the <internalformat> parameter of TexImage1D,
+ * TexImage2D, TexImage3D, CopyTexImage1D, CopyTexImage2D, and
+ * RenderbufferStorage, and returned in the <data> parameter of
+ * GetTexLevelParameter and GetRenderbufferParameteriv:
+ */
+ int GL_DEPTH24_STENCIL8 = 0x88F0;
+
+ /** Accepted by the <value> parameter of GetTexLevelParameter: */
+ int GL_TEXTURE_STENCIL_SIZE = 0x88F1;
+
+ boolean glIsRenderbuffer(@GLuint int renderbuffer);
+
+ void glBindRenderbuffer(@GLenum int target, @GLuint int renderbuffer);
+
+ void glDeleteRenderbuffers(@AutoSize("renderbuffers") @GLsizei int n, @Const @GLuint IntBuffer renderbuffers);
+
+ void glGenRenderbuffers(@AutoSize("renderbuffers") @GLsizei int n, @OutParameter @GLuint IntBuffer renderbuffers);
+
+ void glRenderbufferStorage(@GLenum int target, @GLenum int internalformat,
+ @GLsizei int width, @GLsizei int height);
+
+ void glRenderbufferStorageMultisample(@GLenum int target, @GLsizei int samples,
+ @GLenum int internalformat,
+ @GLsizei int width, @GLsizei int height);
+
+ @StripPostfix("params")
+ void glGetRenderbufferParameteriv(@GLenum int target, @GLenum int pname, @Check("4") @OutParameter IntBuffer params);
+
+ boolean glIsFramebuffer(@GLuint int framebuffer);
+
+ void glBindFramebuffer(@GLenum int target, @GLuint int framebuffer);
+
+ void glDeleteFramebuffers(@AutoSize("framebuffers") @GLsizei int n, @Const @GLuint IntBuffer framebuffers);
+
+ void glGenFramebuffers(@AutoSize("framebuffers") @GLsizei int n, @OutParameter @GLuint IntBuffer framebuffers);
+
+ @GLenum
+ int glCheckFramebufferStatus(@GLenum int target);
+
+ void glFramebufferTexture1D(@GLenum int target, @GLenum int attachment,
+ @GLenum int textarget, @GLuint int texture, int level);
+
+ void glFramebufferTexture2D(@GLenum int target, @GLenum int attachment,
+ @GLenum int textarget, @GLuint int texture, int level);
+
+ void glFramebufferTexture3D(@GLenum int target, @GLenum int attachment,
+ @GLenum int textarget, @GLuint int texture,
+ int level, int layer);
+
+ void glFramebufferTextureLayer(@GLenum int target, @GLenum int attachment,
+ @GLuint int texture, int level, int layer);
+
+ void glFramebufferRenderbuffer(@GLenum int target, @GLenum int attachment,
+ @GLenum int renderbuffertarget, @GLuint int renderbuffer);
+
+ @StripPostfix("params")
+ void glGetFramebufferAttachmentParameteriv(@GLenum int target, @GLenum int attachment,
+ @GLenum int pname, @Check("4") @OutParameter IntBuffer params);
+
+ void glBlitFramebuffer(int srcX0, int srcY0, int srcX1, int srcY1,
+ int dstX0, int dstY0, int dstX1, int dstY1,
+ @GLbitfield int mask, @GLenum int filter);
+
+ void glGenerateMipmap(@GLenum int target);
+
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java 2009-03-25 17:43:56 UTC (rev 3190)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java 2009-03-26 11:08:43 UTC (rev 3191)
@@ -126,6 +126,7 @@
void glBindBufferBase(@GLenum int target, @GLuint int index, @GLuint int buffer);
+ @StripPostfix(value = "data", extension = "")
void glGetIntegeri_v(@GLenum int value, @GLuint int index, @OutParameter @Check("4")IntBuffer data);
void glUniformBlockBindingARB(@GLuint int program, @GLuint int uniformBlockIndex, @GLuint int uniformBlockBinding);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_explicit_multisample.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_explicit_multisample.java 2009-03-25 17:43:56 UTC (rev 3190)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_explicit_multisample.java 2009-03-26 11:08:43 UTC (rev 3191)
@@ -33,7 +33,9 @@
import org.lwjgl.util.generator.*;
-import java.nio.*;
+import java.nio.ByteBuffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
public interface NV_explicit_multisample {
@@ -73,8 +75,10 @@
int GL_INT_SAMPLER_RENDERBUFFER_NV = 0x8E57;
int GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV = 0x8E58;
+ @StripPostfix(value = "data", extension = "EXT")
void glGetBooleanIndexedvEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16") @GLboolean ByteBuffer data);
+ @StripPostfix(value = "data", extension = "EXT")
void glGetIntegerIndexedvEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16") IntBuffer data);
@StripPostfix("val")
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2009-06-03 11:09:09
|
Revision: 3220
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3220&view=rev
Author: matzon
Date: 2009-06-03 11:08:58 +0000 (Wed, 03 Jun 2009)
Log Message:
-----------
fixed windows click/movement detection if drag started inside display
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
trunk/LWJGL/src/java/org/lwjgl/test/input/MouseTest.java
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2009-06-02 12:40:57 UTC (rev 3219)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2009-06-03 11:08:58 UTC (rev 3220)
@@ -47,10 +47,13 @@
import org.lwjgl.LWJGLUtil;
import org.lwjgl.BufferUtils;
import org.lwjgl.input.Cursor;
+import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
final class WindowsDisplay implements DisplayImplementation {
private final static int GAMMA_LENGTH = 256;
+
+ private final static int WM_CANCELMODE = 0x001F;
private final static int WM_MOUSEMOVE = 0x0200;
private final static int WM_LBUTTONDOWN = 0x0201;
private final static int WM_LBUTTONUP = 0x0202;
@@ -62,7 +65,7 @@
private final static int WM_MBUTTONUP = 0x0208;
private final static int WM_MBUTTONDBLCLK = 0x0209;
private final static int WM_MOUSEWHEEL = 0x020A;
- private final static int WM_MOUSELEAVE = 0x02A3;
+ private final static int WM_CAPTURECHANGED = 0x0215;
private final static int WM_KEYDOWN = 256;
private final static int WM_KEYUP = 257;
private final static int WM_SYSKEYUP = 261;
@@ -150,7 +153,7 @@
private long small_icon;
private long large_icon;
- private boolean trackingMouse = false;
+ private int captureMouse = -1;
WindowsDisplay() {
current_display = this;
@@ -661,10 +664,24 @@
private static native long sendMessage(long hwnd, long msg, long wparam, long lparam);
private void handleMouseButton(int button, int state, long millis) {
- if (mouse != null)
+ if (mouse != null) {
mouse.handleMouseButton((byte)button, (byte)state, millis);
- if (parent != null && !isFocused)
+
+ // done with capture?
+ if(captureMouse != -1 && button == captureMouse && state == 0) {
+ nReleaseCapture();
+ captureMouse = -1;
+
+ // force mouse update - else we will run into an issue where the
+ // button state is "stale" while captureMouse == -1 which causes
+ // handleMouseMoved to issue a setCapture.
+ Mouse.poll();
+ }
+ }
+
+ if (parent != null && !isFocused) {
setFocus(getHwnd());
+ }
}
private boolean shouldGrab() {
@@ -673,19 +690,23 @@
private void handleMouseMoved(int x, int y, long millis) {
if (mouse != null) {
- mouse.handleMouseMoved(x, y, millis, shouldGrab());
+ mouse.handleMouseMoved(x, y, millis, shouldGrab());
- // if we're not tracking mouse and we get a mouse move event - START TRACKING!
- if(!trackingMouse && !Mouse.isGrabbed()) {
- LWJGLUtil.log("initial mouse move - need tracking");
-
- if (nTrackMouse(hwnd)) {
- trackingMouse = true;
+ // Moving - while mouse is down?
+ // need to capture
+ if(!Mouse.isGrabbed()) {
+ int button = firstMouseButtonDown();
+ if(captureMouse == -1 && button != -1) {
+ captureMouse = button;
+ nSetCapture(hwnd);
}
}
}
}
-
+
+ private static native long nSetCapture(long hwnd);
+ private static native boolean nReleaseCapture();
+
private void handleMouseScrolled(int amount, long millis) {
if (mouse != null)
mouse.handleMouseScrolled(amount, millis);
@@ -707,8 +728,14 @@
boolean repeat = state == previous_state; // Repeat message
byte extended = (byte)((lParam >>> 24) & 0x1);
int scan_code = (int)((lParam >>> 16) & 0xFF);
- if (keyboard != null)
+ if (keyboard != null) {
keyboard.handleKey((int)wParam, scan_code, extended != 0, state, millis, repeat);
+
+ if(captureMouse != -1 && keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
+ nReleaseCapture();
+ captureMouse = -1;
+ }
+ }
}
private static int transformY(long hwnd, int y) {
@@ -809,9 +836,6 @@
case WM_MBUTTONUP:
handleMouseButton(2, 0, millis);
return 0;
- case WM_MOUSELEAVE:
- handleMouseLeave(millis);
- return 0;
case WM_SYSCHAR:
case WM_CHAR:
handleChar(wParam, lParam, millis);
@@ -854,6 +878,15 @@
case WM_PAINT:
is_dirty = true;
return defWindowProc(hwnd, msg, wParam, lParam);
+ case WM_CANCELMODE:
+ nReleaseCapture();
+ /* fall through */
+ case WM_CAPTURECHANGED:
+ if(captureMouse != -1) {
+ handleMouseButton(captureMouse, 0, millis);
+ captureMouse = -1;
+ }
+ return 0;
default:
return defWindowProc(hwnd, msg, wParam, lParam);
}
@@ -866,6 +899,15 @@
public int getHeight() {
return Display.getDisplayMode().getHeight();
}
+
+ private int firstMouseButtonDown() {
+ for(int i=0; i<Mouse.getButtonCount(); i++) {
+ if(Mouse.isButtonDown(i)) {
+ return i;
+ }
+ }
+ return -1;
+ }
private static final class Rect {
public int top;
@@ -902,17 +944,4 @@
return "Rect: top = " + top + " bottom = " + bottom + " left = " + left + " right = " + right;
}
}
-
-
-
-
- private static native boolean nTrackMouse(long hwnd);
-
- private void handleMouseLeave(long millis) {
- handleMouseButton(0, 0, millis);
- handleMouseButton(1, 0, millis);
- handleMouseButton(2, 0, millis);
- trackingMouse = false;
- }
-
}
Modified: trunk/LWJGL/src/java/org/lwjgl/test/input/MouseTest.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/input/MouseTest.java 2009-06-02 12:40:57 UTC (rev 3219)
+++ trunk/LWJGL/src/java/org/lwjgl/test/input/MouseTest.java 2009-06-03 11:08:58 UTC (rev 3220)
@@ -238,6 +238,8 @@
*/
private void handleMouse() {
readBufferedMouse();
+
+ Display.setTitle("x: " + Mouse.getX() + ", y: " + Mouse.getY() + ", [0]: " + Mouse.isButtonDown(0) + ", [1]: " + Mouse.isButtonDown(1) + ", [2]: " + Mouse.isButtonDown(2));
}
/**
Modified: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2009-06-02 12:40:57 UTC (rev 3219)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2009-06-03 11:08:58 UTC (rev 3220)
@@ -490,14 +490,11 @@
return GetSystemMetrics(index);
}
-JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nTrackMouse(JNIEnv *env, jclass unused, jlong hwnd_int) {
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetCapture(JNIEnv *env, jclass unused, jlong hwnd_int) {
HWND hwnd = (HWND)(INT_PTR)hwnd_int;
-
- TRACKMOUSEEVENT tme;
- tme.cbSize = sizeof(TRACKMOUSEEVENT);
- tme.dwFlags = TME_LEAVE;
- tme.hwndTrack = hwnd;
-
- return _TrackMouseEvent(&tme);
+ return (INT_PTR) SetCapture(hwnd);
}
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nReleaseCapture(JNIEnv *env, jclass unused) {
+ return ReleaseCapture();
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2009-08-04 18:21:48
|
Revision: 3229
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3229&view=rev
Author: spasi
Date: 2009-08-04 18:21:41 +0000 (Tue, 04 Aug 2009)
Log Message:
-----------
Added support for OpenGL 3.2 and the following extensions: AMD_draw_buffers_blend, ARB_depth_clamp, ARB_draw_buffers_blend, ARB_draw_elements_base_vertex, ARB_fragment_coord_conventions, ARB_provoking_vertex, ARB_sample_shading, ARB_seamless_cube_map, ARB_shader_texture_lod, ARB_texture_cube_map_array, ARB_texture_gather, ARB_texture_multisample, ARB_texture_query_lod, ARB_vertex_array_bgra, EXT_separate_shader_objects, EXT_texture_snorm, NV_copy_image, NV_parameter_buffer_object2.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java
trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribsImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxContextAttribs.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXContextAttribs.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsContextAttribs.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/FieldsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java
trunk/LWJGL/src/native/common/extgl.h
Added Paths:
-----------
trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_draw_buffers_blend.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_depth_clamp.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_buffers_blend.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_elements_base_vertex.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_fragment_coord_conventions.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_provoking_vertex.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sample_shading.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_seamless_cube_map.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_texture_lod.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sync.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_cube_map_array.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_gather.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_multisample.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_query_lod.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_array_bgra.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_separate_shader_objects.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_texture_snorm.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL32.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_copy_image.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_parameter_buffer_object2.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java 2009-07-23 20:56:59 UTC (rev 3228)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java 2009-08-04 18:21:41 UTC (rev 3229)
@@ -48,7 +48,7 @@
* implementation. Developers may encounter debug contexts being the same as non-debug contexts or forward compatible
* contexts having support for deprecated functionality.
* <p/>
- * Warning: This functionality is currently available on the Windows platform only. However, if the forwardCompatible
+ * If the forwardCompatible
* attribute is used, LWJGL will not load the deprecated functionality (as defined in the OpenGL 3.0 specification). This
* means that developers can start working on cleaning up their applications without an OpenGL 3.0 complaint driver.
*
@@ -64,6 +64,9 @@
private boolean debug;
private boolean forwardCompatible;
+ private boolean profileCore;
+ private boolean profileCompatibility;
+
public ContextAttribs() {
this(1, 0);
}
@@ -72,7 +75,7 @@
if ( majorVersion < 0 ||
3 < majorVersion ||
minorVersion < 0 ||
- (majorVersion == 3 && 1 < minorVersion) ||
+ (majorVersion == 3 && 2 < minorVersion) ||
(majorVersion == 2 && 1 < minorVersion) ||
(majorVersion == 1 && 5 < minorVersion) )
throw new IllegalArgumentException("Invalid OpenGL version specified: " + majorVersion + '.' + minorVersion);
@@ -84,6 +87,9 @@
this.debug = false;
this.forwardCompatible = false;
+
+ this.profileCore = 3 < majorVersion || (majorVersion == 3 && 2 <= minorVersion) ? true : false;
+ this.profileCompatibility = false;
}
private ContextAttribs(final ContextAttribs attribs) {
@@ -94,6 +100,9 @@
this.debug = attribs.debug;
this.forwardCompatible = attribs.forwardCompatible;
+
+ this.profileCore = attribs.profileCore;
+ this.profileCompatibility = attribs.profileCompatibility;
}
public int getMajorVersion() {
@@ -116,27 +125,74 @@
return forwardCompatible;
}
+ public boolean isProfileCore() {
+ return profileCore;
+ }
+
+ public boolean isProfileCompatibility() {
+ return profileCompatibility;
+ }
+
public ContextAttribs withLayer(final int layerPlane) {
if ( layerPlane < 0 )
throw new IllegalArgumentException("Invalid layer plane specified: " + layerPlane);
+ if ( layerPlane == this.layerPlane )
+ return this;
+
final ContextAttribs attribs = new ContextAttribs(this);
attribs.layerPlane = layerPlane;
return attribs;
}
public ContextAttribs withDebug(final boolean debug) {
+ if ( debug == this.debug )
+ return this;
+
final ContextAttribs attribs = new ContextAttribs(this);
attribs.debug = debug;
return attribs;
}
public ContextAttribs withForwardCompatible(final boolean forwardCompatible) {
+ if ( forwardCompatible == this.forwardCompatible )
+ return this;
+
final ContextAttribs attribs = new ContextAttribs(this);
attribs.forwardCompatible = forwardCompatible;
return attribs;
}
+ public ContextAttribs withProfileCore(final boolean profileCore) {
+ if ( majorVersion < 3 || (majorVersion == 3 && minorVersion < 2) )
+ throw new IllegalArgumentException("Profiles are only supported on OpenGL version 3.2 or higher.");
+
+ if ( profileCore == this.profileCore )
+ return this;
+
+ final ContextAttribs attribs = new ContextAttribs(this);
+ attribs.profileCore = profileCore;
+ if ( profileCore )
+ attribs.profileCompatibility = false;
+
+ return attribs;
+ }
+
+ public ContextAttribs withProfileCompatibility(final boolean profileCompatibility) {
+ if ( majorVersion < 3 || (majorVersion == 3 && minorVersion < 2) )
+ throw new IllegalArgumentException("Profiles are only supported on OpenGL version 3.2 or higher.");
+
+ if ( profileCompatibility == this.profileCompatibility )
+ return this;
+
+ final ContextAttribs attribs = new ContextAttribs(this);
+ attribs.profileCompatibility = profileCompatibility;
+ if ( profileCompatibility )
+ attribs.profileCore = false;
+
+ return attribs;
+ }
+
private static ContextAttribsImplementation getImplementation() {
switch ( LWJGLUtil.getPlatform() ) {
case LWJGLUtil.PLATFORM_LINUX:
@@ -168,6 +224,14 @@
if ( 0 < flags )
attribCount++;
+ int profileMask = 0;
+ if ( profileCore )
+ profileMask |= implementation.getProfileCoreBit();
+ else if ( profileCompatibility )
+ profileMask |= implementation.getProfileCompatibilityBit();
+ if ( 0 < profileMask )
+ attribCount++;
+
if ( attribCount == 0 )
return null;
@@ -181,6 +245,8 @@
attribs.put(implementation.getLayerPlaneAttrib()).put(layerPlane);
if ( 0 < flags )
attribs.put(implementation.getFlagsAttrib()).put(flags);
+ if ( 0 < profileMask )
+ attribs.put(implementation.getProfileMaskAttrib()).put(profileMask);
attribs.put(0);
attribs.rewind();
@@ -195,6 +261,13 @@
sb.append(" - Layer=").append(layerPlane);
sb.append(" - Debug=").append(debug);
sb.append(" - ForwardCompatible=").append(forwardCompatible);
+ sb.append(" - Profile=");
+ if ( profileCore )
+ sb.append("Core");
+ else if ( profileCompatibility )
+ sb.append("Compatibility");
+ else
+ sb.append("None");
return sb.toString();
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribsImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribsImplementation.java 2009-07-23 20:56:59 UTC (rev 3228)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribsImplementation.java 2009-08-04 18:21:41 UTC (rev 3229)
@@ -47,4 +47,10 @@
int getForwardCompatibleBit();
+ int getProfileMaskAttrib();
+
+ int getProfileCoreBit();
+
+ int getProfileCompatibilityBit();
+
}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java 2009-07-23 20:56:59 UTC (rev 3228)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java 2009-08-04 18:21:41 UTC (rev 3229)
@@ -200,6 +200,8 @@
}
// ----------------------[ 3.X ]----------------------
+ if ( 3 < majorVersion || (3 == majorVersion && 2 <= minorVersion) )
+ supported_extensions.add("OpenGL32");
if ( 3 < majorVersion || (3 == majorVersion && 1 <= minorVersion) )
supported_extensions.add("OpenGL31");
if ( 3 <= majorVersion )
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxContextAttribs.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxContextAttribs.java 2009-07-23 20:56:59 UTC (rev 3228)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxContextAttribs.java 2009-08-04 18:21:41 UTC (rev 3229)
@@ -44,10 +44,14 @@
private static final int GLX_CONTEXT_MINOR_VERSION_ARB = 0x2092;
private static final int GLX_CONTEXT_LAYER_PLANE_ARB = 0x2093;
private static final int GLX_CONTEXT_FLAGS_ARB = 0x2094;
+ private static final int GLX_CONTEXT_PROFILE_MASK_ARB = 0x9126;
private static final int GLX_CONTEXT_DEBUG_BIT_ARB = 0x0001;
private static final int GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 0x0002;
+ private static final int GLX_CONTEXT_CORE_PROFILE_BIT_ARB = 0x00000001;
+ private static final int GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB = 0x00000002;
+
LinuxContextAttribs() {
}
@@ -75,4 +79,16 @@
return GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
}
+ public int getProfileMaskAttrib() {
+ return GLX_CONTEXT_PROFILE_MASK_ARB;
+ }
+
+ public int getProfileCoreBit() {
+ return GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
+ }
+
+ public int getProfileCompatibilityBit() {
+ return GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
+ }
+
}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXContextAttribs.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXContextAttribs.java 2009-07-23 20:56:59 UTC (rev 3228)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXContextAttribs.java 2009-08-04 18:21:41 UTC (rev 3229)
@@ -44,10 +44,14 @@
private static final int XGL_CONTEXT_MINOR_VERSION_ARB = 0x2092;
private static final int XGL_CONTEXT_LAYER_PLANE_ARB = 0x2093;
private static final int XGL_CONTEXT_FLAGS_ARB = 0x2094;
+ private static final int XGL_CONTEXT_PROFILE_MASK_ARB = 0x9126;
private static final int XGL_CONTEXT_DEBUG_BIT_ARB = 0x0001;
private static final int XGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 0x0002;
+ private static final int XGL_CONTEXT_CORE_PROFILE_BIT_ARB = 0x00000001;
+ private static final int XGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB = 0x00000002;
+
MacOSXContextAttribs() {
}
@@ -75,4 +79,16 @@
return XGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
}
+ public int getProfileMaskAttrib() {
+ return XGL_CONTEXT_PROFILE_MASK_ARB;
+ }
+
+ public int getProfileCoreBit() {
+ return XGL_CONTEXT_CORE_PROFILE_BIT_ARB;
+ }
+
+ public int getProfileCompatibilityBit() {
+ return XGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
+ }
+
}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsContextAttribs.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsContextAttribs.java 2009-07-23 20:56:59 UTC (rev 3228)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsContextAttribs.java 2009-08-04 18:21:41 UTC (rev 3229)
@@ -42,10 +42,14 @@
private static final int WGL_CONTEXT_MINOR_VERSION_ARB = 0x2092;
private static final int WGL_CONTEXT_LAYER_PLANE_ARB = 0x2093;
private static final int WGL_CONTEXT_FLAGS_ARB = 0x2094;
+ private static final int WGL_CONTEXT_PROFILE_MASK_ARB = 0x9126;
private static final int WGL_CONTEXT_DEBUG_BIT_ARB = 0x0001;
private static final int WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 0x0002;
+ private static final int WGL_CONTEXT_CORE_PROFILE_BIT_ARB = 0x00000001;
+ private static final int WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB = 0x00000002;
+
WindowsContextAttribs() {
}
@@ -73,4 +77,16 @@
return WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
}
+ public int getProfileMaskAttrib() {
+ return WGL_CONTEXT_PROFILE_MASK_ARB;
+ }
+
+ public int getProfileCoreBit() {
+ return WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
+ }
+
+ public int getProfileCompatibilityBit() {
+ return WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
+ }
+
}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/FieldsGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/FieldsGenerator.java 2009-07-23 20:56:59 UTC (rev 3228)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/FieldsGenerator.java 2009-08-04 18:21:41 UTC (rev 3229)
@@ -48,17 +48,23 @@
if (!(field_type instanceof PrimitiveType))
throw new RuntimeException("Field " + field.getSimpleName() + " is not a primitive type");
PrimitiveType field_type_prim = (PrimitiveType)field_type;
- if (field_type_prim.getKind() != PrimitiveType.Kind.INT)
- throw new RuntimeException("Field " + field.getSimpleName() + " is not of type 'int'");
- Integer field_value = (Integer)field.getConstantValue();
+ if (field_type_prim.getKind() != PrimitiveType.Kind.INT && field_type_prim.getKind() != PrimitiveType.Kind.LONG)
+ throw new RuntimeException("Field " + field.getSimpleName() + " is not of type 'int' or 'long'");
+ Object field_value = field.getConstantValue();
if (field_value == null)
throw new RuntimeException("Field " + field.getSimpleName() + " has no initial value");
}
private static void generateField(PrintWriter writer, FieldDeclaration field) {
- Integer field_value = (Integer)field.getConstantValue();
validateField(field);
- String field_value_string = Integer.toHexString(field_value);
+
+ Object value = field.getConstantValue();
+ String field_value_string;
+ if ( value.getClass().equals(Integer.class) )
+ field_value_string = Integer.toHexString((Integer)field.getConstantValue());
+ else
+ field_value_string = Long.toHexString((Long)field.getConstantValue()) + 'l';
+
Utils.printDocComment(writer, field);
// Print field declaration
writer.println("\tpublic static final " + field.getType().toString() + " " + field.getSimpleName() + " = 0x" + field_value_string + ";");
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java 2009-07-23 20:56:59 UTC (rev 3228)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java 2009-08-04 18:21:41 UTC (rev 3229)
@@ -41,14 +41,16 @@
* $Id$
*/
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-
-import java.io.*;
-import java.util.*;
+import java.io.PrintWriter;
import java.nio.*;
+import java.util.HashMap;
+import java.util.Map;
+import com.sun.mirror.declaration.AnnotationMirror;
+import com.sun.mirror.type.PrimitiveType;
+
public class GLTypeMap implements TypeMap {
+
private static final Map<Class, PrimitiveType.Kind> native_types_to_primitive;
static {
@@ -78,11 +80,14 @@
native_types_to_primitive.put(GLvoid.class, PrimitiveType.Kind.BYTE);
native_types_to_primitive.put(GLint64EXT.class, PrimitiveType.Kind.LONG);
native_types_to_primitive.put(GLuint64EXT.class, PrimitiveType.Kind.LONG);
+ native_types_to_primitive.put(GLint64.class, PrimitiveType.Kind.LONG);
+ native_types_to_primitive.put(GLuint64.class, PrimitiveType.Kind.LONG);
+ native_types_to_primitive.put(GLsync.class, PrimitiveType.Kind.LONG);
}
public PrimitiveType.Kind getPrimitiveTypeFromNativeType(Class native_type) {
PrimitiveType.Kind kind = native_types_to_primitive.get(native_type);
- if (kind == null)
+ if ( kind == null )
throw new RuntimeException("Unsupported type " + native_type);
return kind;
}
@@ -96,50 +101,46 @@
}
public Signedness getSignednessFromType(Class type) {
- if (GLuint.class.equals(type))
+ if ( GLuint.class.equals(type) )
return Signedness.UNSIGNED;
- else if (GLint.class.equals(type))
+ else if ( GLint.class.equals(type) )
return Signedness.SIGNED;
- else if (GLushort.class.equals(type))
+ else if ( GLushort.class.equals(type) )
return Signedness.UNSIGNED;
- else if (GLshort.class.equals(type))
+ else if ( GLshort.class.equals(type) )
return Signedness.SIGNED;
- else if (GLubyte.class.equals(type))
+ else if ( GLubyte.class.equals(type) )
return Signedness.UNSIGNED;
- else if (GLbyte.class.equals(type))
+ else if ( GLbyte.class.equals(type) )
return Signedness.SIGNED;
- else if (GLuint64EXT.class.equals(type))
+ else if ( GLuint64EXT.class.equals(type) )
return Signedness.UNSIGNED;
- else if (GLint64EXT.class.equals(type))
+ else if ( GLint64EXT.class.equals(type) )
return Signedness.SIGNED;
+ else if ( GLuint64.class.equals(type) )
+ return Signedness.UNSIGNED;
+ else if ( GLint64.class.equals(type) )
+ return Signedness.SIGNED;
else
return Signedness.NONE;
}
public String translateAnnotation(Class annotation_type) {
- if (annotation_type.equals(GLuint.class))
+ if ( annotation_type.equals(GLuint.class) || annotation_type.equals(GLint.class) )
return "i";
- else if (annotation_type.equals(GLint.class))
- return "i";
- else if (annotation_type.equals(GLushort.class))
- return"s";
- else if (annotation_type.equals(GLshort.class))
+ else if ( annotation_type.equals(GLushort.class) || annotation_type.equals(GLshort.class) )
return "s";
- else if (annotation_type.equals(GLubyte.class))
+ else if ( annotation_type.equals(GLubyte.class) || annotation_type.equals(GLbyte.class) )
return "b";
- else if (annotation_type.equals(GLbyte.class))
- return "b";
- else if (annotation_type.equals(GLfloat.class))
+ else if ( annotation_type.equals(GLfloat.class) )
return "f";
- else if (annotation_type.equals(GLdouble.class))
+ else if ( annotation_type.equals(GLdouble.class) )
return "d";
- else if (annotation_type.equals(GLhalf.class))
+ else if ( annotation_type.equals(GLhalf.class) )
return "h";
- else if (annotation_type.equals(GLuint64EXT.class))
+ else if ( annotation_type.equals(GLuint64EXT.class) || annotation_type.equals(GLint64EXT.class) || annotation_type.equals(GLuint64.class) || annotation_type.equals(GLint64.class) )
return "i64";
- else if (annotation_type.equals(GLint64EXT.class))
- return "i64";
- else if (annotation_type.equals(GLboolean.class) || annotation_type.equals(GLvoid.class))
+ else if ( annotation_type.equals(GLboolean.class) || annotation_type.equals(GLvoid.class) )
return "";
else
throw new RuntimeException(annotation_type + " is not allowed");
@@ -147,7 +148,7 @@
public Class getNativeTypeFromPrimitiveType(PrimitiveType.Kind kind) {
Class type;
- switch (kind) {
+ switch ( kind ) {
case INT:
type = GLint.class;
break;
@@ -184,43 +185,43 @@
}
private static Class[] getValidBufferTypes(Class type) {
- if (type.equals(IntBuffer.class))
- return new Class[]{GLbitfield.class, GLenum.class, GLhandleARB.class, GLint.class,
- GLsizei.class, GLuint.class};
- else if (type.equals(FloatBuffer.class))
- return new Class[]{GLclampf.class, GLfloat.class};
- else if (type.equals(ByteBuffer.class))
- return new Class[]{GLboolean.class, GLbyte.class, GLcharARB.class, GLchar.class, GLubyte.class, GLvoid.class};
- else if (type.equals(ShortBuffer.class))
- return new Class[]{GLhalf.class, GLshort.class, GLushort.class};
- else if (type.equals(DoubleBuffer.class))
- return new Class[]{GLclampd.class, GLdouble.class};
- else if (type.equals(LongBuffer.class))
- return new Class[]{GLint64EXT.class, GLuint64EXT.class};
+ if ( type.equals(IntBuffer.class) )
+ return new Class[] { GLbitfield.class, GLenum.class, GLhandleARB.class, GLint.class,
+ GLsizei.class, GLuint.class };
+ else if ( type.equals(FloatBuffer.class) )
+ return new Class[] { GLclampf.class, GLfloat.class };
+ else if ( type.equals(ByteBuffer.class) )
+ return new Class[] { GLboolean.class, GLbyte.class, GLcharARB.class, GLchar.class, GLubyte.class, GLvoid.class };
+ else if ( type.equals(ShortBuffer.class) )
+ return new Class[] { GLhalf.class, GLshort.class, GLushort.class };
+ else if ( type.equals(DoubleBuffer.class) )
+ return new Class[] { GLclampd.class, GLdouble.class };
+ else if ( type.equals(LongBuffer.class) )
+ return new Class[] { GLint64EXT.class, GLuint64EXT.class, GLint64.class, GLuint64.class, GLsync.class };
else
- return new Class[]{};
+ return new Class[] { };
}
private static Class[] getValidPrimitiveTypes(Class type) {
- if (type.equals(long.class))
- return new Class[]{GLintptrARB.class, GLuint.class, GLintptr.class, GLsizeiptrARB.class, GLsizeiptr.class, GLint64EXT.class, GLuint64EXT.class};
- else if (type.equals(int.class))
- return new Class[]{GLbitfield.class, GLenum.class, GLhandleARB.class, GLint.class, GLuint.class,
- GLsizei.class};
- else if (type.equals(double.class))
- return new Class[]{GLclampd.class, GLdouble.class};
- else if (type.equals(float.class))
- return new Class[]{GLclampf.class, GLfloat.class};
- else if (type.equals(short.class))
- return new Class[]{GLhalf.class, GLshort.class, GLushort.class};
- else if (type.equals(byte.class))
- return new Class[]{GLbyte.class, GLcharARB.class, GLchar.class, GLubyte.class};
- else if (type.equals(boolean.class))
- return new Class[]{GLboolean.class};
- else if (type.equals(void.class))
- return new Class[]{GLvoid.class};
+ if ( type.equals(long.class) )
+ return new Class[] { GLintptrARB.class, GLuint.class, GLintptr.class, GLsizeiptrARB.class, GLsizeiptr.class, GLint64EXT.class, GLuint64EXT.class, GLint64.class, GLuint64.class, GLsync.class };
+ else if ( type.equals(int.class) )
+ return new Class[] { GLbitfield.class, GLenum.class, GLhandleARB.class, GLint.class, GLuint.class,
+ GLsizei.class };
+ else if ( type.equals(double.class) )
+ return new Class[] { GLclampd.class, GLdouble.class };
+ else if ( type.equals(float.class) )
+ return new Class[] { GLclampf.class, GLfloat.class };
+ else if ( type.equals(short.class) )
+ return new Class[] { GLhalf.class, GLshort.class, GLushort.class };
+ else if ( type.equals(byte.class) )
+ return new Class[] { GLbyte.class, GLcharARB.class, GLchar.class, GLubyte.class };
+ else if ( type.equals(boolean.class) )
+ return new Class[] { GLboolean.class };
+ else if ( type.equals(void.class) )
+ return new Class[] { GLvoid.class };
else
- return new Class[]{};
+ return new Class[] { };
}
public String getTypedefPrefix() {
@@ -233,55 +234,59 @@
public Class[] getValidAnnotationTypes(Class type) {
Class[] valid_types;
- if (Buffer.class.isAssignableFrom(type))
+ if ( Buffer.class.isAssignableFrom(type) )
valid_types = getValidBufferTypes(type);
- else if (type.isPrimitive())
+ else if ( type.isPrimitive() )
valid_types = getValidPrimitiveTypes(type);
- else if (String.class.equals(type))
- valid_types = new Class[]{GLubyte.class};
+ else if ( String.class.equals(type) )
+ valid_types = new Class[] { GLubyte.class };
else
- valid_types = new Class[]{};
+ valid_types = new Class[] { };
return valid_types;
}
public Class getInverseType(Class type) {
- if (GLuint.class.equals(type))
+ if ( GLuint.class.equals(type) )
return GLint.class;
- else if (GLint.class.equals(type))
+ else if ( GLint.class.equals(type) )
return GLuint.class;
- else if (GLushort.class.equals(type))
+ else if ( GLushort.class.equals(type) )
return GLshort.class;
- else if (GLshort.class.equals(type))
+ else if ( GLshort.class.equals(type) )
return GLushort.class;
- else if (GLubyte.class.equals(type))
+ else if ( GLubyte.class.equals(type) )
return GLbyte.class;
- else if (GLbyte.class.equals(type))
+ else if ( GLbyte.class.equals(type) )
return GLubyte.class;
- else if (GLuint64EXT.class.equals(type))
+ else if ( GLuint64EXT.class.equals(type) )
return GLint64EXT.class;
- else if (GLint64EXT.class.equals(type))
+ else if ( GLint64EXT.class.equals(type) )
return GLuint64EXT.class;
+ else if ( GLuint64.class.equals(type) )
+ return GLint64.class;
+ else if ( GLint64.class.equals(type) )
+ return GLuint64.class;
else
return null;
}
public String getAutoTypeFromAnnotation(AnnotationMirror annotation) {
Class annotation_class = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType());
- if (annotation_class.equals(GLint.class))
+ if ( annotation_class.equals(GLint.class) )
return "GL11.GL_INT";
- else if (annotation_class.equals(GLbyte.class))
+ else if ( annotation_class.equals(GLbyte.class) )
return "GL11.GL_BYTE";
- else if (annotation_class.equals(GLshort.class))
+ else if ( annotation_class.equals(GLshort.class) )
return "GL11.GL_SHORT";
- if (annotation_class.equals(GLuint.class))
+ if ( annotation_class.equals(GLuint.class) )
return "GL11.GL_UNSIGNED_INT";
- else if (annotation_class.equals(GLubyte.class))
+ else if ( annotation_class.equals(GLubyte.class) )
return "GL11.GL_UNSIGNED_BYTE";
- else if (annotation_class.equals(GLushort.class))
+ else if ( annotation_class.equals(GLushort.class) )
return "GL11.GL_UNSIGNED_SHORT";
- else if (annotation_class.equals(GLfloat.class))
+ else if ( annotation_class.equals(GLfloat.class) )
return "GL11.GL_FLOAT";
- else if (annotation_class.equals(GLdouble.class))
+ else if ( annotation_class.equals(GLdouble.class) )
return "GL11.GL_DOUBLE";
else
return null;
Modified: trunk/LWJGL/src/native/common/extgl.h
===================================================================
--- trunk/LWJGL/src/native/common/extgl.h 2009-07-23 20:56:59 UTC (rev 3228)
+++ trunk/LWJGL/src/native/common/extgl.h 2009-08-04 18:21:41 UTC (rev 3229)
@@ -129,6 +129,9 @@
typedef unsigned short GLhalf;
typedef int64_t GLint64EXT;
typedef uint64_t GLuint64EXT;
+typedef int64_t GLint64;
+typedef uint64_t GLuint64;
+typedef struct __GLsync *GLsync;
/* helper stuff */
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_draw_buffers_blend.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_draw_buffers_blend.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_draw_buffers_blend.java 2009-08-04 18:21:41 UTC (rev 3229)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengl;
+
+import org.lwjgl.util.generator.GLenum;
+import org.lwjgl.util.generator.GLuint;
+
+public interface AMD_draw_buffers_blend {
+
+ void glBlendFuncIndexedAMD(@GLuint int buf, @GLenum int src, @GLenum int dst);
+
+ void glBlendFuncSeparateIndexedAMD(@GLuint int buf, @GLenum int srcRGB, @GLenum int dstRGB,
+ @GLenum int srcAlpha, @GLenum int dstAlpha);
+
+ void glBlendEquationIndexedAMD(@GLuint int buf, @GLenum int mode);
+
+ void glBlendEquationSeparateIndexedAMD(@GLuint int buf, @GLenum int modeRGB,
+ @GLenum int modeAlpha);
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_depth_clamp.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_depth_clamp.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_depth_clamp.java 2009-08-04 18:21:41 UTC (rev 3229)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redi...
[truncated message content] |
|
From: <sp...@us...> - 2009-09-08 15:07:29
|
Revision: 3237
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3237&view=rev
Author: spasi
Date: 2009-09-08 15:07:15 +0000 (Tue, 08 Sep 2009)
Log Message:
-----------
Added support for PIXEL_STORE state tracking.
Changed PBO GLChecks to use LWJGL's state tracking instead of using glGetInteger.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/BaseReferences.java
trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java
trunk/LWJGL/src/java/org/lwjgl/opengl/ReferencesStack.java
trunk/LWJGL/src/java/org/lwjgl/opengl/StateTracker.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/ReferencesGeneratorProcessorFactory.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/BaseReferences.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/BaseReferences.java 2009-09-08 12:27:59 UTC (rev 3236)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/BaseReferences.java 2009-09-08 15:07:15 UTC (rev 3237)
@@ -41,9 +41,12 @@
int arrayBuffer;
Buffer[] glVertexAttribPointer_buffer;
Buffer[] glTexCoordPointer_buffer;
- int glClientActiveTexture;
+ int glClientActiveTexture;
- BaseReferences(ContextCapabilities caps) {
+ int pixelPackBuffer;
+ int pixelUnpackBuffer;
+
+ BaseReferences(ContextCapabilities caps) {
IntBuffer temp = caps.scratch_int_buffer;
int max_vertex_attribs;
@@ -66,16 +69,26 @@
void clear() {
this.elementArrayBuffer = 0;
this.arrayBuffer = 0;
- this.glClientActiveTexture = 0;
- Arrays.fill(glVertexAttribPointer_buffer, null);
+ this.glClientActiveTexture = 0;
+ Arrays.fill(glVertexAttribPointer_buffer, null);
Arrays.fill(glTexCoordPointer_buffer, null);
+
+ this.pixelPackBuffer = 0;
+ this.pixelUnpackBuffer = 0;
}
- void copy(BaseReferences references) {
- this.elementArrayBuffer = references.elementArrayBuffer;
- this.arrayBuffer = references.arrayBuffer;
- this.glClientActiveTexture = references.glClientActiveTexture;
- System.arraycopy(references.glVertexAttribPointer_buffer, 0, glVertexAttribPointer_buffer, 0, glVertexAttribPointer_buffer.length);
- System.arraycopy(references.glTexCoordPointer_buffer, 0, glTexCoordPointer_buffer, 0, glTexCoordPointer_buffer.length);
+ void copy(BaseReferences references, int mask) {
+ if ( (mask & GL11.GL_CLIENT_VERTEX_ARRAY_BIT) != 0 ) {
+ this.elementArrayBuffer = references.elementArrayBuffer;
+ this.arrayBuffer = references.arrayBuffer;
+ this.glClientActiveTexture = references.glClientActiveTexture;
+ System.arraycopy(references.glVertexAttribPointer_buffer, 0, glVertexAttribPointer_buffer, 0, glVertexAttribPointer_buffer.length);
+ System.arraycopy(references.glTexCoordPointer_buffer, 0, glTexCoordPointer_buffer, 0, glTexCoordPointer_buffer.length);
+ }
+
+ if ( (mask & GL11.GL_CLIENT_PIXEL_STORE_BIT) != 0 ) {
+ this.pixelPackBuffer = references.pixelPackBuffer;
+ this.pixelUnpackBuffer = references.pixelUnpackBuffer;
+ }
}
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java 2009-09-08 12:27:59 UTC (rev 3236)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java 2009-09-08 15:07:15 UTC (rev 3237)
@@ -110,25 +110,25 @@
/** 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 ((caps.GL_ARB_pixel_buffer_object || caps.GL_EXT_pixel_buffer_object || caps.OpenGL21) && !checkBufferObject(caps, GL21.GL_PIXEL_PACK_BUFFER_BINDING, false))
+ if ( 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 ((caps.GL_ARB_pixel_buffer_object || caps.GL_EXT_pixel_buffer_object || caps.OpenGL21) && !checkBufferObject(caps, GL21.GL_PIXEL_PACK_BUFFER_BINDING, true))
+ if ( 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 ((caps.GL_ARB_pixel_buffer_object || caps.GL_EXT_pixel_buffer_object || caps.OpenGL21) && !checkBufferObject(caps, GL21.GL_PIXEL_UNPACK_BUFFER_BINDING, false))
+ if ( 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 ((caps.GL_ARB_pixel_buffer_object || caps.GL_EXT_pixel_buffer_object || caps.OpenGL21) && !checkBufferObject(caps, GL21.GL_PIXEL_UNPACK_BUFFER_BINDING, true))
+ if ( StateTracker.getReferencesStack(caps).getReferences().pixelUnpackBuffer == 0 )
throw new OpenGLException("Cannot use offsets when Pixel Unpack Buffer Object is disabled");
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/ReferencesStack.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/ReferencesStack.java 2009-09-08 12:27:59 UTC (rev 3236)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/ReferencesStack.java 2009-09-08 15:07:15 UTC (rev 3237)
@@ -44,12 +44,15 @@
if (pos == references_stack.length) {
growStack();
}
- references_stack[pos].copy(references_stack[pos - 1]);
+ references_stack[pos].copy(references_stack[pos - 1], GL11.GL_ALL_CLIENT_ATTRIB_BITS);
}
- public References popState() {
+ public References popState(int mask) {
References result = references_stack[stack_pos--];
+
+ references_stack[stack_pos].copy(result, ~mask);
result.clear();
+
return result;
}
@@ -58,10 +61,10 @@
System.arraycopy(references_stack, 0, new_references_stack, 0, references_stack.length);
references_stack = new_references_stack;
references_stack[references_stack.length - 1] = new References(GLContext.getCapabilities());
- }
+ }
ReferencesStack() {
- ContextCapabilities caps = GLContext.getCapabilities();
+ ContextCapabilities caps = GLContext.getCapabilities();
references_stack = new References[1];
stack_pos = 0;
for (int i = 0; i < references_stack.length; i++)
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/StateTracker.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/StateTracker.java 2009-09-08 12:27:59 UTC (rev 3236)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/StateTracker.java 2009-09-08 15:07:15 UTC (rev 3237)
@@ -45,9 +45,7 @@
}
private void doPopAttrib() {
- if ((attrib_stack.popState() & GL11.GL_CLIENT_VERTEX_ARRAY_BIT) != 0) {
- references_stack.popState();
- }
+ references_stack.popState(attrib_stack.popState());
}
static void pushAttrib(ContextCapabilities caps, int mask) {
@@ -56,9 +54,7 @@
private void doPushAttrib(int mask) {
attrib_stack.pushState(mask);
- if ((mask & GL11.GL_CLIENT_VERTEX_ARRAY_BIT) != 0) {
- references_stack.pushState();
- }
+ references_stack.pushState();
}
static ReferencesStack getReferencesStack(ContextCapabilities caps) {
@@ -74,6 +70,13 @@
case GL15.GL_ARRAY_BUFFER:
references_stack.getReferences().arrayBuffer = buffer;
break;
+ case GL21.GL_PIXEL_PACK_BUFFER:
+ references_stack.getReferences().pixelPackBuffer = buffer;
+ break;
+ case GL21.GL_PIXEL_UNPACK_BUFFER:
+ references_stack.getReferences().pixelUnpackBuffer = buffer;
+ break;
+
}
}
}
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/ReferencesGeneratorProcessorFactory.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/ReferencesGeneratorProcessorFactory.java 2009-09-08 12:27:59 UTC (rev 3236)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/ReferencesGeneratorProcessorFactory.java 2009-09-08 15:07:15 UTC (rev 3237)
@@ -69,7 +69,7 @@
private final static String REFERENCES_PARAMETER_NAME = "references";
private static boolean first_round = true;
-
+
// Process any set of annotations
private static final Collection<String> supportedAnnotations =
unmodifiableCollection(Arrays.asList("*"));
@@ -120,19 +120,19 @@
}
}
}
-
+
private static void generateCopiesFromParameters(PrintWriter writer, InterfaceDeclaration interface_decl, MethodDeclaration method) {
for (ParameterDeclaration param : method.getParameters()) {
CachedReference cached_reference_annotation = param.getAnnotation(CachedReference.class);
if (cached_reference_annotation != null && cached_reference_annotation.name().length() == 0) {
Class nio_type = Utils.getNIOBufferType(param.getType());
String reference_name = Utils.getReferenceName(interface_decl, method, param);
- writer.print("\t\tthis." + reference_name + " = ");
+ writer.print("\t\t\tthis." + reference_name + " = ");
writer.println(REFERENCES_PARAMETER_NAME + "." + reference_name + ";");
}
}
}
-
+
private static void generateClearsFromMethods(PrintWriter writer, InterfaceDeclaration interface_decl) {
for (MethodDeclaration method : interface_decl.getMethods()) {
generateClearsFromParameters(writer, interface_decl, method);
@@ -158,7 +158,7 @@
}
}
}
-
+
private static void generateReferencesFromMethods(PrintWriter writer, InterfaceDeclaration interface_decl) {
for (MethodDeclaration method : interface_decl.getMethods()) {
generateReferencesFromParameters(writer, interface_decl, method);
@@ -182,12 +182,14 @@
generateReferencesFromMethods(writer, interface_decl);
}
writer.println();
- writer.println("\tvoid copy(" + REFERENCES_CLASS_NAME + " " + REFERENCES_PARAMETER_NAME + ") {");
- writer.println("\t\tsuper.copy(" + REFERENCES_PARAMETER_NAME + ");");
+ writer.println("\tvoid copy(" + REFERENCES_CLASS_NAME + " " + REFERENCES_PARAMETER_NAME + ", int mask) {");
+ writer.println("\t\tsuper.copy(" + REFERENCES_PARAMETER_NAME + ", mask);");
+ writer.println("\t\tif ( (mask & GL11.GL_CLIENT_VERTEX_ARRAY_BIT) != 0 ) {");
for (TypeDeclaration typedecl : interface_decls) {
InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl;
generateCopiesFromMethods(writer, interface_decl);
}
+ writer.println("\t\t}");
writer.println("\t}");
writer.println("\tvoid clear() {");
writer.println("\t\tsuper.clear();");
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java 2009-09-08 12:27:59 UTC (rev 3236)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java 2009-09-08 15:07:15 UTC (rev 3237)
@@ -1258,7 +1258,7 @@
void glShadeModel(@GLenum int mode);
@DeprecatedGL
- void glSelectBuffer(@AutoSize("buffer") @GLsizei int size, @CachedReference @GLuint IntBuffer buffer);
+ void glSelectBuffer(@AutoSize("buffer") @GLsizei int size, @GLuint IntBuffer buffer);
void glScissor(int x, int y, @GLsizei int width, @GLsizei int height);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2009-09-12 22:15:30
|
Revision: 3240
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3240&view=rev
Author: matzon
Date: 2009-09-12 22:15:21 +0000 (Sat, 12 Sep 2009)
Log Message:
-----------
support for tracking mouse outside window on drag, new api for checking if mouse is inside window
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java
trunk/LWJGL/src/java/org/lwjgl/opengl/InputImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
trunk/LWJGL/src/java/org/lwjgl/test/input/MouseTest.java
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c
Modified: trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2009-09-10 11:15:12 UTC (rev 3239)
+++ trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2009-09-12 22:15:21 UTC (rev 3240)
@@ -33,6 +33,8 @@
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.HashMap;
import java.util.Map;
@@ -135,6 +137,8 @@
private static final boolean emulateCursorAnimation = LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_WINDOWS ||
LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_MACOSX;
+ private static final boolean allowNegativeMouseCoords = getPrivilegedBoolean("org.lwjgl.input.Mouse.allowNegativeMouseCoords");
+
/**
* Mouse cannot be constructed.
*/
@@ -338,9 +342,11 @@
x = poll_coord1;
y = poll_coord2;
}
- x = Math.min(implementation.getWidth() - 1, Math.max(0, x));
- y = Math.min(implementation.getHeight() - 1, Math.max(0, y));
- dwheel += poll_dwheel;
+ if(!allowNegativeMouseCoords) {
+ x = Math.min(implementation.getWidth() - 1, Math.max(0, x));
+ y = Math.min(implementation.getHeight() - 1, Math.max(0, y));
+ }
+ dwheel += poll_dwheel;
read();
}
}
@@ -634,4 +640,24 @@
}
}
}
+
+ /** Gets a boolean property as a privileged action. */
+ static boolean getPrivilegedBoolean(final String property_name) {
+ Boolean value = (Boolean)AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return new Boolean(Boolean.getBoolean(property_name));
+ }
+ });
+ return value.booleanValue();
+ }
+
+ /**
+ * Retrieves whether or not the mouse cursor is within the bounds of the window.
+ * If the mouse cursor was moved outside the display during a drag, then the result of calling
+ * this method will be true until the button is released.
+ * @return true if mouse is inside display, false otherwise.
+ */
+ public static boolean isInsideWindow() {
+ return implementation.isInsideWindow();
+ }
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/InputImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/InputImplementation.java 2009-09-10 11:15:12 UTC (rev 3239)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/InputImplementation.java 2009-09-12 22:15:21 UTC (rev 3240)
@@ -129,4 +129,6 @@
int getWidth();
int getHeight();
+
+ boolean isInsideWindow();
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2009-09-10 11:15:12 UTC (rev 3239)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2009-09-12 22:15:21 UTC (rev 3240)
@@ -1221,4 +1221,8 @@
public int getHeight() {
return Display.getDisplayMode().getHeight();
}
+
+ public boolean isInsideWindow() {
+ return true;
+ }
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java 2009-09-10 11:15:12 UTC (rev 3239)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java 2009-09-12 22:15:21 UTC (rev 3240)
@@ -501,4 +501,8 @@
public int getHeight() {
return Display.getDisplayMode().getHeight();
}
+
+ public boolean isInsideWindow() {
+ return true;
+ }
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2009-09-10 11:15:12 UTC (rev 3239)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2009-09-12 22:15:21 UTC (rev 3240)
@@ -66,6 +66,7 @@
private final static int WM_MBUTTONDBLCLK = 0x0209;
private final static int WM_MOUSEWHEEL = 0x020A;
private final static int WM_CAPTURECHANGED = 0x0215;
+ private final static int WM_MOUSELEAVE = 0x02A3;
private final static int WM_KEYDOWN = 256;
private final static int WM_KEYUP = 257;
private final static int WM_SYSKEYUP = 261;
@@ -154,6 +155,8 @@
private long large_icon;
private int captureMouse = -1;
+ private boolean trackingMouse = false;
+ private boolean mouseInside = false;
WindowsDisplay() {
current_display = this;
@@ -813,6 +816,10 @@
int yPos = transformY(getHwnd(), (int)(short)((lParam >> 16) & 0xFFFF));
handleMouseMoved(xPos, yPos, millis);
checkCursorState();
+ mouseInside = true;
+ if(!trackingMouse) {
+ trackingMouse = nTrackMouseEvent(hwnd);
+ }
return 0;
case WM_MOUSEWHEEL:
int dwheel = (int)(short)((wParam >> 16) & 0xFFFF);
@@ -878,6 +885,10 @@
case WM_PAINT:
is_dirty = true;
return defWindowProc(hwnd, msg, wParam, lParam);
+ case WM_MOUSELEAVE:
+ mouseInside = false;
+ trackingMouse = false;
+ return defWindowProc(hwnd, msg, wParam, lParam);
case WM_CANCELMODE:
nReleaseCapture();
/* fall through */
@@ -909,6 +920,12 @@
return -1;
}
+ private native boolean nTrackMouseEvent(long hwnd);
+
+ public boolean isInsideWindow() {
+ return mouseInside;
+ }
+
private static final class Rect {
public int top;
public int bottom;
Modified: trunk/LWJGL/src/java/org/lwjgl/test/input/MouseTest.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/input/MouseTest.java 2009-09-10 11:15:12 UTC (rev 3239)
+++ trunk/LWJGL/src/java/org/lwjgl/test/input/MouseTest.java 2009-09-12 22:15:21 UTC (rev 3240)
@@ -239,7 +239,7 @@
private void handleMouse() {
readBufferedMouse();
- Display.setTitle("x: " + Mouse.getX() + ", y: " + Mouse.getY() + ", [0]: " + Mouse.isButtonDown(0) + ", [1]: " + Mouse.isButtonDown(1) + ", [2]: " + Mouse.isButtonDown(2));
+ Display.setTitle("x: " + Mouse.getX() + ", y: " + Mouse.getY() + ", [0]: " + Mouse.isButtonDown(0) + ", [1]: " + Mouse.isButtonDown(1) + ", [2]: " + Mouse.isButtonDown(2) + ", inside: " + Mouse.isInsideWindow());
}
/**
Modified: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2009-09-10 11:15:12 UTC (rev 3239)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2009-09-12 22:15:21 UTC (rev 3240)
@@ -468,3 +468,12 @@
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nReleaseCapture(JNIEnv *env, jclass unused) {
return ReleaseCapture();
}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nTrackMouseEvent(JNIEnv *env, jclass clazz, jlong hwnd_ptr) {
+ HWND hwnd = (HWND)(INT_PTR)hwnd_ptr;
+ TRACKMOUSEEVENT tme;
+ tme.cbSize = sizeof(TRACKMOUSEEVENT);
+ tme.dwFlags = TME_LEAVE;
+ tme.hwndTrack = hwnd;
+ return TrackMouseEvent(&tme);
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2009-12-01 03:37:36
|
Revision: 3256
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3256&view=rev
Author: spasi
Date: 2009-12-01 03:37:27 +0000 (Tue, 01 Dec 2009)
Log Message:
-----------
Updated EXT_direct_state_access to latest revision.
Improved postfix stripping and extension dependency.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/StripPostfix.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sync.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL30.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL32.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_geometry_program4.java
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java 2009-11-26 22:44:17 UTC (rev 3255)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java 2009-12-01 03:37:27 UTC (rev 3256)
@@ -215,8 +215,16 @@
writer.print("\t\t\t(");
if ( deprecated != null )
writer.print("forwardCompatible || ");
- if ( dependent != null )
- writer.print("!supported_extensions.contains(\"" + dependent.value() + "\") || ");
+ if ( dependent != null ) {
+ if ( dependent.value().indexOf(',') == -1 )
+ writer.print("!supported_extensions.contains(\"" + dependent.value() + "\") || ");
+ else {
+ writer.print("!(false");
+ for ( String extension : dependent.value().split(",") )
+ writer.print(" || supported_extensions.contains(\"" + extension + "\")");
+ writer.print(") || ");
+ }
+ }
if ( deprecated != null || dependent != null )
writer.print('(');
writer.print(Utils.getFunctionAddressName(d, method) + " = ");
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2009-11-26 22:44:17 UTC (rev 3255)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2009-12-01 03:37:27 UTC (rev 3256)
@@ -283,22 +283,29 @@
private static String getPostfixStrippedName(TypeMap type_map, InterfaceDeclaration interface_decl, MethodDeclaration method) {
StripPostfix strip_annotation = method.getAnnotation(StripPostfix.class);
ParameterDeclaration postfix_parameter = Utils.findParameter(method, strip_annotation.value());
- PostfixTranslator translator = new PostfixTranslator(type_map, postfix_parameter);
- postfix_parameter.getType().accept(translator);
- String postfix = translator.getSignature();
+ String postfix = strip_annotation.postfix();
+ if ( "NULL".equals(postfix) ) {
+ PostfixTranslator translator = new PostfixTranslator(type_map, postfix_parameter);
+ postfix_parameter.getType().accept(translator);
+ postfix = translator.getSignature();
+ }
String method_name = method.getSimpleName();
String extension_postfix = "NULL".equals(strip_annotation.extension()) ? getExtensionPostfix(interface_decl) : strip_annotation.extension();
String result;
- if (method_name.endsWith(postfix + "v" + extension_postfix))
+
+ if ( strip_annotation.hasPostfix() && method_name.endsWith(postfix + "v" + extension_postfix))
result = method_name.substring(0, method_name.length() - (postfix.length() + 1 + extension_postfix.length()));
- else if (method_name.endsWith(postfix + extension_postfix))
+ else if ( strip_annotation.hasPostfix() && method_name.endsWith(postfix + extension_postfix))
result = method_name.substring(0, method_name.length() - (postfix.length() + extension_postfix.length()));
- else if ( method_name.endsWith("_v" + extension_postfix) )
- result = method_name.substring(0, method_name.length() - (2 + extension_postfix.length()));
+ else if ( strip_annotation.hasPostfix() && method_name.endsWith(postfix + "i_v" + extension_postfix) )
+ result = method_name.substring(0, method_name.length() - (postfix.length() + 3 + extension_postfix.length()));
+ else if ( method_name.endsWith("i_v" + extension_postfix) )
+ result = method_name.substring(0, method_name.length() - (3 + extension_postfix.length()));
else if (method_name.endsWith("v" + extension_postfix))
result = method_name.substring(0, method_name.length() - (1 + extension_postfix.length()));
else
throw new RuntimeException(method + " is specified as being postfix stripped on parameter " + postfix_parameter + ", but it's postfix is not '" + postfix + "' nor 'v'");
+
return result + extension_postfix;
}
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/StripPostfix.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/StripPostfix.java 2009-11-26 22:44:17 UTC (rev 3255)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/StripPostfix.java 2009-12-01 03:37:27 UTC (rev 3256)
@@ -48,4 +48,6 @@
public @interface StripPostfix {
String value(); // The parameter to deduce the postfix from
String extension() default "NULL";
+ boolean hasPostfix() default true;
+ String postfix() default "NULL";
}
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sync.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sync.java 2009-11-26 22:44:17 UTC (rev 3255)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sync.java 2009-12-01 03:37:27 UTC (rev 3256)
@@ -82,9 +82,10 @@
void glWaitSync(@GLpointer("GLsync") GLSync sync, @GLbitfield int flags, @GLuint64 long timeout);
- @StripPostfix("params")
+ @StripPostfix(value = "params", postfix = "64")
void glGetInteger64v(@GLenum int pname, @OutParameter @Check("1") @GLint64 LongBuffer params);
+ @StripPostfix("values")
void glGetSynciv(@GLpointer("GLsync") GLSync sync, @GLenum int pname,
@AutoSize("values") @GLsizei int bufSize,
@OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length,
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java 2009-11-26 22:44:17 UTC (rev 3255)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java 2009-12-01 03:37:27 UTC (rev 3256)
@@ -39,6 +39,15 @@
@DeprecatedGL
public interface EXT_direct_state_access {
+ /**
+ * Accepted by the <pname> parameter of GetBooleanIndexedvEXT,
+ * GetIntegerIndexedvEXT, GetFloatIndexedvEXT, GetDoubleIndexedvEXT:
+ * GetBooleani_v, GetIntegeri_v, GetFloati_vEXT, GetDoublei_vEXT:
+ */
+ int GL_PROGRAM_MATRIX_EXT = 0x8E2D;
+ int GL_TRANSPOSE_PROGRAM_MATRIX_EXT = 0x8E2E;
+ int GL_PROGRAM_MATRIX_STACK_DEPTH_EXT = 0x8E2F;
+
/*
OpenGL 1.1: New client commands
*/
@@ -183,16 +192,16 @@
@GLdouble Buffer pixels);
@StripPostfix("params")
- void glGetTextureParameterfvEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @OutParameter @Check("4")FloatBuffer params);
+ void glGetTextureParameterfvEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params);
@StripPostfix("params")
- void glGetTextureParameterivEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @OutParameter @Check("4")IntBuffer params);
+ void glGetTextureParameterivEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @OutParameter @Check("4") IntBuffer params);
@StripPostfix("params")
- void glGetTextureLevelParameterfvEXT(@GLuint int texture, @GLenum int target, int level, @GLenum int pname, @OutParameter @Check("4")FloatBuffer params);
+ void glGetTextureLevelParameterfvEXT(@GLuint int texture, @GLenum int target, int level, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params);
@StripPostfix("params")
- void glGetTextureLevelParameterivEXT(@GLuint int texture, @GLenum int target, int level, @GLenum int pname, @OutParameter @Check("4")IntBuffer params);
+ void glGetTextureLevelParameterivEXT(@GLuint int texture, @GLenum int target, int level, @GLenum int pname, @OutParameter @Check("4") IntBuffer params);
/*
OpenGL 1.2: New 3D texture object commands replace "Tex" in name with
@@ -460,6 +469,19 @@
void glDisableClientStateIndexedEXT(@GLenum int array, @GLuint int index);
/*
+ OpenGL 3.0: New indexed texture commands and queries append "i"
+ to name and add "uint index" parameter (to identify the texture
+ unit index) after state name parameters (if any) and before state
+ value parameters
+ */
+
+ @Dependent("OpenGL30")
+ void glEnableClientStateiEXT(@GLenum int array, @GLuint int index);
+
+ @Dependent("OpenGL30")
+ void glDisableClientStateiEXT(@GLenum int array, @GLuint int index);
+
+ /*
OpenGL 1.2.1: New indexed generic queries (added for indexed texture
state) append "Indexed" to name and add "uint index" parameter
(to identify the texture unit) after state name parameters (if any)
@@ -468,17 +490,36 @@
@Dependent("OpenGL13")
@StripPostfix("params")
- void glGetFloatIndexedvEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16")FloatBuffer params);
+ void glGetFloatIndexedvEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16") FloatBuffer params);
@Dependent("OpenGL13")
- @StripPostfix("params")
- void glGetDoubleIndexedvEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16")DoubleBuffer params);
+ @StripPostfix(value = "params", hasPostfix = false)
+ void glGetDoubleIndexedvEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16") DoubleBuffer params);
@Dependent("OpenGL13")
@StripPostfix("params")
void glGetPointerIndexedvEXT(@GLenum int pname, @GLuint int index, @Result @GLvoid ByteBuffer params);
/*
+ OpenGL 3.0: New indexed generic queries (added for indexed texture
+ state) replace "v" for "i_v" to name and add "uint index" parameter
+ (to identify the texture unit) after state name parameters (if any)
+ and before state value parameters
+ */
+
+ @Dependent("OpenGL30")
+ @StripPostfix("params")
+ void glGetFloati_vEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16") FloatBuffer params);
+
+ @Dependent("OpenGL30")
+ @StripPostfix("params")
+ void glGetDoublei_vEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16") DoubleBuffer params);
+
+ @Dependent("OpenGL30")
+ @StripPostfix(value = "params", hasPostfix = false)
+ void glGetPointeri_vEXT(@GLenum int pname, @GLuint int index, @Result @GLvoid ByteBuffer params);
+
+ /*
OpenGL 1.2.1: Extend the functionality of these EXT_draw_buffers2
commands and queries for multitexture
TODO: Why 1.2.1 and not EXT_draw_buffers2?
@@ -495,7 +536,7 @@
@Dependent("GL_EXT_draw_buffers2")
@StripPostfix("params")
- void glGetIntegerIndexedvEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16")IntBuffer params);
+ void glGetIntegerIndexedvEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16") IntBuffer params);
@Dependent("GL_EXT_draw_buffers2")
@StripPostfix("params")
@@ -514,26 +555,26 @@
@Dependent("GL_ARB_vertex_program")
@StripPostfix("params")
- void glNamedProgramLocalParameter4dvEXT(@GLuint int program, @GLenum int target, @GLuint int index, @Const @Check("4")DoubleBuffer params);
+ void glNamedProgramLocalParameter4dvEXT(@GLuint int program, @GLenum int target, @GLuint int index, @Const @Check("4") DoubleBuffer params);
@Dependent("GL_ARB_vertex_program")
void glNamedProgramLocalParameter4fEXT(@GLuint int program, @GLenum int target, @GLuint int index, float x, float y, float z, float w);
@Dependent("GL_ARB_vertex_program")
@StripPostfix("params")
- void glNamedProgramLocalParameter4fvEXT(@GLuint int program, @GLenum int target, @GLuint int index, @Const @Check("4")FloatBuffer params);
+ void glNamedProgramLocalParameter4fvEXT(@GLuint int program, @GLenum int target, @GLuint int index, @Const @Check("4") FloatBuffer params);
@Dependent("GL_ARB_vertex_program")
@StripPostfix("params")
- void glGetNamedProgramLocalParameterdvEXT(@GLuint int program, @GLenum int target, @GLuint int index, @OutParameter @Check("4")DoubleBuffer params);
+ void glGetNamedProgramLocalParameterdvEXT(@GLuint int program, @GLenum int target, @GLuint int index, @OutParameter @Check("4") DoubleBuffer params);
@Dependent("GL_ARB_vertex_program")
@StripPostfix("params")
- void glGetNamedProgramLocalParameterfvEXT(@GLuint int program, @GLenum int target, @GLuint int index, @OutParameter @Check("4")FloatBuffer params);
+ void glGetNamedProgramLocalParameterfvEXT(@GLuint int program, @GLenum int target, @GLuint int index, @OutParameter @Check("4") FloatBuffer params);
@Dependent("GL_ARB_vertex_program")
@StripPostfix("params")
- void glGetNamedProgramivEXT(@GLuint int program, @GLenum int target, @GLenum int pname, @OutParameter @Check("4")IntBuffer params);
+ void glGetNamedProgramivEXT(@GLuint int program, @GLenum int target, @GLenum int pname, @OutParameter @Check("4") IntBuffer params);
@Dependent("GL_ARB_vertex_program")
void glGetNamedProgramStringEXT(@GLuint int program, @GLenum int target, @GLenum int pname, @OutParameter @Check @GLvoid ByteBuffer string);
@@ -748,7 +789,7 @@
@Dependent("OpenGL15")
@StripPostfix("params")
- void glGetNamedBufferParameterivEXT(@GLuint int buffer, @GLenum int pname, @OutParameter @Check("4")IntBuffer params);
+ void glGetNamedBufferParameterivEXT(@GLuint int buffer, @GLenum int pname, @OutParameter @Check("4") IntBuffer params);
@Dependent("OpenGL15")
@StripPostfix("params")
@@ -1015,14 +1056,14 @@
void glGetNamedProgramLocalParameterIuivEXT(@GLuint int program, @GLenum int target, @GLuint int index, @Check("4") @OutParameter @GLuint IntBuffer params);
/*
- EXT_framebuffer_object: New renderbuffer commands add "Named" prefix
- to name and replace "enum target" with "uint renderbuffer"
+ OpenGL 3.0: New renderbuffer commands add "Named" prefix to name
+ and replace "enum target" with "uint renderbuffer"
*/
- @Dependent("GL_EXT_framebuffer_object")
+ @Dependent("OpenGL30,GL_EXT_framebuffer_object")
void glNamedRenderbufferStorageEXT(@GLuint int renderbuffer, @GLenum int internalformat, @GLsizei int width, @GLsizei int height);
- @Dependent("GL_EXT_framebuffer_object")
+ @Dependent("OpenGL30,GL_EXT_framebuffer_object")
@StripPostfix("params")
void glGetNamedRenderbufferParameterivEXT(@GLuint int renderbuffer, @GLenum int pname, @Check("4") @OutParameter IntBuffer params);
@@ -1031,7 +1072,7 @@
prefix to name and replace "enum target" with "uint renderbuffer"
*/
- @Dependent("GL_EXT_framebuffer_multisample")
+ @Dependent("OpenGL30,GL_EXT_framebuffer_multisample")
void glNamedRenderbufferStorageMultisampleEXT(@GLuint int renderbuffer, @GLsizei int samples, @GLenum int internalformat, @GLsizei int width, @GLsizei int height);
/*
@@ -1044,80 +1085,87 @@
void glNamedRenderbufferStorageMultisampleCoverageEXT(@GLuint int renderbuffer, @GLsizei int coverageSamples, @GLsizei int colorSamples, @GLenum int internalformat, @GLsizei int width, @GLsizei int height);
/*
- EXT_framebuffer_object: New framebuffer commands add "Named" prefix
- to name and replace "enum target" with "uint framebuffer"
+ OpenGL 3.0: New framebuffer commands add "Named" prefix to name
+ and replace "enum target" with "uint framebuffer"
*/
- @Dependent("GL_EXT_framebuffer_object")
+ @Dependent("OpenGL30,GL_EXT_framebuffer_object")
@GLenum
int glCheckNamedFramebufferStatusEXT(@GLuint int framebuffer, @GLenum int target);
- @Dependent("GL_EXT_framebuffer_object")
+ @Dependent("OpenGL30,GL_EXT_framebuffer_object")
void glNamedFramebufferTexture1DEXT(@GLuint int framebuffer, @GLenum int attachment, @GLenum int textarget, @GLuint int texture, int level);
- @Dependent("GL_EXT_framebuffer_object")
+ @Dependent("OpenGL30,GL_EXT_framebuffer_object")
void glNamedFramebufferTexture2DEXT(@GLuint int framebuffer, @GLenum int attachment, @GLenum int textarget, @GLuint int texture, int level);
- @Dependent("GL_EXT_framebuffer_object")
+ @Dependent("OpenGL30,GL_EXT_framebuffer_object")
void glNamedFramebufferTexture3DEXT(@GLuint int framebuffer, @GLenum int attachment, @GLenum int textarget, @GLuint int texture, int level, int zoffset);
- @Dependent("GL_EXT_framebuffer_object")
+ @Dependent("OpenGL30,GL_EXT_framebuffer_object")
void glNamedFramebufferRenderbufferEXT(@GLuint int framebuffer, @GLenum int attachment, @GLenum int renderbuffertarget, @GLuint int renderbuffer);
- @Dependent("GL_EXT_framebuffer_object")
+ @Dependent("OpenGL30,GL_EXT_framebuffer_object")
@StripPostfix("params")
void glGetNamedFramebufferAttachmentParameterivEXT(@GLuint int framebuffer, @GLenum int attachment, @GLenum int pname, @Check("4") @OutParameter IntBuffer params);
/*
- EXT_framebuffer_object: New texture commands add "Texture" within
- name and replace "enum target" with "uint texture"
+ OpenGL 3.0: New texture commands add "Texture" within name and
+ replace "enum target" with "uint texture"
*/
- @Dependent("GL_EXT_framebuffer_object")
+ @Dependent("OpenGL30,GL_EXT_framebuffer_object")
void glGenerateTextureMipmapEXT(@GLuint int texture, @GLenum int target);
/*
- EXT_framebuffer_object: New texture commands add "MultiTex" within
- name and replace "enum target" with "enum texunit"
+ OpenGL 3.0: New texture commands add "MultiTex" within name and
+ replace "enum target" with "enum texunit"
*/
- @Dependent("GL_EXT_framebuffer_object")
+ @Dependent("OpenGL30,GL_EXT_framebuffer_object")
void glGenerateMultiTexMipmapEXT(@GLenum int texunit, @GLenum int target);
/*
- EXT_framebuffer_object: New framebuffer commands
+ OpenGL 3.0: New framebuffer commands
*/
- @Dependent("GL_EXT_framebuffer_object")
+ @Dependent("OpenGL30,GL_EXT_framebuffer_object")
void glFramebufferDrawBufferEXT(@GLuint int framebuffer, @GLenum int mode);
- @Dependent("GL_EXT_framebuffer_object")
+ @Dependent("OpenGL30,GL_EXT_framebuffer_object")
void glFramebufferDrawBuffersEXT(@GLuint int framebuffer, @AutoSize("bufs") @GLsizei int n, @Const @GLenum IntBuffer bufs);
- @Dependent("GL_EXT_framebuffer_object")
+ @Dependent("OpenGL30,GL_EXT_framebuffer_object")
void glFramebufferReadBufferEXT(@GLuint int framebuffer, @GLenum int mode);
/*
- EXT_framebuffer_object: New framebuffer query
+ OpenGL 3.0: New framebuffer query
*/
- @Dependent("GL_EXT_framebuffer_object")
+ @Dependent("OpenGL30,GL_EXT_framebuffer_object")
@StripPostfix("param")
void glGetFramebufferParameterivEXT(@GLuint int framebuffer, @GLenum int pname, @Check("4") @OutParameter IntBuffer param);
/*
- EXT_geometry_shader4 or NV_gpu_program4: New framebuffer commands
+ OpenGL 3.1: New buffer data copy command
+ */
+
+ @Dependent("OpenGL31,GL_ARB_copy_buffer")
+ void glNamedCopyBufferSubDataEXT(@GLuint int readBuffer, @GLuint int writeBuffer, @GLintptr long readoffset, @GLintptr long writeoffset, @GLsizeiptr long size);
+
+ /*
+ EXT_geometry_shader4 or NV_geometry_program4: New framebuffer commands
add "Named" prefix to name and replace "enum target" with "uint
framebuffer"
*/
- @Dependent("GL_EXT_geometry_shader4")
+ @Dependent("GL_EXT_geometry_shader4,NV_geometry_program4")
void glNamedFramebufferTextureEXT(@GLuint int framebuffer, @GLenum int attachment, @GLuint int texture, int level);
- @Dependent("GL_EXT_geometry_shader4")
+ @Dependent("GL_EXT_geometry_shader4,NV_geometry_program4")
void glNamedFramebufferTextureLayerEXT(@GLuint int framebuffer, @GLenum int attachment, @GLuint int texture, int level, int layer);
- @Dependent("GL_EXT_geometry_shader4")
+ @Dependent("GL_EXT_geometry_shader4,NV_geometry_program4")
void glNamedFramebufferTextureFaceEXT(@GLuint int framebuffer, @GLenum int attachment, @GLuint int texture, int level, @GLenum int face);
/*
@@ -1138,4 +1186,109 @@
@Dependent("GL_NV_explicit_multisample")
void glMultiTexRenderbufferEXT(@GLenum int texunit, @GLenum int target, @GLuint int renderbuffer);
+ /*
+ OpenGL 3.0: New vertex array specification commands for vertex
+ array objects prefix "VertexArray", add initial "uint vaobj" and
+ "uint buffer" parameters, change "Pointer" suffix to "Offset",
+ and change the final parameter from "const void *" to "intptr offset"
+ */
+
+ @Dependent("OpenGL30")
+ @DeprecatedGL
+ void glVertexArrayVertexOffsetEXT(@GLuint int vaobj, @GLuint int buffer, int size, @GLenum int type, @GLsizei int stride, @GLintptr long offset);
+
+ @Dependent("OpenGL30")
+ @DeprecatedGL
+ void glVertexArrayColorOffsetEXT(@GLuint int vaobj, @GLuint int buffer, int size, @GLenum int type, @GLsizei int stride, @GLintptr long offset);
+
+ @Dependent("OpenGL30")
+ @DeprecatedGL
+ void glVertexArrayEdgeFlagOffsetEXT(@GLuint int vaobj, @GLuint int buffer, @GLsizei int stride, @GLintptr long offset);
+
+ @Dependent("OpenGL30")
+ void glVertexArrayIndexOffsetEXT(@GLuint int vaobj, @GLuint int buffer, @GLenum int type, @GLsizei int stride, @GLintptr long offset);
+
+ @Dependent("OpenGL30")
+ @DeprecatedGL
+ void glVertexArrayNormalOffsetEXT(@GLuint int vaobj, @GLuint int buffer, @GLenum int type, @GLsizei int stride, @GLintptr long offset);
+
+ @Dependent("OpenGL30")
+ @DeprecatedGL
+ void glVertexArrayTexCoordOffsetEXT(@GLuint int vaobj, @GLuint int buffer, int size, @GLenum int type, @GLsizei int stride, @GLintptr long offset);
+
+ @Dependent("OpenGL30")
+ @DeprecatedGL
+ void glVertexArrayMultiTexCoordOffsetEXT(@GLuint int vaobj, @GLuint int buffer, @GLenum int texunit, int size, @GLenum int type, @GLsizei int stride, @GLintptr long offset);
+
+ @Dependent("OpenGL30")
+ @DeprecatedGL
+ void glVertexArrayFogCoordOffsetEXT(@GLuint int vaobj, @GLuint int buffer, @GLenum int type, @GLsizei int stride, @GLintptr long offset);
+
+ @Dependent("OpenGL30")
+ @DeprecatedGL
+ void glVertexArraySecondaryColorOffsetEXT(@GLuint int vaobj, @GLuint int buffer, int size, @GLenum int type, @GLsizei int stride, @GLintptr long offset);
+
+ @Dependent("OpenGL30")
+ void glVertexArrayVertexAttribOffsetEXT(@GLuint int vaobj, @GLuint int buffer, @GLuint int index, int size, @GLenum int type, boolean normalized, @GLsizei int stride, @GLintptr long offset);
+
+ @Dependent("OpenGL30")
+ void glVertexArrayVertexAttribIOffsetEXT(@GLuint int vaobj, @GLuint int buffer, @GLuint int index, int size, @GLenum int type, @GLsizei int stride, @GLintptr long offset);
+
+ /*
+ OpenGL 3.0: New vertex array enable commands for vertex array
+ objects change "ClientState" to "VertexArray" and add an initial
+ "uint vaobj" parameter
+ */
+
+ @Dependent("OpenGL30")
+ void glEnableVertexArrayEXT(@GLuint int vaobj, @GLenum int array);
+
+ @Dependent("OpenGL30")
+ void glDisableVertexArrayEXT(@GLuint int vaobj, @GLenum int array);
+
+ /*
+ OpenGL 3.0: New vertex attrib array enable commands for vertex
+ array objects change "VertexAttribArray" to "VertexArrayAttrib"
+ and add an initial "uint vaobj" parameter
+ */
+
+ @Dependent("OpenGL30")
+ void glEnableVertexArrayAttribEXT(@GLuint int vaobj, @GLuint int index);
+
+ @Dependent("OpenGL30")
+ void glDisableVertexArrayAttribEXT(@GLuint int vaobj, @GLuint int index);
+
+ /*
+ OpenGL 3.0: New queries for vertex array objects
+ */
+
+ @Dependent("OpenGL30")
+ @StripPostfix("param")
+ void glGetVertexArrayIntegervEXT(@GLuint int vaobj, @GLenum int pname, @OutParameter @Check("16") IntBuffer param);
+
+ @Dependent("OpenGL30")
+ @StripPostfix("param")
+ void glGetVertexArrayPointervEXT(@GLuint int vaobj, @GLenum int pname, @Result @GLvoid ByteBuffer param);
+
+ @Dependent("OpenGL30")
+ @StripPostfix(value = "param", hasPostfix = false)
+ void glGetVertexArrayIntegeri_vEXT(@GLuint int vaobj, @GLuint int index, @GLenum int pname, @OutParameter @Check("16") IntBuffer param);
+
+ @Dependent("OpenGL30")
+ @StripPostfix(value = "param", hasPostfix = false)
+ void glGetVertexArrayPointeri_vEXT(@GLuint int vaobj, @GLuint int index, @GLenum int pname, @Result @GLvoid ByteBuffer param);
+
+ /*
+ OpenGL 3.0: New buffer commands replace "Buffer" with "NamedBuffer"
+ in name and replace "enum target" parameter with "uint buffer"
+ */
+
+ @Dependent("OpenGL30")
+ @CachedResult
+ @GLvoid
+ ByteBuffer glMapNamedBufferRangeEXT(@GLuint int buffer, @GLintptr long offset, @GLsizeiptr long length, @GLbitfield int access);
+
+ @Dependent("OpenGL30")
+ void glFlushMappedNamedBufferRangeEXT(@GLuint int buffer, @GLintptr long offset, @GLsizeiptr long length);
+
}
\ No newline at end of file
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL30.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL30.java 2009-11-26 22:44:17 UTC (rev 3255)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL30.java 2009-12-01 03:37:27 UTC (rev 3256)
@@ -725,7 +725,7 @@
void glColorMaski(@GLuint int buf, boolean r, boolean g, boolean b, boolean a);
- @StripPostfix("data")
+ @StripPostfix(value = "data", hasPostfix = false)
void glGetBooleani_v(@GLenum int value, @GLuint int index, @OutParameter @Check("4") @GLboolean ByteBuffer data);
@StripPostfix("data")
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL32.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL32.java 2009-11-26 22:44:17 UTC (rev 3255)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL32.java 2009-12-01 03:37:27 UTC (rev 3256)
@@ -304,9 +304,13 @@
void glWaitSync(@GLpointer("GLsync") GLSync sync, @GLbitfield int flags, @GLuint64 long timeout);
- @StripPostfix("params")
- void glGetInteger64v(@GLenum int pname, @OutParameter @Check("1") @GLint64 LongBuffer params);
+ @StripPostfix(value = "data", postfix = "64")
+ void glGetInteger64v(@GLenum int pname, @OutParameter @Check("1") @GLint64 LongBuffer data);
+ @StripPostfix(value = "data", postfix = "64")
+ void glGetInteger64i_v(@GLenum int value, @GLuint int index, @OutParameter @Check("4") @GLint64 LongBuffer data);
+
+ @StripPostfix("values")
void glGetSynciv(@GLpointer("GLsync") GLSync sync, @GLenum int pname,
@AutoSize("values") @GLsizei int bufSize,
@OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length,
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_geometry_program4.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_geometry_program4.java 2009-11-26 22:44:17 UTC (rev 3255)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_geometry_program4.java 2009-12-01 03:37:27 UTC (rev 3256)
@@ -53,4 +53,6 @@
void glFramebufferTextureLayerEXT(@GLenum int target, @GLenum int attachment, @GLuint int texture, int level, int layer);
+ void glFramebufferTextureFaceEXT(@GLenum int target, @GLenum int attachment, @GLuint int texture, int level, @GLenum int face);
+
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2009-12-02 23:11:25
|
Revision: 3259
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3259&view=rev
Author: matzon
Date: 2009-12-02 23:11:14 +0000 (Wed, 02 Dec 2009)
Log Message:
-----------
call InitCommonControls if no display has been created prior to Alert
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java
trunk/LWJGL/src/native/windows/org_lwjgl_Sys.c
Modified: trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java 2009-12-01 15:12:52 UTC (rev 3258)
+++ trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java 2009-12-02 23:11:14 UTC (rev 3259)
@@ -94,9 +94,13 @@
}
public void alert(String title, String message) {
+ if(!Display.isCreated()) {
+ initCommonControls();
+ }
nAlert(getHwnd(), title, message);
}
private static native void nAlert(long parent_hwnd, String title, String message);
+ private static native void initCommonControls();
public boolean openURL(final String url) {
try {
Modified: trunk/LWJGL/src/native/windows/org_lwjgl_Sys.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_Sys.c 2009-12-01 15:12:52 UTC (rev 3258)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_Sys.c 2009-12-02 23:11:14 UTC (rev 3259)
@@ -44,6 +44,7 @@
#include "org_lwjgl_WindowsSysImplementation.h"
#include "common_tools.h"
#include <malloc.h>
+#include <commctrl.h>
JNIEXPORT jlong JNICALL Java_org_lwjgl_WindowsSysImplementation_nGetTime(JNIEnv * env, jclass unused) {
DWORD time;
@@ -67,6 +68,10 @@
free(cTitleBarText);
}
+JNIEXPORT void JNICALL Java_org_lwjgl_WindowsSysImplementation_initCommonControls(JNIEnv * env, jclass unused) {
+ InitCommonControls();
+}
+
JNIEXPORT jstring JNICALL Java_org_lwjgl_WindowsSysImplementation_nGetClipboard
(JNIEnv * env, jclass unused)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2009-12-04 04:49:39
|
Revision: 3260
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3260&view=rev
Author: spasi
Date: 2009-12-04 04:49:19 +0000 (Fri, 04 Dec 2009)
Log Message:
-----------
Added generator support for null-terminated string lists.
Fixed GetUniformIndices and TransformFeedbackVaryings.
Added a ARB_uniform_buffer_object test.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/NullTerminated.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/TypedefsGenerator.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_transform_feedback.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL30.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/shaderUNI.vsh
trunk/LWJGL/src/java/org/lwjgl/util/generator/StringList.java
Modified: trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2009-12-02 23:11:14 UTC (rev 3259)
+++ trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2009-12-04 04:49:19 UTC (rev 3260)
@@ -74,6 +74,17 @@
}
}
+ 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 ( nullFound < count )
+ throw new IllegalArgumentException("Missing null termination");
+ }
+
public static void checkNotNull(Object o) {
if (o == null)
throw new IllegalArgumentException("Null argument");
Added: trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java 2009-12-04 04:49:19 UTC (rev 3260)
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * Created by LWJGL.
+ * User: spasi
+ * Date: 2009-12-04
+ */
+
+package org.lwjgl.test.opengl.shaders;
+
+import org.lwjgl.BufferUtils;
+import org.lwjgl.opengl.ARBUniformBufferObject;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL20;
+
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+
+final class ShaderUNI extends Shader {
+
+ final String file;
+ final ByteBuffer source;
+
+ final int shaderID;
+ final int programID;
+
+ final int uniformA;
+ final int uniformB;
+
+ ShaderUNI(final String shaderFile) {
+ file = shaderFile;
+ source = getShaderText(shaderFile);
+
+ shaderID = GL20.glCreateShader(GL20.GL_VERTEX_SHADER);
+ GL20.glShaderSource(shaderID, source);
+ GL20.glCompileShader(shaderID);
+
+ printShaderObjectInfoLog(file, shaderID);
+
+ GL20.glGetShader(shaderID, GL20.GL_COMPILE_STATUS, programBuffer);
+ if ( programBuffer.get(0) == GL11.GL_FALSE )
+ ShadersTest.kill("A compilation error occured in a vertex shader.");
+
+ programID = GL20.glCreateProgram();
+
+ GL20.glAttachShader(programID, shaderID);
+ GL20.glLinkProgram(programID);
+
+ printShaderProgramInfoLog(programID);
+
+ GL20.glGetProgram(programID, GL20.GL_LINK_STATUS, programBuffer);
+ if ( programBuffer.get(0) == GL11.GL_FALSE )
+ ShadersTest.kill("A linking error occured in a shader program.");
+
+ uniformA = getUniformLocation(programID, "uniformA");
+ uniformB = getUniformLocation(programID, "uniformB");
+
+ String[] uniformNames = { "uniformA", "uniformB" };
+ IntBuffer tmp = BufferUtils.createIntBuffer(uniformNames.length);
+
+ ARBUniformBufferObject.glGetUniformIndices(programID, toByteBuffer(uniformNames), tmp);
+
+ System.out.println("uniformA index = " + tmp.get(0));
+ System.out.println("uniformB index = " + tmp.get(1));
+ }
+
+ private static ByteBuffer toByteBuffer(String[] strs) {
+ int length = 0;
+ for ( int i = 0; i < strs.length; i++ )
+ length += strs[i].length() + 1; // +1 for the NULL-character
+
+ final ByteBuffer buff = BufferUtils.createByteBuffer(length);
+ for ( int i = 0; i < strs.length; i++ ) {
+ buff.put(strs[i].getBytes());
+ buff.put((byte)0); // The ending NULL-character
+ }
+ buff.flip();
+
+ return buff;
+ }
+
+ void render() {
+ GL20.glUseProgram(programID);
+
+ GL20.glUniform2f(uniformA, ShadersTest.getSin(), ShadersTest.getSpecularity() * 8.0f);
+ GL20.glUniform3f(uniformB, 0.0f, 0.7f, 0.0f);
+
+ ShadersTest.renderObject();
+
+ GL20.glUseProgram(0);
+ }
+
+ void cleanup() {
+ GL20.glDetachShader(programID, shaderID);
+
+ GL20.glDeleteShader(shaderID);
+ GL20.glDeleteProgram(programID);
+ }
+
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java 2009-12-02 23:11:14 UTC (rev 3259)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java 2009-12-04 04:49:19 UTC (rev 3260)
@@ -1,31 +1,31 @@
-/*
+/*
* Copyright (c) 2002-2008 LWJGL Project
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
+ * modification, are permitted provided that the following conditions are
* met:
- *
- * * Redistributions of source code must retain the above copyright
+ *
+ * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@@ -45,11 +45,7 @@
import org.lwjgl.Sys;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
-import org.lwjgl.opengl.Display;
-import org.lwjgl.opengl.DisplayMode;
-import org.lwjgl.opengl.GL11;
-import org.lwjgl.opengl.GLContext;
-import org.lwjgl.opengl.PixelFormat;
+import org.lwjgl.opengl.*;
import org.lwjgl.util.glu.GLU;
import org.lwjgl.util.glu.Sphere;
@@ -92,7 +88,8 @@
lastFrameTime = frameStart;
- angle += frameTime * 90.0f;
+ //angle += frameTime * 90.0f;
+ angle += 0.1f;
sin = (float)Math.sin(Math.toRadians(angle));
handleIO();
@@ -138,7 +135,7 @@
System.out.println("Setting display mode to: " + displayMode);
Display.setDisplayMode(displayMode);
- Display.create(new PixelFormat(8, 24, 0));
+ Display.create(new PixelFormat(8, 24, 0), "UNI".equalsIgnoreCase(args[0]) ? new ContextAttribs(3, 1) : null);
ShadersTest.displayMode = displayMode;
} catch (LWJGLException e) {
kill(e.getMessage());
@@ -170,6 +167,11 @@
kill("The ARB_fragment_shader extension is not supported.");
shader = new ShaderFSH("shaderFSH.vsh", "shaderFSH.fsh");
+ } else if ("UNI".equalsIgnoreCase(args[0]) ) {
+ if ( !GLContext.getCapabilities().OpenGL31 )
+ kill("OpenGL version 3.1 is not supported.");
+
+ shader = new ShaderUNI("shaderUNI.vsh");
} else {
argsError();
}
Added: trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/shaderUNI.vsh
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/shaderUNI.vsh (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/shaderUNI.vsh 2009-12-04 04:49:19 UTC (rev 3260)
@@ -0,0 +1,25 @@
+#version 140
+
+uniform vec2 uniformA;
+uniform vec3 uniformB;
+
+void main(void) {
+ gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+
+ vec3 normal = gl_NormalMatrix * gl_Normal;
+
+ float diffuseDot = max(dot(normal, vec3(gl_LightSource[0].position)), 0.0);
+ float specularDot = max(dot(normal, vec3(gl_LightSource[0].halfVector)), 0.0);
+ specularDot = pow(specularDot, uniformA.y);
+
+ // Normalize position, to get a {-1..1} value for each vertex.
+ // Multiply with current sin.
+ vec3 color3D = normalize(vec3(gl_Vertex)) * uniformA.x;
+ // {-1..1} => {0..1} & Intensify colors.
+ color3D = (color3D * 0.5 + 0.5) * 2.0;
+
+ // Accumulate color contributions.
+ color3D = diffuseDot * (uniformB + color3D) + vec3(gl_LightModel.ambient);
+ gl_FrontColor.rgb = specularDot * vec3(gl_LightSource[0].specular) + color3D;
+ gl_FrontColor.a = 1.0;
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2009-12-02 23:11:14 UTC (rev 3259)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2009-12-04 04:49:19 UTC (rev 3260)
@@ -41,8 +41,6 @@
* $Id$
*/
-import org.lwjgl.opengl.PointerWrapper;
-
import com.sun.mirror.apt.*;
import com.sun.mirror.declaration.*;
import com.sun.mirror.type.*;
@@ -471,23 +469,23 @@
check_value = check_annotation.value();
can_be_null = check_annotation.canBeNull();
}
- boolean null_terminated = param.getAnnotation(NullTerminated.class) != null;
+ NullTerminated null_terminated = param.getAnnotation(NullTerminated.class);
if (Buffer.class.isAssignableFrom(java_type)) {
boolean indirect_buffer_allowed = param.getAnnotation(CachedReference.class) == null;
boolean out_parameter = param.getAnnotation(OutParameter.class) != null;
TypeInfo typeinfo = typeinfos.get(param);
printParameterCheck(writer, param.getSimpleName(), typeinfo.getType().getSimpleName(), check_value, can_be_null, null_terminated, indirect_buffer_allowed, out_parameter);
- } else if (String.class.equals(java_type)) {
+ } else if ( String.class.equals(java_type)) {
if (!can_be_null)
writer.println("\t\tBufferChecks.checkNotNull(" + param.getSimpleName() + ");");
}
}
}
if (method.getAnnotation(CachedResult.class) != null)
- printParameterCheck(writer, Utils.CACHED_BUFFER_NAME, null, null, true, false, false, false);
+ printParameterCheck(writer, Utils.CACHED_BUFFER_NAME, null, null, true, null, false, false);
}
- private static void printParameterCheck(PrintWriter writer, String name, String type, String check_value, boolean can_be_null, boolean null_terminated, boolean indirect_buffer_allowed, boolean out_parameter) {
+ private static void printParameterCheck(PrintWriter writer, String name, String type, String check_value, boolean can_be_null, NullTerminated null_terminated, boolean indirect_buffer_allowed, boolean out_parameter) {
if (indirect_buffer_allowed && out_parameter) {
writer.println("\t\t" + type + " " + name + SAVED_PARAMETER_POSTFIX + " = " + name + ";");
}
@@ -507,8 +505,15 @@
writer.print("Direct(" + name);
}
writer.println(");");
- if (null_terminated)
- writer.println("\t\tBufferChecks.checkNullTerminated(" + name + ");");
+ if (null_terminated != null) {
+ writer.print("\t\tBufferChecks.checkNullTerminated(");
+ writer.print(name);
+ if ( null_terminated.value().length() > 0 ) {
+ writer.print(", ");
+ writer.print(null_terminated.value());
+ }
+ writer.println(");");
+ }
}
private static void printResultType(PrintWriter writer, MethodDeclaration method, boolean native_stub) {
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2009-12-02 23:11:14 UTC (rev 3259)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2009-12-04 04:49:19 UTC (rev 3260)
@@ -52,6 +52,7 @@
public class NativeMethodStubsGenerator {
private static final String BUFFER_ADDRESS_POSTFIX = "_address";
public static final String BUFFER_POSITION_POSTFIX = "_position";
+ private static final String STRING_LIST_POSTFIX = "_str";
public static void generateNativeMethodStubs(AnnotationProcessorEnvironment env, TypeMap type_map, PrintWriter writer, InterfaceDeclaration d, boolean generate_error_checks, boolean context_specific) {
for (MethodDeclaration method : d.getMethods()) {
@@ -120,6 +121,7 @@
writer.print(" = (" + typedef_name + ")((intptr_t)");
writer.println(Utils.FUNCTION_POINTER_VAR_NAME + ");");
}
+ generateStringListInits(writer, method.getParameters());
writer.print("\t");
if (!result_type.equals(env.getTypeUtils().getVoidType())) {
Declaration return_declaration;
@@ -197,17 +199,21 @@
writer.print(Utils.RESULT_VAR_NAME);
} else {
writer.print(param.getSimpleName());
- if (Utils.isAddressableType(param.getType())) {
+ if ( param.getAnnotation(StringList.class) != null )
+ writer.print(STRING_LIST_POSTFIX);
+ else if (Utils.isAddressableType(param.getType()))
writer.print(BUFFER_ADDRESS_POSTFIX);
- }
}
}
private static void generateStringDeallocations(PrintWriter writer, Collection<ParameterDeclaration> params) {
- for (ParameterDeclaration param : params)
+ for (ParameterDeclaration param : params) {
if (Utils.getJavaType(param.getType()).equals(String.class) &&
param.getAnnotation(Result.class) == null)
writer.println("\tfree(" + param.getSimpleName() + BUFFER_ADDRESS_POSTFIX + ");");
+ else if (param.getAnnotation(StringList.class) != null ) // Free the string array mem
+ writer.println("\tfree(" + param.getSimpleName() + STRING_LIST_POSTFIX + ");");
+ }
}
private static void generateBufferParameterAddresses(TypeMap type_map, PrintWriter writer, MethodDeclaration method, Mode mode) {
@@ -249,5 +255,34 @@
throw new RuntimeException("Illegal type " + java_type);
}
writer.println(";");
+
+ if ( param.getAnnotation(StringList.class) != null ) {
+ if ( param.getAnnotation(GLchar.class) == null ||
+ param.getAnnotation(NullTerminated.class) == null ||
+ param.getAnnotation(NullTerminated.class).value().length() == 0
+ )
+ throw new RuntimeException("StringList annotation can only be applied on null-terminated GLchar buffers.");
+
+ // Declare string array and loop counters
+ writer.print("\tGLchar **" + param.getSimpleName() + STRING_LIST_POSTFIX + "; ");
+ writer.println("\tunsigned int " + param.getSimpleName() + "_i = 0;");
+ writer.println("\tGLchar *" + param.getSimpleName() + "_next = (GLchar *)" + param.getSimpleName() + BUFFER_ADDRESS_POSTFIX + ";");
+ }
}
+
+ private static void generateStringListInits(PrintWriter writer, Collection<ParameterDeclaration> params) {
+ for ( ParameterDeclaration param : params ) {
+ StringList stringList_annotation = param.getAnnotation(StringList.class);
+ if ( stringList_annotation != null ) {
+ // Allocate the string array
+ writer.println("\t" + param.getSimpleName() + STRING_LIST_POSTFIX + " = (GLchar **) malloc(" + stringList_annotation.value() + "*sizeof(GLchar*));");
+ // Fill string array with the string pointers
+ writer.println("\tdo {");
+ writer.println("\t\t" + param.getSimpleName() + STRING_LIST_POSTFIX + "[" + param.getSimpleName() + "_i++] = " + param.getSimpleName() + "_next;");
+ writer.println("\t\t" + param.getSimpleName() + "_next += strlen(" + param.getSimpleName() + "_next) + 1;");
+ writer.println("\t} while ( " + param.getSimpleName() + "_i < " + stringList_annotation.value() + " );");
+ }
+ }
+ }
+
}
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/NullTerminated.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/NullTerminated.java 2009-12-02 23:11:14 UTC (rev 3259)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/NullTerminated.java 2009-12-04 04:49:19 UTC (rev 3260)
@@ -46,4 +46,5 @@
@Target(ElementType.PARAMETER)
public @interface NullTerminated {
+ String value() default "";
}
Added: trunk/LWJGL/src/java/org/lwjgl/util/generator/StringList.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/StringList.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/StringList.java 2009-12-04 04:49:19 UTC (rev 3260)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator;
+
+/**
+ *
+ * @author spasi <sp...@us...>
+ */
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+@Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface StringList {
+ String value();
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/TypedefsGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/TypedefsGenerator.java 2009-12-02 23:11:14 UTC (rev 3259)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/TypedefsGenerator.java 2009-12-04 04:49:19 UTC (rev 3260)
@@ -76,7 +76,7 @@
NativeTypeTranslator translator = new NativeTypeTranslator(type_map, param);
param.getType().accept(translator);
writer.print(translator.getSignature());
- if (param.getAnnotation(Result.class) != null || param.getAnnotation(Indirect.class) != null)
+ if (param.getAnnotation(Result.class) != null || param.getAnnotation(Indirect.class) != null || param.getAnnotation(StringList.class) != null)
writer.print("*");
writer.print(" " + param.getSimpleName());
}
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java 2009-12-02 23:11:14 UTC (rev 3259)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java 2009-12-04 04:49:19 UTC (rev 3260)
@@ -99,7 +99,7 @@
int GL_INVALID_INDEX = 0xFFFFFFFF;
void glGetUniformIndices(@GLuint int program, @AutoSize("uniformIndices") @GLsizei int uniformCount,
- @Const @NullTerminated @GLchar ByteBuffer uniformNames,
+ @Const @NullTerminated("uniformIndices.remaining()") @GLchar @StringList("uniformCount") ByteBuffer uniformNames,
@OutParameter @GLuint IntBuffer uniformIndices);
@StripPostfix("params")
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_transform_feedback.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_transform_feedback.java 2009-12-02 23:11:14 UTC (rev 3259)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_transform_feedback.java 2009-12-04 04:49:19 UTC (rev 3260)
@@ -101,7 +101,9 @@
void glEndTransformFeedbackEXT();
- void glTransformFeedbackVaryingsEXT(@GLuint int program, @GLsizei int count, @Const @NullTerminated @GLchar ByteBuffer varyings, @GLenum int bufferMode);
+ void glTransformFeedbackVaryingsEXT(@GLuint int program, @GLsizei int count,
+ @Const @NullTerminated("count") @GLchar @StringList("count") ByteBuffer varyings,
+ @GLenum int bufferMode);
void glGetTransformFeedbackVaryingEXT(@GLuint int program, @GLuint int index,
@AutoSize("name") @GLsizei int bufSize,
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL30.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL30.java 2009-12-02 23:11:14 UTC (rev 3259)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL30.java 2009-12-04 04:49:19 UTC (rev 3260)
@@ -864,7 +864,9 @@
void glEndTransformFeedback();
- void glTransformFeedbackVaryings(@GLuint int program, @GLsizei int count, @Const @NullTerminated @GLchar ByteBuffer varyings, @GLenum int bufferMode);
+ void glTransformFeedbackVaryings(@GLuint int program, @GLsizei int count,
+ @Const @NullTerminated("count") @GLchar @StringList("count") ByteBuffer varyings,
+ @GLenum int bufferMode);
void glGetTransformFeedbackVarying(@GLuint int program, @GLuint int index,
@AutoSize("name") @GLsizei int bufSize,
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java 2009-12-02 23:11:14 UTC (rev 3259)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java 2009-12-04 04:49:19 UTC (rev 3260)
@@ -234,7 +234,7 @@
int GL_INVALID_INDEX = 0xFFFFFFFF;
void glGetUniformIndices(@GLuint int program, @AutoSize("uniformIndices") @GLsizei int uniformCount,
- @Const @NullTerminated @GLchar ByteBuffer uniformNames,
+ @Const @NullTerminated("uniformIndices.remaining()") @GLchar @StringList("uniformCount") ByteBuffer uniformNames,
@OutParameter @GLuint IntBuffer uniformIndices);
@StripPostfix("params")
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-01-04 18:47:56
|
Revision: 3262
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3262&view=rev
Author: spasi
Date: 2010-01-04 18:47:49 +0000 (Mon, 04 Jan 2010)
Log Message:
-----------
Added support for explicit length arguments in functions that map buffer objects.
Simplified CachedResult handling of functions that map buffer object ranges.
Improved documentation of CachedResult functions.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/CachedResult.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/Mode.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_buffer_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_map_buffer_range.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_map_object_buffer.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL15.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL30.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java 2009-12-28 15:00:06 UTC (rev 3261)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java 2010-01-04 18:47:49 UTC (rev 3262)
@@ -71,6 +71,12 @@
return scratch_buffer.get(0);
}
+ 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);
+ }
+
static int getNamedBufferObjectSize(ContextCapabilities caps, int buffer) {
IntBuffer scratch_buffer = caps.scratch_int_buffer;
EXTDirectStateAccess.glGetNamedBufferParameterEXT(buffer, GL15.GL_BUFFER_SIZE, scratch_buffer);
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/CachedResult.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/CachedResult.java 2009-12-28 15:00:06 UTC (rev 3261)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/CachedResult.java 2010-01-04 18:47:49 UTC (rev 3262)
@@ -43,4 +43,5 @@
@Target(ElementType.METHOD)
public @interface CachedResult {
+ boolean isRange() default false;
}
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2009-12-28 15:00:06 UTC (rev 3261)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-01-04 18:47:49 UTC (rev 3262)
@@ -91,8 +91,12 @@
}
if (Utils.getResultParameter(method) != null && !method.getReturnType().equals(env.getTypeUtils().getVoidType()))
throw new RuntimeException(method + " return type is not void but a parameter is annotated with Result");
- if (method.getAnnotation(CachedResult.class) != null && Utils.getNIOBufferType(Utils.getMethodReturnType(method)) == null)
- throw new RuntimeException(method + " return type is not a Buffer, but is annotated with CachedResult");
+ if (method.getAnnotation(CachedResult.class) != null) {
+ if (Utils.getNIOBufferType(Utils.getMethodReturnType(method)) == null)
+ throw new RuntimeException(method + " return type is not a Buffer, but is annotated with CachedResult");
+ if (method.getAnnotation(AutoResultSize.class) == null)
+ throw new RuntimeException(method + " is annotated with CachedResult but misses an AutoResultSize annotation");
+ }
validateTypes(method, method.getAnnotationMirrors(), method.getReturnType());
}
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2009-12-28 15:00:06 UTC (rev 3261)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2010-01-04 18:47:49 UTC (rev 3262)
@@ -68,6 +68,9 @@
printMethodWithMultiType(env, type_map, writer, interface_decl, method, typeinfos_instance, Mode.NORMAL, generate_error_checks, context_specific);
}
}
+ if ( method.getAnnotation(CachedResult.class) != null && !method.getAnnotation(CachedResult.class).isRange() ) {
+ printMethodWithMultiType(env, type_map, writer, interface_decl, method, TypeInfo.getDefaultTypeInfoMap(method), Mode.CACHEDRESULT, generate_error_checks, context_specific);
+ }
printJavaNativeStub(writer, method, Mode.NORMAL, generate_error_checks, context_specific);
if (Utils.hasMethodBufferObjectParameter(method)) {
printMethodWithMultiType(env, type_map, writer, interface_decl, method, TypeInfo.getDefaultTypeInfoMap(method), Mode.BUFFEROBJECT, generate_error_checks, context_specific);
@@ -120,16 +123,23 @@
first_parameter = generateParameterJava(writer, param, type_info, native_stub, first_parameter, mode);
}
}
+ CachedResult cached_result_annotation = method.getAnnotation(CachedResult.class);
TypeMirror result_type = Utils.getMethodReturnType(method);
if ((native_stub && Utils.getNIOBufferType(result_type) != null) || Utils.needResultSize(method)) {
- if (!first_parameter)
- writer.print(", ");
- first_parameter = false;
- writer.print("long " + Utils.RESULT_SIZE_NAME);
+ if (cached_result_annotation == null || !cached_result_annotation.isRange()) {
+ if (!first_parameter)
+ writer.print(", ");
+ first_parameter = false;
+ writer.print("long " + Utils.RESULT_SIZE_NAME);
+ }
}
- if (method.getAnnotation(CachedResult.class) != null) {
+ if (cached_result_annotation != null) {
if (!first_parameter)
writer.print(", ");
+
+ if ( mode == Mode.CACHEDRESULT )
+ writer.print("long " + Utils.CACHED_BUFFER_LENGTH_NAME + ", ");
+
first_parameter = false;
printResultType(writer, method, native_stub);
writer.print(" " + Utils.CACHED_BUFFER_NAME);
@@ -403,16 +413,26 @@
first_parameter = printMethodCallArgument(writer, method, param, typeinfos_instance, mode, first_parameter);
}
if (Utils.getNIOBufferType(Utils.getMethodReturnType(method)) != null) {
- if (!first_parameter)
- writer.print(", ");
- first_parameter = false;
- AutoResultSize auto_result_size_annotation = method.getAnnotation(AutoResultSize.class);
- String result_size_expression;
- if (auto_result_size_annotation == null)
- result_size_expression = Utils.RESULT_SIZE_NAME;
- else
- result_size_expression = auto_result_size_annotation.value();
- Utils.printExtraCallArguments(writer, method, result_size_expression);
+ if (method.getAnnotation(CachedResult.class) != null && method.getAnnotation(CachedResult.class).isRange()) {
+ first_parameter = false;
+ Utils.printExtraCallArguments(writer, method, "");
+ } else {
+ if (!first_parameter)
+ writer.print(", ");
+ first_parameter = false;
+
+ String result_size_expression;
+ if ( mode == Mode.CACHEDRESULT )
+ result_size_expression = Utils.CACHED_BUFFER_LENGTH_NAME;
+ else {
+ AutoResultSize auto_result_size_annotation = method.getAnnotation(AutoResultSize.class);
+ if (auto_result_size_annotation == null)
+ result_size_expression = Utils.RESULT_SIZE_NAME;
+ else
+ result_size_expression = auto_result_size_annotation.value();
+ }
+ Utils.printExtraCallArguments(writer, method, result_size_expression);
+ }
}
return first_parameter;
}
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/Mode.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/Mode.java 2009-12-28 15:00:06 UTC (rev 3261)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/Mode.java 2010-01-04 18:47:49 UTC (rev 3262)
@@ -1,31 +1,31 @@
-/*
+/*
* Copyright (c) 2002-2008 LWJGL Project
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
+ * modification, are permitted provided that the following conditions are
* met:
- *
- * * Redistributions of source code must retain the above copyright
+ *
+ * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@@ -34,5 +34,6 @@
public enum Mode {
BUFFEROBJECT,
AUTOS,
+ CACHEDRESULT, // Used for generating a CachedResult method with an explicit length argument.
NORMAL
}
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2009-12-28 15:00:06 UTC (rev 3261)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2010-01-04 18:47:49 UTC (rev 3262)
@@ -106,8 +106,10 @@
writer.print("(JNIEnv *env, jclass clazz");
generateParameters(writer, method.getParameters(), mode);
if (Utils.getNIOBufferType(result_type) != null) {
- writer.print(", jlong " + Utils.RESULT_SIZE_NAME);
- if (method.getAnnotation(CachedResult.class) != null)
+ CachedResult cached_result_annotation = method.getAnnotation(CachedResult.class);
+ if (cached_result_annotation == null || !cached_result_annotation.isRange())
+ writer.print(", jlong " + Utils.RESULT_SIZE_NAME);
+ if (cached_result_annotation != null)
writer.print(", jobject " + Utils.CACHED_BUFFER_NAME);
}
if (context_specific) {
@@ -160,7 +162,10 @@
writer.print(Utils.RESULT_VAR_NAME);
if (Buffer.class.isAssignableFrom(java_result_type)) {
writer.print(", ");
- Utils.printExtraCallArguments(writer, method, Utils.RESULT_SIZE_NAME);
+ if (method.getAnnotation(CachedResult.class) != null && method.getAnnotation(CachedResult.class).isRange())
+ Utils.printExtraCallArguments(writer, method, method.getAnnotation(AutoResultSize.class).value());
+ else
+ Utils.printExtraCallArguments(writer, method, Utils.RESULT_SIZE_NAME);
}
if (Buffer.class.isAssignableFrom(java_result_type) ||
String.class.equals(java_result_type))
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java 2009-12-28 15:00:06 UTC (rev 3261)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java 2010-01-04 18:47:49 UTC (rev 3262)
@@ -58,13 +58,14 @@
public static final String BUFFER_OBJECT_PARAMETER_POSTFIX = "_buffer_offset";
public static final String RESULT_SIZE_NAME = "result_size";
public static final String RESULT_VAR_NAME = "__result";
+ public static final String CACHED_BUFFER_LENGTH_NAME = "length";
public static final String CACHED_BUFFER_NAME = "old_buffer";
private static final String OVERLOADED_METHOD_PREFIX = "n";
public static String getTypedefName(MethodDeclaration method) {
return method.getSimpleName() + TYPEDEF_POSTFIX;
}
-
+
public static String getFunctionAddressName(InterfaceDeclaration interface_decl, MethodDeclaration method) {
return interface_decl.getSimpleName() + "_" + method.getSimpleName() + FUNCTION_POINTER_POSTFIX;
}
@@ -201,7 +202,7 @@
public static boolean needResultSize(MethodDeclaration method) {
return getNIOBufferType(getMethodReturnType(method)) != null && method.getAnnotation(AutoResultSize.class) == null;
}
-
+
public static void printExtraCallArguments(PrintWriter writer, MethodDeclaration method, String size_parameter_name) {
writer.print(size_parameter_name);
if (method.getAnnotation(CachedResult.class) != null) {
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_buffer_object.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_buffer_object.java 2009-12-28 15:00:06 UTC (rev 3261)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_buffer_object.java 2010-01-04 18:47:49 UTC (rev 3262)
@@ -104,13 +104,24 @@
@GLdouble Buffer data);
/**
- * glMapBufferARB maps a gl vertex buffer buffer to a ByteBuffer. The oldBuffer argument can be null,
- * in which case a new ByteBuffer will be created, pointing to the returned memory. If oldBuffer is non-null,
- * it will be returned if it points to the same mapped memory, otherwise a new ByteBuffer is created. That
- * way, an application will normally use glMapBufferARB like this:
+ * glMapBufferARB maps a GL buffer object to a ByteBuffer. The old_buffer argument can be null,
+ * in which case a new ByteBuffer will be created, pointing to the returned memory. If old_buffer is non-null,
+ * it will be returned if it points to the same mapped memory and has the same capacity as the buffer object,
+ * otherwise a new ByteBuffer is created. That way, an application will normally use glMapBufferARB like this:
* <p/>
- * ByteBuffer mapped_buffer; mapped_buffer = glMapBufferARB(..., ..., ..., null); ... // Another map on the same buffer mapped_buffer = glMapBufferARB(..., ..., ..., mapped_buffer);
+ * ByteBuffer mapped_buffer; mapped_buffer = glMapBufferARB(..., ..., null); ... // Another map on the same buffer mapped_buffer = glMapBufferARB(..., ..., mapped_buffer);
+ * <p/>
+ * Only ByteBuffers returned from this method are to be passed as the old_buffer argument. User-created ByteBuffers cannot be reused.
+ * <p/>
+ * The version of this method without an explicit length argument calls glGetBufferParameterARB internally to
+ * retrieve the current buffer object size, which may cause a pipeline flush and reduce application performance.
+ * <p/>
+ * The version of this method with an explicit length argument is a fast alternative to the one without. No GL call
+ * is made to retrieve the buffer object size, so the user is responsible for tracking and using the appropriate length.<br>
+ * Security warning: The length argument should match the buffer object size. Reading from or writing to outside
+ * the memory region that corresponds to the mapped buffer object will cause native crashes.
*
+ * @param length the length of the mapped memory in bytes.
* @param old_buffer A ByteBuffer. If this argument points to the same address and has the same capacity as the new mapping, it will be returned and no new buffer will be created.
*
* @return A ByteBuffer representing the mapped buffer memory.
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_map_buffer_range.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_map_buffer_range.java 2009-12-28 15:00:06 UTC (rev 3261)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_map_buffer_range.java 2010-01-04 18:47:49 UTC (rev 3262)
@@ -45,7 +45,21 @@
int GL_MAP_FLUSH_EXPLICIT_BIT = 0x0010;
int GL_MAP_UNSYNCHRONIZED_BIT = 0x0020;
- @CachedResult
+ /**
+ * glMapBufferRange maps a GL buffer object range to a ByteBuffer. The old_buffer argument can be null,
+ * in which case a new ByteBuffer will be created, pointing to the returned memory. If old_buffer is non-null,
+ * it will be returned if it points to the same mapped memory and has the same capacity as the buffer object,
+ * otherwise a new ByteBuffer is created. That way, an application will normally use glMapBufferRange like this:
+ * <p/>
+ * ByteBuffer mapped_buffer; mapped_buffer = glMapBufferRange(..., ..., ..., ..., null); ... // Another map on the same buffer mapped_buffer = glMapBufferRange(..., ..., ..., ..., mapped_buffer);
+ * <p/>
+ * Only ByteBuffers returned from this method are to be passed as the old_buffer argument. User-created ByteBuffers cannot be reused.
+ *
+ * @param old_buffer A ByteBuffer. If this argument points to the same address and has the same capacity as the new mapping, it will be returned and no new buffer will be created.
+ *
+ * @return A ByteBuffer representing the mapped buffer memory.
+ */
+ @CachedResult(isRange = true)
@GLvoid
@AutoResultSize("length")
ByteBuffer glMapBufferRange(@GLenum int target, @GLintptr long offset, @GLsizeiptr long length, @GLbitfield int access);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_map_object_buffer.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_map_object_buffer.java 2009-12-28 15:00:06 UTC (rev 3261)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_map_object_buffer.java 2010-01-04 18:47:49 UTC (rev 3262)
@@ -38,19 +38,31 @@
public interface ATI_map_object_buffer {
/**
- * glMapObjectBufferATI maps a gl object buffer to a ByteBuffer. The oldBuffer argument can be
- * null, in which case a new ByteBuffer will be created, pointing to the returned memory. If
- * oldBuffer is non-null, it will be returned if it points to the same mapped memory, otherwise a
- * new ByteBuffer is created.
+ * glMapObjectBufferATI maps an ATI vertex array object to a ByteBuffer. The old_buffer argument can be null,
+ * in which case a new ByteBuffer will be created, pointing to the returned memory. If old_buffer is non-null,
+ * it will be returned if it points to the same mapped memory and has the same capacity as the vertex array object,
+ * otherwise a new ByteBuffer is created. That way, an application will normally use glMapObjectBufferATI like this:
+ * <p/>
+ * ByteBuffer mapped_buffer; mapped_buffer = glMapObjectBufferATI(..., null); ... // Another map on the same buffer mapped_buffer = glMapObjectBufferATI(..., mapped_buffer);
+ * <p/>
+ * Only ByteBuffers returned from this method are to be passed as the old_buffer argument. User-created ByteBuffers cannot be reused.
+ * <p/>
+ * The version of this method without an explicit length argument calls glGetObjectBufferATI internally to
+ * retrieve the current vertex array object size, which may cause a pipeline flush and reduce application performance.
+ * <p/>
+ * The version of this method with an explicit length argument is a fast alternative to the one without. No GL call
+ * is made to retrieve the vertex array object size, so the user is responsible for tracking and using the appropriate length.<br>
+ * Security warning: The length argument should match the vertex array object size. Reading from or writing to outside
+ * the memory region that corresponds to the mapped vertex array object will cause native crashes.
*
- * @param result_size The size of the buffer area.
- * @param old_buffer A ByteBuffer. If this argument points to the same address and has the same capacity as the new mapping,
- * it will be returned and no new buffer will be created.
+ * @param length the length of the mapped memory in bytes.
+ * @param old_buffer A ByteBuffer. If this argument points to the same address and has the same capacity as the new mapping, it will be returned and no new buffer will be created.
*
- * @return A ByteBuffer representing the mapped object buffer memory.
+ * @return A ByteBuffer representing the mapped buffer memory.
*/
@CachedResult
@GLvoid
+ @AutoResultSize("GLChecks.getBufferObjectSizeATI(caps, buffer)")
ByteBuffer glMapObjectBufferATI(@GLuint int buffer);
void glUnmapObjectBufferATI(@GLuint int buffer);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java 2009-12-28 15:00:06 UTC (rev 3261)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java 2010-01-04 18:47:49 UTC (rev 3262)
@@ -778,6 +778,29 @@
@GLfloat
@GLdouble Buffer data);
+ /**
+ * glMapNamedBufferEXT maps a GL buffer object to a ByteBuffer. The old_buffer argument can be null,
+ * in which case a new ByteBuffer will be created, pointing to the returned memory. If old_buffer is non-null,
+ * it will be returned if it points to the same mapped memory and has the same capacity as the buffer object,
+ * otherwise a new ByteBuffer is created. That way, an application will normally use glMapNamedBufferEXT like this:
+ * <p/>
+ * ByteBuffer mapped_buffer; mapped_buffer = glMapNamedBufferEXT(..., ..., null); ... // Another map on the same buffer mapped_buffer = glMapNamedBufferEXT(..., ..., mapped_buffer);
+ * <p/>
+ * Only ByteBuffers returned from this method are to be passed as the old_buffer argument. User-created ByteBuffers cannot be reused.
+ * <p/>
+ * The version of this method without an explicit length argument calls glGetNamedBufferParameterEXT internally to
+ * retrieve the current buffer object size, which may cause a pipeline flush and reduce application performance.
+ * <p/>
+ * The version of this method with an explicit length argument is a fast alternative to the one without. No GL call
+ * is made to retrieve the buffer object size, so the user is responsible for tracking and using the appropriate length.<br>
+ * Security warning: The length argument should match the buffer object size. Reading from or writing to outside
+ * the memory region that corresponds to the mapped buffer object will cause native crashes.
+ *
+ * @param length the length of the mapped memory in bytes.
+ * @param old_buffer A ByteBuffer. If this argument points to the same address and has the same capacity as the new mapping, it will be returned and no new buffer will be created.
+ *
+ * @return A ByteBuffer representing the mapped buffer memory.
+ */
@Dependent("OpenGL15")
@CachedResult
@GLvoid
@@ -1283,8 +1306,22 @@
in name and replace "enum target" parameter with "uint buffer"
*/
+ /**
+ * glMapNamedBufferRangeEXT maps a GL buffer object range to a ByteBuffer. The old_buffer argument can be null,
+ * in which case a new ByteBuffer will be created, pointing to the returned memory. If old_buffer is non-null,
+ * it will be returned if it points to the same mapped memory and has the same capacity as the buffer object,
+ * otherwise a new ByteBuffer is created. That way, an application will normally use glMapNamedBufferRangeEXT like this:
+ * <p/>
+ * ByteBuffer mapped_buffer; mapped_buffer = glMapNamedBufferRangeEXT(..., ..., ..., ..., null); ... // Another map on the same buffer mapped_buffer = glMapNamedBufferRangeEXT(..., ..., ..., ..., mapped_buffer);
+ * <p/>
+ * Only ByteBuffers returned from this method are to be passed as the old_buffer argument. User-created ByteBuffers cannot be reused.
+ *
+ * @param old_buffer A ByteBuffer. If this argument points to the same address and has the same capacity as the new mapping, it will be returned and no new buffer will be created.
+ *
+ * @return A ByteBuffer representing the mapped buffer memory.
+ */
@Dependent("OpenGL30")
- @CachedResult
+ @CachedResult(isRange = true)
@GLvoid
@AutoResultSize("length")
ByteBuffer glMapNamedBufferRangeEXT(@GLuint int buffer, @GLintptr long offset, @GLsizeiptr long length, @GLbitfield int access);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL15.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL15.java 2009-12-28 15:00:06 UTC (rev 3261)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL15.java 2010-01-04 18:47:49 UTC (rev 3262)
@@ -124,17 +124,26 @@
@GLdouble Buffer data);
/**
- * glMapBuffer maps a gl vertex buffer buffer to a ByteBuffer. The oldBuffer argument can be null, in which case a new
- * ByteBuffer will be created, pointing to the returned memory. If oldBuffer is non-null, it will be returned if it points to
- * the same mapped memory, otherwise a new ByteBuffer is created. That way, an application will normally use glMapBuffer like
- * this:
+ * glMapBuffer maps a GL buffer object to a ByteBuffer. The old_buffer argument can be null,
+ * in which case a new ByteBuffer will be created, pointing to the returned memory. If old_buffer is non-null,
+ * it will be returned if it points to the same mapped memory and has the same capacity as the buffer object,
+ * otherwise a new ByteBuffer is created. That way, an application will normally use glMapBuffer like this:
* <p/>
- * ByteBuffer mapped_buffer; mapped_buffer = glMapBuffer(..., ..., ..., null); ... // Another map on the same buffer
- * mapped_buffer = glMapBuffer(..., ..., ..., mapped_buffer);
+ * ByteBuffer mapped_buffer; mapped_buffer = glMapBuffer(..., ..., null); ... // Another map on the same buffer mapped_buffer = glMapBuffer(..., ..., mapped_buffer);
+ * <p/>
+ * Only ByteBuffers returned from this method are to be passed as the old_buffer argument. User-created ByteBuffers cannot be reused.
+ * <p/>
+ * The version of this method without an explicit length argument calls glGetBufferParameter internally to
+ * retrieve the current buffer object size, which may cause a pipeline flush and reduce application performance.
+ * <p/>
+ * The version of this method with an explicit length argument is a fast alternative to the one without. No GL call
+ * is made to retrieve the buffer object size, so the user is responsible for tracking and using the appropriate length.<br>
+ * Security warning: The length argument should match the buffer object size. Reading from or writing to outside
+ * the memory region that corresponds to the mapped buffer object will cause native crashes.
+ *
+ * @param length the length of the mapped memory in bytes.
+ * @param old_buffer A ByteBuffer. If this argument points to the same address and has the same capacity as the new mapping, it will be returned and no new buffer will be created.
*
- * @param old_buffer A ByteBuffer. If this argument points to the same address and has the same capacity as the new mapping, it will be returned and no
- * new buffer will be created.
- *
* @return A ByteBuffer representing the mapped buffer memory.
*/
@CachedResult
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL30.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL30.java 2009-12-28 15:00:06 UTC (rev 3261)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL30.java 2010-01-04 18:47:49 UTC (rev 3262)
@@ -240,7 +240,21 @@
int GL_MAP_FLUSH_EXPLICIT_BIT = 0x0010;
int GL_MAP_UNSYNCHRONIZED_BIT = 0x0020;
- @CachedResult
+ /**
+ * glMapBufferRange maps a GL buffer object range to a ByteBuffer. The old_buffer argument can be null,
+ * in which case a new ByteBuffer will be created, pointing to the returned memory. If old_buffer is non-null,
+ * it will be returned if it points to the same mapped memory and has the same capacity as the buffer object,
+ * otherwise a new ByteBuffer is created. That way, an application will normally use glMapBufferRange like this:
+ * <p/>
+ * ByteBuffer mapped_buffer; mapped_buffer = glMapBufferRange(..., ..., ..., ..., null); ... // Another map on the same buffer mapped_buffer = glMapBufferRange(..., ..., ..., ..., mapped_buffer);
+ * <p/>
+ * Only ByteBuffers returned from this method are to be passed as the old_buffer argument. User-created ByteBuffers cannot be reused.
+ *
+ * @param old_buffer A ByteBuffer. If this argument points to the same address and has the same capacity as the new mapping, it will be returned and no new buffer will be created.
+ *
+ * @return A ByteBuffer representing the mapped buffer memory.
+ */
+ @CachedResult(isRange = true)
@GLvoid
@AutoResultSize("length")
ByteBuffer glMapBufferRange(@GLenum int target, @GLintptr long offset, @GLsizeiptr long length, @GLbitfield int access);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-02-07 15:16:13
|
Revision: 3269
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3269&view=rev
Author: spasi
Date: 2010-02-07 15:15:33 +0000 (Sun, 07 Feb 2010)
Log Message:
-----------
Removed glPrimitiveRestart from GL31 (immediate mode call that never made it to the core)
Added Optional annotation for functions that miss from incomplete implementations.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL32.java
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/util/generator/Optional.java
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java 2010-02-03 21:03:32 UTC (rev 3268)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java 2010-02-07 15:15:33 UTC (rev 3269)
@@ -197,12 +197,13 @@
writer.print("\tprivate boolean " + getAddressesInitializerName(d.getSimpleName()) + "(");
- DeprecatedGL deprecated = d.getAnnotation(DeprecatedGL.class);
+ boolean optional;
+ boolean deprecated = d.getAnnotation(DeprecatedGL.class) != null;
Dependent dependent = d.getAnnotation(Dependent.class);
- if ( deprecated != null )
+ if ( deprecated )
writer.print("boolean forwardCompatible");
if ( dependent != null ) {
- if ( deprecated != null )
+ if ( deprecated )
writer.print(",");
writer.print("Set supported_extensions");
}
@@ -211,11 +212,14 @@
writer.println("\t\treturn ");
while ( methods.hasNext() ) {
MethodDeclaration method = methods.next();
- deprecated = method.getAnnotation(DeprecatedGL.class);
+ optional = method.getAnnotation(Optional.class) != null;
+ deprecated = method.getAnnotation(DeprecatedGL.class) != null;
dependent = method.getAnnotation(Dependent.class);
writer.print("\t\t\t(");
- if ( deprecated != null )
+ if ( optional )
+ writer.print('(');
+ if ( deprecated )
writer.print("forwardCompatible || ");
if ( dependent != null ) {
if ( dependent.value().indexOf(',') == -1 )
@@ -227,7 +231,7 @@
writer.print(") || ");
}
}
- if ( deprecated != null || dependent != null )
+ if ( deprecated || dependent != null )
writer.print('(');
writer.print(Utils.getFunctionAddressName(d, method) + " = ");
PlatformDependent platform_dependent = method.getAnnotation(PlatformDependent.class);
@@ -253,8 +257,10 @@
} else
writer.print("GLContext.getFunctionAddress(");
writer.print("\"" + method.getSimpleName() + "\")) != 0");
- if ( deprecated != null || dependent != null )
+ if ( deprecated || dependent != null )
writer.print(')');
+ if ( optional )
+ writer.print(" || true)");
if ( methods.hasNext() )
writer.println(" &&");
}
Added: trunk/LWJGL/src/java/org/lwjgl/util/generator/Optional.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/Optional.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/Optional.java 2010-02-07 15:15:33 UTC (rev 3269)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator;
+
+/**
+ * A function annotated with @Optional will allow the extension to be available even if the driver does not expose that function.
+ * This is useful when certain buggy drivers miss some functionality.
+ *
+ * @author spasi <sp...@us...>
+ */
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+@Target(ElementType.METHOD)
+public @interface Optional {
+ String reason(); // No default value to force documentation
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java 2010-02-03 21:03:32 UTC (rev 3268)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java 2010-02-07 15:15:33 UTC (rev 3269)
@@ -96,8 +96,6 @@
*/
int GL_PRIMITIVE_RESTART_INDEX = 0x8F9E;
- void glPrimitiveRestart();
-
void glPrimitiveRestartIndex(@GLuint int index);
// -------------------------------------------------------------------------
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL32.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL32.java 2010-02-03 21:03:32 UTC (rev 3268)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL32.java 2010-02-07 15:15:33 UTC (rev 3269)
@@ -63,6 +63,7 @@
// ----------------------[ ARB_draw_elements_base_vertex ]----------------------
// -----------------------------------------------------------------------------
+ @Optional(reason = "AMD's 3.2 implementation does not expose this (last driver checked: 10.1)")
void glDrawElementsBaseVertex(@GLenum int mode, @AutoSize("indices") @GLsizei int count, @AutoType("indices") @GLenum int type,
@BufferObject(BufferKind.ElementVBO)
@Const
@@ -70,6 +71,7 @@
@GLushort
@GLuint Buffer indices, int basevertex);
+ @Optional(reason = "AMD's 3.2 implementation does not expose this (last driver checked: 10.1)")
void glDrawRangeElementsBaseVertex(@GLenum int mode, @GLuint int start, @GLuint int end, @AutoSize("indices") @GLsizei int count, @AutoType("indices") @GLenum int type,
@BufferObject(BufferKind.ElementVBO)
@Const
@@ -77,6 +79,7 @@
@GLushort
@GLuint Buffer indices, int basevertex);
+ @Optional(reason = "AMD's 3.2 implementation does not expose this (last driver checked: 10.1)")
void glDrawElementsInstancedBaseVertex(@GLenum int mode, @AutoSize("indices") @GLsizei int count, @AutoType("indices") @GLenum int type,
@BufferObject(BufferKind.ElementVBO)
@Const
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-03-11 22:09:21
|
Revision: 3279
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3279&view=rev
Author: spasi
Date: 2010-03-11 21:06:49 +0000 (Thu, 11 Mar 2010)
Log Message:
-----------
Added support for OpenGL 3.3 and OpenGL 4.0.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java
trunk/LWJGL/src/java/org/lwjgl/opengl/BaseReferences.java
trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java
trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java
trunk/LWJGL/src/java/org/lwjgl/opengl/StateTracker.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/BufferKind.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLvoid.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/TypeInfo.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/util/generator/Alternate.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_blend_func_extended.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_indirect.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_explicit_attrib_location.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_gpu_shader5.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_gpu_shader_fp64.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_occlusion_query2.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_bit_encoding.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_subroutine.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_tessellation_shader.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_buffer_object_rgb32.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_compression_bptc.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_rgb10_a2ui.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_swizzle.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_timer_query.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_transform_feedback2.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_transform_feedback3.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_type_2_10_10_10_rev.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL33.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL40.java
Modified: trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2010-03-08 21:29:32 UTC (rev 3278)
+++ trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2010-03-11 21:06:49 UTC (rev 3279)
@@ -85,6 +85,13 @@
throw new IllegalArgumentException("Missing null termination");
}
+ /** Helper methods to ensure an IntBuffer is null-terminated */
+ public static void checkNullTerminated(IntBuffer buf) {
+ if ( buf.get(buf.limit() - 1) != 0 ) {
+ throw new IllegalArgumentException("Missing null termination");
+ }
+ }
+
public static void checkNotNull(Object o) {
if (o == null)
throw new IllegalArgumentException("Null argument");
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/BaseReferences.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/BaseReferences.java 2010-03-08 21:29:32 UTC (rev 3278)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/BaseReferences.java 2010-03-11 21:06:49 UTC (rev 3279)
@@ -46,6 +46,8 @@
int pixelPackBuffer;
int pixelUnpackBuffer;
+ int indirectBuffer;
+
BaseReferences(ContextCapabilities caps) {
IntBuffer temp = caps.scratch_int_buffer;
@@ -78,6 +80,8 @@
this.pixelPackBuffer = 0;
this.pixelUnpackBuffer = 0;
+
+ this.indirectBuffer = 0;
}
void copy(BaseReferences references, int mask) {
@@ -87,6 +91,8 @@
this.glClientActiveTexture = references.glClientActiveTexture;
System.arraycopy(references.glVertexAttribPointer_buffer, 0, glVertexAttribPointer_buffer, 0, glVertexAttribPointer_buffer.length);
System.arraycopy(references.glTexCoordPointer_buffer, 0, glTexCoordPointer_buffer, 0, glTexCoordPointer_buffer.length);
+
+ this.indirectBuffer = references.indirectBuffer;
}
if ( (mask & GL11.GL_CLIENT_PIXEL_STORE_BIT) != 0 ) {
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java 2010-03-08 21:29:32 UTC (rev 3278)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java 2010-03-11 21:06:49 UTC (rev 3279)
@@ -114,6 +114,18 @@
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 )
+ 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 )
+ 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 )
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java 2010-03-08 21:29:32 UTC (rev 3278)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java 2010-03-11 21:06:49 UTC (rev 3279)
@@ -199,7 +199,13 @@
LWJGLUtil.log("The major and/or minor OpenGL version is malformed: " + e.getMessage());
}
+ // ----------------------[ 4.X ]----------------------
+ if ( 4 <= majorVersion )
+ supported_extensions.add("OpenGL40");
+
// ----------------------[ 3.X ]----------------------
+ if ( 3 < majorVersion || (3 == majorVersion && 3 <= minorVersion) )
+ supported_extensions.add("OpenGL33");
if ( 3 < majorVersion || (3 == majorVersion && 2 <= minorVersion) )
supported_extensions.add("OpenGL32");
if ( 3 < majorVersion || (3 == majorVersion && 1 <= minorVersion) )
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/StateTracker.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/StateTracker.java 2010-03-08 21:29:32 UTC (rev 3278)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/StateTracker.java 2010-03-11 21:06:49 UTC (rev 3279)
@@ -76,6 +76,9 @@
case GL21.GL_PIXEL_UNPACK_BUFFER:
references_stack.getReferences().pixelUnpackBuffer = buffer;
break;
+ case GL40.GL_DRAW_INDIRECT_BUFFER:
+ references_stack.getReferences().indirectBuffer = buffer;
+ break;
}
}
Added: trunk/LWJGL/src/java/org/lwjgl/util/generator/Alternate.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/Alternate.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/Alternate.java 2010-03-11 21:06:49 UTC (rev 3279)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+/**
+ * When a method is annonated with @Alternate, no native stub will be created and the Java method will be renamed to value().
+ * This can be useful when we want to provide an alternate GL call with different arguments (created by different annotations)
+ *
+ * @author spasi <sp...@us...>
+ */
+@Target({ ElementType.METHOD })
+public @interface Alternate {
+ /** This must match an existing GL method name. */
+ String value();
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/BufferKind.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/BufferKind.java 2010-03-08 21:29:32 UTC (rev 3278)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/BufferKind.java 2010-03-11 21:06:49 UTC (rev 3279)
@@ -42,5 +42,6 @@
UnpackPBO,
PackPBO,
ElementVBO,
- ArrayVBO
+ ArrayVBO,
+ IndirectBO
}
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java 2010-03-08 21:29:32 UTC (rev 3278)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java 2010-03-11 21:06:49 UTC (rev 3279)
@@ -188,7 +188,7 @@
private static Class[] getValidBufferTypes(Class type) {
if ( type.equals(IntBuffer.class) )
return new Class[] { GLbitfield.class, GLenum.class, GLhandleARB.class, GLint.class,
- GLsizei.class, GLuint.class };
+ GLsizei.class, GLuint.class, GLvoid.class };
else if ( type.equals(FloatBuffer.class) )
return new Class[] { GLclampf.class, GLfloat.class };
else if ( type.equals(ByteBuffer.class) )
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GLvoid.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/GLvoid.java 2010-03-08 21:29:32 UTC (rev 3278)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GLvoid.java 2010-03-11 21:06:49 UTC (rev 3279)
@@ -41,7 +41,10 @@
import java.lang.annotation.Target;
import java.lang.annotation.ElementType;
+import com.sun.mirror.type.PrimitiveType;
+
@NativeType
@Target({ElementType.PARAMETER, ElementType.METHOD})
public @interface GLvoid {
+ PrimitiveType.Kind value() default PrimitiveType.Kind.BYTE;
}
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-03-08 21:29:32 UTC (rev 3278)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-03-11 21:06:49 UTC (rev 3279)
@@ -138,7 +138,7 @@
break;
}
}
- if (!found_auto_size_param && param.getAnnotation(Result.class) == null)
+ if (!found_auto_size_param && param.getAnnotation(Result.class) == null && param.getAnnotation(Constant.class) == null)
throw new RuntimeException(param + " has no Check, Result nor Constant annotation and no other parameters has" +
" an @AutoSize annotation on it in method " + method);
}
@@ -146,8 +146,8 @@
throw new RuntimeException(param + " can't be annotated with both CachedReference and Result");
if (param.getAnnotation(BufferObject.class) != null && param.getAnnotation(Result.class) != null)
throw new RuntimeException(param + " can't be annotated with both BufferObject and Result");
- if (param.getAnnotation(Constant.class) != null)
- throw new RuntimeException("Buffer parameter " + param + " cannot be Constant");
+ //if (param.getAnnotation(Constant.class) != null)
+ //throw new RuntimeException("Buffer parameter " + param + " cannot be Constant");
} else {
if (param.getAnnotation(BufferObject.class) != null)
throw new RuntimeException(param + " type is not a buffer, but annotated as a BufferObject");
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2010-03-08 21:29:32 UTC (rev 3278)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2010-03-11 21:06:49 UTC (rev 3279)
@@ -71,10 +71,12 @@
if ( method.getAnnotation(CachedResult.class) != null && !method.getAnnotation(CachedResult.class).isRange() ) {
printMethodWithMultiType(env, type_map, writer, interface_decl, method, TypeInfo.getDefaultTypeInfoMap(method), Mode.CACHEDRESULT, generate_error_checks, context_specific);
}
- printJavaNativeStub(writer, method, Mode.NORMAL, generate_error_checks, context_specific);
- if (Utils.hasMethodBufferObjectParameter(method)) {
- printMethodWithMultiType(env, type_map, writer, interface_decl, method, TypeInfo.getDefaultTypeInfoMap(method), Mode.BUFFEROBJECT, generate_error_checks, context_specific);
- printJavaNativeStub(writer, method, Mode.BUFFEROBJECT, generate_error_checks, context_specific);
+ if ( method.getAnnotation(Alternate.class) == null ) {
+ printJavaNativeStub(writer, method, Mode.NORMAL, generate_error_checks, context_specific);
+ if (Utils.hasMethodBufferObjectParameter(method)) {
+ printMethodWithMultiType(env, type_map, writer, interface_decl, method, TypeInfo.getDefaultTypeInfoMap(method), Mode.BUFFEROBJECT, generate_error_checks, context_specific);
+ printJavaNativeStub(writer, method, Mode.BUFFEROBJECT, generate_error_checks, context_specific);
+ }
}
}
@@ -194,7 +196,9 @@
writer.print("\tpublic static ");
printResultType(writer, method, false);
StripPostfix strip_annotation = method.getAnnotation(StripPostfix.class);
- String method_name = method.getSimpleName();
+ String method_name;
+ Alternate alt_annotation = method.getAnnotation(Alternate.class);
+ method_name = alt_annotation == null ? method.getSimpleName() : alt_annotation.value();
if (strip_annotation != null && mode == Mode.NORMAL)
method_name = getPostfixStrippedName(type_map, interface_decl, method);
writer.print(" " + method_name + "(");
@@ -298,7 +302,10 @@
postfix_parameter.getType().accept(translator);
postfix = translator.getSignature();
}
- String method_name = method.getSimpleName();
+ String method_name;
+ Alternate alt_annotation = method.getAnnotation(Alternate.class);
+ method_name = alt_annotation == null ? method.getSimpleName() : alt_annotation.value();
+
String extension_postfix = "NULL".equals(strip_annotation.extension()) ? getExtensionPostfix(interface_decl) : strip_annotation.extension();
String result;
@@ -491,7 +498,7 @@
can_be_null = check_annotation.canBeNull();
}
NullTerminated null_terminated = param.getAnnotation(NullTerminated.class);
- if (Buffer.class.isAssignableFrom(java_type)) {
+ if (Buffer.class.isAssignableFrom(java_type) && param.getAnnotation(Constant.class) == null) {
boolean indirect_buffer_allowed = false && param.getAnnotation(CachedReference.class) == null; // DISABLED: indirect buffer support
boolean out_parameter = param.getAnnotation(OutParameter.class) != null;
TypeInfo typeinfo = typeinfos.get(param);
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/TypeInfo.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/TypeInfo.java 2010-03-08 21:29:32 UTC (rev 3278)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/TypeInfo.java 2010-03-11 21:06:49 UTC (rev 3279)
@@ -168,7 +168,9 @@
}
}
Class type;
- PrimitiveType.Kind kind = type_map.getPrimitiveTypeFromNativeType(annotation_type);
+ PrimitiveType.Kind kind;
+ GLvoid void_annotation = param.getAnnotation(GLvoid.class);
+ kind = void_annotation == null ? type_map.getPrimitiveTypeFromNativeType(annotation_type) : void_annotation.value();
if (Utils.getNIOBufferType(decl_type) != null)
type = getBufferTypeFromPrimitiveKind(kind);
else
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java 2010-03-08 21:29:32 UTC (rev 3278)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java 2010-03-11 21:06:49 UTC (rev 3279)
@@ -253,7 +253,9 @@
}
public static String getSimpleNativeMethodName(MethodDeclaration method, boolean generate_error_checks, boolean context_specific) {
- String method_name = method.getSimpleName();
+ String method_name;
+ Alternate alt_annotation = method.getAnnotation(Alternate.class);
+ method_name = alt_annotation == null ? method.getSimpleName() : alt_annotation.value();
if (isMethodIndirect(generate_error_checks, context_specific, method))
method_name = OVERLOADED_METHOD_PREFIX + method_name;
return method_name;
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_blend_func_extended.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_blend_func_extended.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_blend_func_extended.java 2010-03-11 21:06:49 UTC (rev 3279)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengl;
+
+import org.lwjgl.util.generator.Const;
+import org.lwjgl.util.generator.GLchar;
+import org.lwjgl.util.generator.GLuint;
+import org.lwjgl.util.generator.NullTerminated;
+
+import java.nio.ByteBuffer;
+
+public interface ARB_blend_func_extended {
+
+ /**
+ * Accepted by the <src> and <dst> parameters of BlendFunc and
+ * BlendFunci, and by the <srcRGB>, <dstRGB>, <srcAlpha> and <dstAlpha>
+ * parameters of BlendFuncSeparate and BlendFuncSeparatei:
+ */
+ int GL_SRC1_COLOR = 0x88F9;
+ int GL_SRC1_ALPHA = GL15.GL_SRC1_ALPHA;
+ int GL_ONE_MINUS_SRC1_COLOR = 0x88FA;
+ int GL_ONE_MINUS_SRC1_ALPHA = 0x88FB;
+
+ /**
+ * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv
+ * and GetDoublev:
+ */
+ int GL_MAX_DUAL_SOURCE_DRAW_BUFFERS = 0x88FC;
+
+ void glBindFragDataLocationIndexed(@GLuint int program, @GLuint int colorNumber, @GLuint int index, @NullTerminated @Const @GLchar ByteBuffer name);
+
+ int glGetFragDataIndex(@GLuint int program, @NullTerminated @Const @GLchar ByteBuffer name);
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_indirect.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_indirect.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_indirect.java 2010-03-11 21:06:49 UTC (rev 3279)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengl;
+
+import org.lwjgl.util.generator.*;
+
+import java.nio.IntBuffer;
+
+import com.sun.mirror.type.PrimitiveType;
+
+public interface ARB_draw_indirect {
+
+ /**
+ * Accepted by the <target> parameters of BindBuffer, BufferData,
+ * BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData,
+ * GetBufferPointerv, MapBufferRange, FlushMappedBufferRange,
+ * GetBufferParameteriv, BindBufferRange, BindBufferBase, and
+ * CopyBufferSubData:
+ */
+ int GL_DRAW_INDIRECT_BUFFER = 0x8F3F;
+
+ /**
+ * Accepted by the <value> parameter of GetIntegerv, GetBooleanv, GetFloatv,
+ * and GetDoublev:
+ */
+ int GL_DRAW_INDIRECT_BUFFER_BINDING = 0x8F43;
+
+ void glDrawArraysIndirect(@GLenum int mode, @BufferObject(BufferKind.IndirectBO) @Check("4") @NullTerminated @Const @GLvoid(PrimitiveType.Kind.INT) IntBuffer indirect);
+
+ void glDrawElementsIndirect(@GLenum int mode, @GLenum int type, @BufferObject(BufferKind.IndirectBO) @Check("5") @NullTerminated @Const @GLvoid(PrimitiveType.Kind.INT) IntBuffer indirect);
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_explicit_attrib_location.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_explicit_attrib_location.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_explicit_attrib_location.java 2010-03-11 21:06:49 UTC (rev 3279)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengl;
+
+public interface ARB_explicit_attrib_location {
+}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_gpu_shader5.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_gpu_shader5.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_gpu_shader5.java 2010-03-11 21:06:49 UTC (rev 3279)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengl;
+
+public interface ARB_gpu_shader5 {
+
+ /** Accepted by the <pname> parameter of GetProgramiv: */
+ int GL_GEOMETRY_SHADER_INVOCATIONS = 0x887F;
+
+ /**
+ * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv,
+ * GetDoublev, and GetInteger64v:
+ */
+ int GL_MAX_GEOMETRY_SHADER_INVOCATIONS = 0x8E5A;
+ int GL_MIN_FRAGMENT_INTERPOLATION_OFFSET = 0x8E5B;
+ int GL_MAX_FRAGMENT_INTERPOLATION_OFFSET = 0x8E5C;
+ int GL_FRAGMENT_INTERPOLATION_OFFSET_BITS = 0x8E5D;
+ int GL_MAX_VERTEX_STREAMS = 0x8E71;
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_gpu_shader_fp64.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_gpu_shader_fp64.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_gpu_shader_fp64.java 2010-03-11 21:06:49 UTC (rev 3279)
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions...
[truncated message content] |
|
From: <sp...@us...> - 2010-03-12 21:55:21
|
Revision: 3281
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3281&view=rev
Author: spasi
Date: 2010-03-12 21:55:13 +0000 (Fri, 12 Mar 2010)
Log Message:
-----------
Added support for Strings! (WIP, needs more testing)
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/util/generator/Alternate.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JNITypeTranslator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaTypeTranslator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeTypeTranslator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/StringList.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/TypedefsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_blend_func_extended.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_gpu_shader4.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_separate_shader_objects.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_transform_feedback.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL30.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL33.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_transform_feedback.java
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/opengl/StringUtils.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLstring.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLstringOffset.java
Added: trunk/LWJGL/src/java/org/lwjgl/opengl/StringUtils.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/StringUtils.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/StringUtils.java 2010-03-12 21:55:13 UTC (rev 3281)
@@ -0,0 +1,268 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengl;
+
+import org.lwjgl.BufferUtils;
+
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+
+/** @author spasi */
+final class StringUtils {
+
+ private static final int INITIAL_BUFFER_SIZE = 256;
+ private static final int INITIAL_LENGTHS_SIZE = 4;
+
+ private static final ThreadLocal arrayTL = new ThreadLocal() {
+ protected Object initialValue() {
+ return new char[INITIAL_BUFFER_SIZE];
+ }
+ };
+
+ private static final ThreadLocal bufferTL = new ThreadLocal() {
+ protected Object initialValue() {
+ return BufferUtils.createByteBuffer(INITIAL_BUFFER_SIZE);
+ }
+ };
+
+ private static final ThreadLocal lengthsTL = new ThreadLocal() {
+ protected Object initialValue() {
+ return BufferUtils.createIntBuffer(INITIAL_LENGTHS_SIZE);
+ }
+ };
+
+ private StringUtils() {
+ }
+
+ private static char[] getArray(final int size) {
+ char[] array = (char[])arrayTL.get();
+
+ if ( array.length < size ) {
+ int sizeNew = array.length << 1;
+ while ( sizeNew < size )
+ sizeNew <<= 1;
+
+ array = new char[size];
+ arrayTL.set(array);
+ }
+
+ return array;
+ }
+
+ static ByteBuffer getBuffer(final int size) {
+ ByteBuffer buffer = (ByteBuffer)bufferTL.get();
+
+ if ( buffer.capacity() < size ) {
+ int sizeNew = buffer.capacity() << 1;
+ while ( sizeNew < size )
+ sizeNew <<= 1;
+
+ buffer = BufferUtils.createByteBuffer(size);
+ bufferTL.set(buffer);
+ }
+
+ buffer.clear();
+ return buffer;
+ }
+
+ private static ByteBuffer getBufferOffset(final int size) {
+ ByteBuffer buffer = (ByteBuffer)bufferTL.get();
+
+ if ( buffer.capacity() < size ) {
+ int sizeNew = buffer.capacity() << 1;
+ while ( sizeNew < size )
+ sizeNew <<= 1;
+
+ final ByteBuffer bufferNew = BufferUtils.createByteBuffer(size);
+ bufferNew.put(buffer);
+ bufferTL.set(buffer = bufferNew);
+ } else {
+ buffer.position(buffer.limit());
+ buffer.limit(buffer.capacity());
+ }
+
+ return buffer;
+ }
+
+ static IntBuffer getLengths(final int size) {
+ IntBuffer lengths = (IntBuffer)lengthsTL.get();
+
+ if ( lengths.capacity() < size ) {
+ int sizeNew = lengths.capacity();
+ while ( sizeNew < size )
+ sizeNew <<= 1;
+
+ lengths = BufferUtils.createIntBuffer(size);
+ lengthsTL.set(lengths);
+ }
+
+ lengths.clear();
+ return lengths;
+ }
+
+ /*
+ * Reads a byte string from the specified buffer.
+ *
+ * @param buffer
+ *
+ * @return the buffer as a String.
+ */
+
+ static String getString(final ByteBuffer buffer) {
+ final int length = buffer.remaining();
+ final char[] charArray = getArray(length);
+
+ for ( int i = buffer.position(); i < buffer.limit(); i++ )
+ charArray[i - buffer.position()] = (char)buffer.get(i);
+
+ return new String(charArray, 0, length);
+ }
+
+ /**
+ * Returns a buffer containing the specified string as bytes.
+ *
+ * @param string
+ *
+ * @return the String as a ByteBuffer
+ */
+ static ByteBuffer getBuffer(final CharSequence string) {
+ final ByteBuffer buffer = getBuffer(string.length());
+
+ for ( int i = 0; i < string.length(); i++ )
+ buffer.put((byte)string.charAt(i));
+
+ buffer.flip();
+ return buffer;
+ }
+
+ /**
+ * Returns a buffer containing the specified string as bytes, starting at the specified offset.
+ *
+ * @param string
+ *
+ * @return the String as a ByteBuffer
+ */
+ static ByteBuffer getBufferOffset(final CharSequence string, final int offset) {
+ final ByteBuffer buffer = getBufferOffset(offset + string.length());
+
+ for ( int i = 0; i < string.length(); i++ )
+ buffer.put((byte)string.charAt(i));
+
+ buffer.flip();
+ return buffer;
+ }
+
+ /**
+ * Returns a buffer containing the specified string as bytes, including null-termination.
+ *
+ * @param string
+ *
+ * @return the String as a ByteBuffer
+ */
+ static ByteBuffer getBufferNT(final CharSequence string) {
+ final ByteBuffer buffer = getBuffer(string.length() + 1);
+
+ for ( int i = 0; i < string.length(); i++ )
+ buffer.put((byte)string.charAt(i));
+
+ buffer.put((byte)0);
+ buffer.flip();
+ return buffer;
+ }
+
+ /**
+ * Returns a buffer containing the specified strings as bytes.
+ *
+ * @param strings
+ *
+ * @return the Strings as a ByteBuffer
+ */
+ static ByteBuffer getBuffer(final CharSequence[] strings) {
+ int length = 0;
+ for ( int i = 0; i < strings.length; i++ )
+ length += strings[i].length();
+
+ final ByteBuffer buffer = getBuffer(length);
+
+ for ( int i = 0; i < strings.length; i++ ) {
+ final CharSequence string = strings[i];
+ for ( int j = 0; j < string.length(); j++ )
+ buffer.put((byte)string.charAt(i));
+ }
+
+ buffer.flip();
+ return buffer;
+ }
+
+ /**
+ * Returns a buffer containing the specified strings as bytes, including null-termination.
+ *
+ * @param strings
+ *
+ * @return the Strings as a ByteBuffer
+ */
+ static ByteBuffer getBufferNT(final CharSequence[] strings) {
+ int length = 0;
+ for ( int i = 0; i < strings.length; i++ )
+ length += strings[i].length() + 1;
+
+ final ByteBuffer buffer = getBuffer(length);
+
+ for ( int i = 0; i < strings.length; i++ ) {
+ final CharSequence string = strings[i];
+ for ( int j = 0; j < string.length(); j++ )
+ buffer.put((byte)string.charAt(i));
+ buffer.put((byte)0);
+ }
+
+ buffer.flip();
+ return buffer;
+ }
+
+ /**
+ * Returns a buffer containing the lengths of the specified strings.
+ *
+ * @param strings
+ *
+ * @return the String lengths in an IntBuffer
+ */
+ static IntBuffer getLengths(final CharSequence[] strings) {
+ IntBuffer buffer = getLengths(strings.length);
+
+ for ( int i = 0; i < strings.length; i++ )
+ buffer.put(strings[i].length());
+
+ buffer.flip();
+ return buffer;
+ }
+
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/Alternate.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/Alternate.java 2010-03-12 20:15:38 UTC (rev 3280)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/Alternate.java 2010-03-12 21:55:13 UTC (rev 3281)
@@ -42,6 +42,10 @@
*/
@Target({ ElementType.METHOD })
public @interface Alternate {
+
/** This must match an existing GL method name. */
String value();
+
+ /** If true, an alternate Java->native call will be created. Useful when the alternate implementation uses different types. */
+ boolean nativeAlt() default false;
}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java 2010-03-12 20:15:38 UTC (rev 3280)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java 2010-03-12 21:55:13 UTC (rev 3281)
@@ -210,8 +210,18 @@
writer.println(") {");
writer.println("\t\treturn ");
+
+ boolean first = true;
while ( methods.hasNext() ) {
MethodDeclaration method = methods.next();
+ if ( method.getAnnotation(Alternate.class) != null )
+ continue;
+
+ if ( !first )
+ writer.println(" &&");
+ else
+ first = false;
+
optional = method.getAnnotation(Optional.class) != null;
deprecated = method.getAnnotation(DeprecatedGL.class) != null;
dependent = method.getAnnotation(Dependent.class);
@@ -261,8 +271,6 @@
writer.print(')');
if ( optional )
writer.print(" || true)");
- if ( methods.hasNext() )
- writer.println(" &&");
}
writer.println(";");
writer.println("\t}");
@@ -271,7 +279,8 @@
public static void generateSymbolAddresses(PrintWriter writer, InterfaceDeclaration d) {
for ( MethodDeclaration method : d.getMethods() ) {
- writer.println("\tlong " + Utils.getFunctionAddressName(d, method) + ";");
+ if ( method.getAnnotation(Alternate.class) == null )
+ writer.println("\tlong " + Utils.getFunctionAddressName(d, method) + ";");
}
}
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java 2010-03-12 20:15:38 UTC (rev 3280)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java 2010-03-12 21:55:13 UTC (rev 3281)
@@ -220,7 +220,7 @@
else if ( type.equals(boolean.class) )
return new Class[] { GLboolean.class };
else if ( type.equals(void.class) )
- return new Class[] { GLvoid.class };
+ return new Class[] { GLvoid.class, GLstring.class };
else
return new Class[] { };
}
@@ -243,6 +243,8 @@
valid_types = new Class[] { GLubyte.class };
else if ( PointerWrapper.class.isAssignableFrom(type) )
valid_types = new Class[] { GLpointer.class };
+ else if (void.class.equals(type) )
+ valid_types = new Class[] { GLstring.class };
else
valid_types = new Class[] { };
return valid_types;
Added: trunk/LWJGL/src/java/org/lwjgl/util/generator/GLstring.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/GLstring.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GLstring.java 2010-03-12 21:55:13 UTC (rev 3281)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator;
+
+/**
+ * Methods annotated with @GLstring will return a String instead of void.
+ *
+ * @author spasi
+ */
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+@NativeType
+@Target({ ElementType.METHOD })
+public @interface GLstring {
+ /** The ByteBuffer argument that will be used to retrieve the String bytes. */
+ String string();
+ /** The argument that specifies the maximum number of bytes that may be read. */
+ String maxLength();
+}
\ No newline at end of file
Added: trunk/LWJGL/src/java/org/lwjgl/util/generator/GLstringOffset.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/GLstringOffset.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GLstringOffset.java 2010-03-12 21:55:13 UTC (rev 3281)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator;
+
+/**
+ * This annotation must be used when there are more than one CharSequence arguments in a method.
+ * TODO: Add support for CharSequence[] if/when we need it.
+ *
+ * @author spasi
+ */
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+@Target({ ElementType.PARAMETER })
+public @interface GLstringOffset {
+ /** An expression that will specify the offset from which this String will be written to the ByteBuffer. */
+ String value();
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-03-12 20:15:38 UTC (rev 3280)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-03-12 21:55:13 UTC (rev 3281)
@@ -125,7 +125,8 @@
private void validateParameters(MethodDeclaration method) {
for (ParameterDeclaration param : method.getParameters()) {
validateTypes(method, param.getAnnotationMirrors(), param.getType());
- if (Utils.getNIOBufferType(param.getType()) != null) {
+ Class<?> param_type = Utils.getJavaType(param.getType());
+ if (Utils.getNIOBufferType(param.getType()) != null && param_type != CharSequence.class && param_type != CharSequence[].class) {
Check parameter_check_annotation = param.getAnnotation(Check.class);
NullTerminated null_terminated_annotation = param.getAnnotation(NullTerminated.class);
if (parameter_check_annotation == null && null_terminated_annotation == null) {
@@ -138,7 +139,11 @@
break;
}
}
- if (!found_auto_size_param && param.getAnnotation(Result.class) == null && param.getAnnotation(Constant.class) == null)
+ if (!found_auto_size_param
+ && param.getAnnotation(Result.class) == null
+ && param.getAnnotation(Constant.class) == null
+ && !Utils.isReturnString(method, param)
+ )
throw new RuntimeException(param + " has no Check, Result nor Constant annotation and no other parameters has" +
" an @AutoSize annotation on it in method " + method);
}
@@ -158,8 +163,10 @@
}
private static void generateMethodsNativePointers(PrintWriter writer, Collection<? extends MethodDeclaration> methods) {
- for (MethodDeclaration method : methods)
- generateMethodNativePointers(writer, method);
+ for (MethodDeclaration method : methods) {
+ if ( method.getAnnotation(Alternate.class) == null )
+ generateMethodNativePointers(writer, method);
+ }
}
private static void generateMethodNativePointers(PrintWriter writer, MethodDeclaration method) {
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JNITypeTranslator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/JNITypeTranslator.java 2010-03-12 20:15:38 UTC (rev 3280)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JNITypeTranslator.java 2010-03-12 21:55:13 UTC (rev 3281)
@@ -56,7 +56,10 @@
}
public void visitArrayType(ArrayType t) {
- throw new RuntimeException(t + " is not allowed");
+ if ( "java.lang.CharSequence".equals(t.getComponentType().toString()) )
+ signature.append("jobject");
+ else
+ throw new RuntimeException(t + " is not allowed");
}
public void visitClassType(ClassType t) {
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2010-03-12 20:15:38 UTC (rev 3280)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2010-03-12 21:55:13 UTC (rev 3281)
@@ -71,7 +71,8 @@
if ( method.getAnnotation(CachedResult.class) != null && !method.getAnnotation(CachedResult.class).isRange() ) {
printMethodWithMultiType(env, type_map, writer, interface_decl, method, TypeInfo.getDefaultTypeInfoMap(method), Mode.CACHEDRESULT, generate_error_checks, context_specific);
}
- if ( method.getAnnotation(Alternate.class) == null ) {
+ Alternate alt_annotation = method.getAnnotation(Alternate.class);
+ if ( alt_annotation == null || alt_annotation.nativeAlt() ) {
printJavaNativeStub(writer, method, Mode.NORMAL, generate_error_checks, context_specific);
if (Utils.hasMethodBufferObjectParameter(method)) {
printMethodWithMultiType(env, type_map, writer, interface_decl, method, TypeInfo.getDefaultTypeInfoMap(method), Mode.BUFFEROBJECT, generate_error_checks, context_specific);
@@ -119,8 +120,12 @@
writer.print("boolean " + TypeInfo.UNSIGNED_PARAMETER_NAME);
}
}
- } else if (param.getAnnotation(Result.class) == null && (native_stub || param.getAnnotation(Constant.class) == null) &&
- (getAutoTypeParameter(method, param) == null || mode != Mode.AUTOS)) {
+ } else if (
+ param.getAnnotation(Result.class) == null
+ && (native_stub || (param.getAnnotation(Constant.class) == null && !Utils.isReturnString(method, param)))
+ && (getAutoTypeParameter(method, param) == null || mode != Mode.AUTOS)
+ )
+ {
TypeInfo type_info = typeinfos_instance.get(param);
first_parameter = generateParameterJava(writer, param, type_info, native_stub, first_parameter, mode);
}
@@ -161,10 +166,15 @@
} else {
if ( native_stub && param.getAnnotation(GLpointer.class) != null )
writer.print("long");
- else
- writer.print(type_info.getType().getSimpleName());
+ else {
+ Class type = type_info.getType();
+ if ( native_stub && (type == CharSequence.class || type == CharSequence[].class) )
+ writer.print("ByteBuffer");
+ else
+ writer.print(type_info.getType().getSimpleName());
+ }
writer.print(" " + param.getSimpleName());
- if (buffer_type != null && native_stub)
+ if ( native_stub && buffer_type != null )
writer.print(", int " + param.getSimpleName() + NativeMethodStubsGenerator.BUFFER_POSITION_POSTFIX);
}
return false;
@@ -208,7 +218,7 @@
if (context_specific) {
writer.println("\t\tContextCapabilities caps = GLContext.getCapabilities();");
writer.print("\t\tlong " + Utils.FUNCTION_POINTER_VAR_NAME + " = caps.");
- writer.println(Utils.getFunctionAddressName(interface_decl, method) + ";");
+ writer.println(Utils.getFunctionAddressName(interface_decl, method, true) + ";");
writer.print("\t\tBufferChecks.checkFunctionAddress(");
writer.println(Utils.FUNCTION_POINTER_VAR_NAME + ");");
}
@@ -227,6 +237,13 @@
if ( method.getAnnotation(GLpointer.class) != null )
writer.print("new " + method.getReturnType() + "(");
}
+ GLstring string_annotation = method.getAnnotation(GLstring.class);
+ if ( string_annotation != null ) {
+ has_result = true;
+ writer.println("IntBuffer " + string_annotation.string() + "_length = StringUtils.getLengths(1);");
+ writer.println("\t\tByteBuffer " + string_annotation.string() + " = StringUtils.getBuffer(" + string_annotation.maxLength() + ");");
+ writer.print("\t\t");
+ }
writer.print(Utils.getSimpleNativeMethodName(method, generate_error_checks, context_specific));
if (mode == Mode.BUFFEROBJECT)
writer.print(Utils.BUFFER_OBJECT_METHOD_POSTFIX);
@@ -244,8 +261,14 @@
writer.println("\t\t" + type_map.getErrorCheckMethodName() + ";");
// DISABLED: indirect buffer support
//printNondirectParameterCopies(writer, method, mode);
- if (has_result)
- writer.println("\t\treturn " + Utils.RESULT_VAR_NAME + ";");
+ if (has_result) {
+ if ( string_annotation == null )
+ writer.println("\t\treturn " + Utils.RESULT_VAR_NAME + ";");
+ else {
+ writer.println("\t\t" + string_annotation.string() + ".limit(" + string_annotation.string() + "_length.get(0));");
+ writer.println("\t\treturn StringUtils.getString(" + string_annotation.string() + ");");
+ }
+ }
writer.println("\t}");
}
@@ -383,8 +406,24 @@
boolean hide_buffer = mode == Mode.AUTOS && getAutoTypeParameter(method, param) != null;
if (hide_buffer)
writer.print("null");
- else
- writer.print(param.getSimpleName());
+ else {
+ Class type = typeinfos_instance.get(param).getType();
+ if ( type == CharSequence.class || type == CharSequence[].class ) {
+ GLstringOffset offset_annotation = param.getAnnotation(GLstringOffset.class);
+
+ writer.print("StringUtils.getBuffer");
+ if ( offset_annotation != null )
+ writer.print("Offset");
+ if ( param.getAnnotation(NullTerminated.class) != null )
+ writer.print("NT");
+ writer.print("(" + param.getSimpleName());
+ if ( offset_annotation != null )
+ writer.print(", " + offset_annotation.value());
+ writer.print(")");
+ hide_buffer = true;
+ } else
+ writer.print(param.getSimpleName());
+ }
Class buffer_type = Utils.getNIOBufferType(param.getType());
if (buffer_type != null) {
writer.print(", ");
@@ -404,7 +443,9 @@
writer.print(" << " + shifting);
if (check_annotation != null && check_annotation.canBeNull())
writer.print(" : 0");
- } else
+ } else if ( param.getAnnotation(GLstringOffset.class) != null )
+ writer.print(param.getAnnotation(GLstringOffset.class).value());
+ else
writer.print("0");
} else if ( param.getAnnotation(GLpointer.class) != null ) {
writer.print(".getPointer()");
@@ -489,7 +530,8 @@
if (Utils.isAddressableType(java_type) &&
(mode != Mode.BUFFEROBJECT || param.getAnnotation(BufferObject.class) == null) &&
(mode != Mode.AUTOS || getAutoTypeParameter(method, param) == null) &&
- param.getAnnotation(Result.class) == null) {
+ param.getAnnotation(Result.class) == null &&
+ !Utils.isReturnString(method, param) ) {
String check_value = null;
boolean can_be_null = false;
Check check_annotation = param.getAnnotation(Check.class);
@@ -547,6 +589,8 @@
private static void printResultType(PrintWriter writer, MethodDeclaration method, boolean native_stub) {
if ( native_stub && method.getAnnotation(GLpointer.class) != null )
writer.print("long");
+ else if ( !native_stub && method.getAnnotation(GLstring.class) != null )
+ writer.print("String");
else
writer.print(Utils.getMethodReturnType(method).toString());
}
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaTypeTranslator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaTypeTranslator.java 2010-03-12 20:15:38 UTC (rev 3280)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaTypeTranslator.java 2010-03-12 21:55:13 UTC (rev 3281)
@@ -56,7 +56,10 @@
}
public void visitArrayType(ArrayType t) {
- throw new RuntimeException(t + " is not allowed");
+ if ( "java.lang.CharSequence".equals(t.getComponentType().toString()) )
+ type = CharSequence[].class;
+ else
+ throw new RuntimeException(t + " is not allowed");
}
public void visitPrimitiveType(PrimitiveType t) {
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2010-03-12 20:15:38 UTC (rev 3280)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2010-03-12 21:55:13 UTC (rev 3281)
@@ -56,6 +56,9 @@
public static void generateNativeMethodStubs(AnnotationProcessorEnvironment env, TypeMap type_map, PrintWriter writer, InterfaceDeclaration d, boolean generate_error_checks, boolean context_specific) {
for (MethodDeclaration method : d.getMethods()) {
+ Alternate alt_annotation = method.getAnnotation(Alternate.class);
+ if ( alt_annotation != null && !alt_annotation.nativeAlt() )
+ continue;
generateMethodStub(env, type_map, writer, Utils.getQualifiedClassName(d), method, Mode.NORMAL, generate_error_checks, context_specific);
if (Utils.hasMethodBufferObjectParameter(method))
generateMethodStub(env, type_map, writer, Utils.getQualifiedClassName(d), method, Mode.BUFFEROBJECT, generate_error_checks, context_specific);
@@ -117,9 +120,10 @@
}
writer.println(") {");
generateBufferParameterAddresses(type_map, writer, method, mode);
+ Alternate alt_annotation = method.getAnnotation(Alternate.class);
if (context_specific) {
String typedef_name = Utils.getTypedefName(method);
- writer.print("\t" + typedef_name + " " + method.getSimpleName());
+ writer.print("\t" + typedef_name ...
[truncated message content] |
|
From: <sp...@us...> - 2010-03-14 23:24:49
|
Revision: 3287
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3287&view=rev
Author: spasi
Date: 2010-03-14 23:24:40 +0000 (Sun, 14 Mar 2010)
Log Message:
-----------
Added support for single primitive input/output parameters.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/test/opengl/SyncTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/VBOTest.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/Shader.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderFP.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderFSH.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderVP.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderVSH.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/Constant.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaTypeTranslator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/PostfixTranslator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_buffer_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_buffers.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_program.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_subroutine.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sync.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_timer_query.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_transform_feedback2.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_transform_feedback3.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_array_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_program.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_draw_buffers.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_draw_buffers2.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_framebuffer_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_multi_draw_arrays.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_texture_integer.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_timer_query.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_transform_feedback.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL14.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL15.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL30.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL32.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL33.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL40.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GREMEDY_string_marker.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_explicit_multisample.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_occlusion_query.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_program.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_register_combiners.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_shader_buffer_load.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_transform_feedback.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_transform_feedback2.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_vertex_buffer_unified_memory.java
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtils.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLreturn.java
Removed Paths:
-------------
trunk/LWJGL/src/java/org/lwjgl/opengl/StringUtils.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLstring.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GLstringOffset.java
Copied: trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtils.java (from rev 3286, trunk/LWJGL/src/java/org/lwjgl/opengl/StringUtils.java)
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtils.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtils.java 2010-03-14 23:24:40 UTC (rev 3287)
@@ -0,0 +1,354 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengl;
+
+import org.lwjgl.BufferUtils;
+
+import java.nio.*;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetEncoder;
+
+/** @author spasi */
+final class APIUtils {
+
+ private static final int INITIAL_BUFFER_SIZE = 256;
+ private static final int INITIAL_LENGTHS_SIZE = 4;
+
+ private static final int BUFFERS_SIZE = 32;
+
+ private static final ThreadLocal arrayTL = new ThreadLocal() {
+ protected Object initialValue() { return new char[INITIAL_BUFFER_SIZE]; }
+ };
+
+ private static final ThreadLocal bufferTL = new ThreadLocal() {
+ protected Object initialValue() { return BufferUtils.createByteBuffer(INITIAL_BUFFER_SIZE); }
+ };
+
+ private static final ThreadLocal lengthsTL = new ThreadLocal() {
+ protected Object initialValue() { return BufferUtils.createIntBuffer(INITIAL_LENGTHS_SIZE); }
+ };
+
+ private static final ThreadLocal infiniteSeqTL = new ThreadLocal() {
+ protected Object initialValue() { return new InfiniteCharSequence(); }
+ };
+
+ private static final ThreadLocal buffersTL = new ThreadLocal() {
+ protected Object initialValue() { return new Buffers(); }
+ };
+
+ private static CharsetEncoder encoder = Charset.forName("US-ASCII").newEncoder();
+
+ private APIUtils() {
+ }
+
+ private static char[] getArray(final int size) {
+ char[] array = (char[])arrayTL.get();
+
+ if ( array.length < size ) {
+ int sizeNew = array.length << 1;
+ while ( sizeNew < size )
+ sizeNew <<= 1;
+
+ array = new char[size];
+ arrayTL.set(array);
+ }
+
+ return array;
+ }
+
+ static ByteBuffer getBufferByte(final int size) {
+ ByteBuffer buffer = (ByteBuffer)bufferTL.get();
+
+ if ( buffer.capacity() < size ) {
+ int sizeNew = buffer.capacity() << 1;
+ while ( sizeNew < size )
+ sizeNew <<= 1;
+
+ buffer = BufferUtils.createByteBuffer(size);
+ bufferTL.set(buffer);
+ } else
+ buffer.clear();
+
+ return buffer;
+ }
+
+ private static ByteBuffer getBufferByteOffset(final int size) {
+ ByteBuffer buffer = (ByteBuffer)bufferTL.get();
+
+ if ( buffer.capacity() < size ) {
+ int sizeNew = buffer.capacity() << 1;
+ while ( sizeNew < size )
+ sizeNew <<= 1;
+
+ final ByteBuffer bufferNew = BufferUtils.createByteBuffer(size);
+ bufferNew.put(buffer);
+ bufferTL.set(buffer = bufferNew);
+ } else {
+ buffer.position(buffer.limit());
+ buffer.limit(buffer.capacity());
+ }
+
+ return buffer;
+ }
+
+ static ShortBuffer getBufferShort() { return ((Buffers)buffersTL.get()).shorts; }
+
+ static IntBuffer getBufferInt() { return ((Buffers)buffersTL.get()).ints; }
+
+ static LongBuffer getBufferLong() { return ((Buffers)buffersTL.get()).longs; }
+
+ static FloatBuffer getBufferFloat() { return ((Buffers)buffersTL.get()).floats; }
+
+ static DoubleBuffer getBufferDouble() { return ((Buffers)buffersTL.get()).doubles; }
+
+ static IntBuffer getLengths() {
+ return getLengths(1);
+ }
+
+ static IntBuffer getLengths(final int size) {
+ IntBuffer lengths = (IntBuffer)lengthsTL.get();
+
+ if ( lengths.capacity() < size ) {
+ int sizeNew = lengths.capacity();
+ while ( sizeNew < size )
+ sizeNew <<= 1;
+
+ lengths = BufferUtils.createIntBuffer(size);
+ lengthsTL.set(lengths);
+ } else
+ lengths.clear();
+
+ return lengths;
+ }
+
+ private static InfiniteCharSequence getInfiniteSeq() {
+ return (InfiniteCharSequence)infiniteSeqTL.get();
+ }
+
+ private static void encode(final ByteBuffer buffer, final CharSequence string) {
+ final InfiniteCharSequence infiniteSeq = getInfiniteSeq();
+ infiniteSeq.setString(string);
+ encoder.encode(infiniteSeq.buffer, buffer, true);
+ }
+
+ /**
+ * Reads a byte string from the specified buffer.
+ *
+ * @param buffer
+ *
+ * @return the buffer as a String.
+ */
+ static String getString(final ByteBuffer buffer) {
+ final int length = buffer.remaining();
+ final char[] charArray = getArray(length);
+
+ for ( int i = buffer.position(); i < buffer.limit(); i++ )
+ charArray[i - buffer.position()] = (char)buffer.get(i);
+
+ return new String(charArray, 0, length);
+ }
+
+ /**
+ * Returns a buffer containing the specified string as bytes.
+ *
+ * @param string
+ *
+ * @return the String as a ByteBuffer
+ */
+ static ByteBuffer getBuffer(final CharSequence string) {
+ final ByteBuffer buffer = getBufferByte(string.length());
+
+ encode(buffer, string);
+
+ buffer.flip();
+ return buffer;
+ }
+
+ /**
+ * Returns a buffer containing the specified string as bytes, starting at the specified offset.
+ *
+ * @param string
+ *
+ * @return the String as a ByteBuffer
+ */
+ static ByteBuffer getBuffer(final CharSequence string, final int offset) {
+ final ByteBuffer buffer = getBufferByteOffset(offset + string.length());
+
+ encode(buffer, string);
+
+ buffer.flip();
+ return buffer;
+ }
+
+ /**
+ * Returns a buffer containing the specified string as bytes, including null-termination.
+ *
+ * @param string
+ *
+ * @return the String as a ByteBuffer
+ */
+ static ByteBuffer getBufferNT(final CharSequence string) {
+ final ByteBuffer buffer = getBufferByte(string.length() + 1);
+
+ encode(buffer, string);
+
+ buffer.put((byte)0);
+ buffer.flip();
+ return buffer;
+ }
+
+ static int getTotalLength(final CharSequence[] strings) {
+ int length = 0;
+ for ( int i = 0; i < strings.length; i++ )
+ length += strings[i].length();
+
+ return length;
+ }
+
+ /**
+ * Returns a buffer containing the specified strings as bytes.
+ *
+ * @param strings
+ *
+ * @return the Strings as a ByteBuffer
+ */
+ static ByteBuffer getBuffer(final CharSequence[] strings) {
+ final ByteBuffer buffer = getBufferByte(getTotalLength(strings));
+
+ final InfiniteCharSequence infiniteSeq = getInfiniteSeq();
+ for ( int i = 0; i < strings.length; i++ ) {
+ infiniteSeq.setString(strings[i]);
+ encoder.encode(infiniteSeq.buffer, buffer, true);
+ }
+ infiniteSeq.clear();
+
+ buffer.flip();
+ return buffer;
+ }
+
+ /**
+ * Returns a buffer containing the specified strings as bytes, including null-termination.
+ *
+ * @param strings
+ *
+ * @return the Strings as a ByteBuffer
+ */
+ static ByteBuffer getBufferNT(final CharSequence[] strings) {
+ final ByteBuffer buffer = getBufferByte(getTotalLength(strings) + strings.length);
+
+ final InfiniteCharSequence infiniteSeq = getInfiniteSeq();
+ for ( int i = 0; i < strings.length; i++ ) {
+ infiniteSeq.setString(strings[i]);
+ encoder.encode(infiniteSeq.buffer, buffer, true);
+ buffer.put((byte)0);
+ }
+ infiniteSeq.clear();
+
+ buffer.flip();
+ return buffer;
+ }
+
+ /**
+ * Returns a buffer containing the lengths of the specified strings.
+ *
+ * @param strings
+ *
+ * @return the String lengths in an IntBuffer
+ */
+ static IntBuffer getLengths(final CharSequence[] strings) {
+ IntBuffer buffer = getLengths(strings.length);
+
+ for ( int i = 0; i < strings.length; i++ )
+ buffer.put(strings[i].length());
+
+ buffer.flip();
+ return buffer;
+ }
+
+ /**
+ * A mutable CharSequence with very large initial length. We can wrap this in a re-usable CharBuffer for decoding.
+ * We cannot subclass CharBuffer because of {@link CharBuffer#toString(int,int)}.
+ */
+ private static class InfiniteCharSequence implements CharSequence {
+
+ final CharBuffer buffer;
+
+ CharSequence string;
+
+ InfiniteCharSequence() {
+ buffer = CharBuffer.wrap(this);
+ }
+
+ void setString(final CharSequence string) {
+ this.string = string;
+ this.buffer.position(0);
+ this.buffer.limit(string.length());
+ }
+
+ void clear() {
+ this.string = null;
+ }
+
+ public int length() {
+ return Integer.MAX_VALUE;
+ }
+
+ public char charAt(final int index) {
+ return string.charAt(index);
+ }
+
+ public CharSequence subSequence(final int start, final int end) {
+ return string.subSequence(start, end);
+ }
+ }
+
+ private static class Buffers {
+
+ final ShortBuffer shorts;
+ final IntBuffer ints;
+ final LongBuffer longs;
+
+ final FloatBuffer floats;
+ final DoubleBuffer doubles;
+
+ Buffers() {
+ shorts = BufferUtils.createShortBuffer(BUFFERS_SIZE);
+ ints = BufferUtils.createIntBuffer(BUFFERS_SIZE);
+ longs = BufferUtils.createLongBuffer(BUFFERS_SIZE);
+
+ floats = BufferUtils.createFloatBuffer(BUFFERS_SIZE);
+ doubles = BufferUtils.createDoubleBuffer(BUFFERS_SIZE);
+ }
+
+ }
+
+}
\ No newline at end of file
Deleted: trunk/LWJGL/src/java/org/lwjgl/opengl/StringUtils.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/StringUtils.java 2010-03-14 00:19:48 UTC (rev 3286)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/StringUtils.java 2010-03-14 23:24:40 UTC (rev 3287)
@@ -1,324 +0,0 @@
-/*
- * Copyright (c) 2002-2008 LWJGL Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package org.lwjgl.opengl;
-
-import org.lwjgl.BufferUtils;
-
-import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
-import java.nio.IntBuffer;
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetEncoder;
-
-/** @author spasi */
-final class StringUtils {
-
- private static final int INITIAL_BUFFER_SIZE = 256;
- private static final int INITIAL_LENGTHS_SIZE = 4;
-
- private static final ThreadLocal arrayTL = new ThreadLocal() {
- protected Object initialValue() {
- return new char[INITIAL_BUFFER_SIZE];
- }
- };
-
- private static final ThreadLocal bufferTL = new ThreadLocal() {
- protected Object initialValue() {
- return BufferUtils.createByteBuffer(INITIAL_BUFFER_SIZE);
- }
- };
-
- private static final ThreadLocal lengthsTL = new ThreadLocal() {
- protected Object initialValue() {
- return BufferUtils.createIntBuffer(INITIAL_LENGTHS_SIZE);
- }
- };
-
- private static final ThreadLocal infiniteSeqTL = new ThreadLocal() {
- protected Object initialValue() {
- return new InfiniteCharSequence();
- }
- };
-
- private static CharsetEncoder encoder = Charset.forName("US-ASCII").newEncoder();
-
- private StringUtils() {
- }
-
- private static char[] getArray(final int size) {
- char[] array = (char[])arrayTL.get();
-
- if ( array.length < size ) {
- int sizeNew = array.length << 1;
- while ( sizeNew < size )
- sizeNew <<= 1;
-
- array = new char[size];
- arrayTL.set(array);
- }
-
- return array;
- }
-
- static ByteBuffer getBuffer(final int size) {
- ByteBuffer buffer = (ByteBuffer)bufferTL.get();
-
- if ( buffer.capacity() < size ) {
- int sizeNew = buffer.capacity() << 1;
- while ( sizeNew < size )
- sizeNew <<= 1;
-
- buffer = BufferUtils.createByteBuffer(size);
- bufferTL.set(buffer);
- }
-
- buffer.clear();
- return buffer;
- }
-
- private static ByteBuffer getBufferOffset(final int size) {
- ByteBuffer buffer = (ByteBuffer)bufferTL.get();
-
- if ( buffer.capacity() < size ) {
- int sizeNew = buffer.capacity() << 1;
- while ( sizeNew < size )
- sizeNew <<= 1;
-
- final ByteBuffer bufferNew = BufferUtils.createByteBuffer(size);
- bufferNew.put(buffer);
- bufferTL.set(buffer = bufferNew);
- } else {
- buffer.position(buffer.limit());
- buffer.limit(buffer.capacity());
- }
-
- return buffer;
- }
-
- static IntBuffer getLengths(final int size) {
- IntBuffer lengths = (IntBuffer)lengthsTL.get();
-
- if ( lengths.capacity() < size ) {
- int sizeNew = lengths.capacity();
- while ( sizeNew < size )
- sizeNew <<= 1;
-
- lengths = BufferUtils.createIntBuffer(size);
- lengthsTL.set(lengths);
- }
-
- lengths.clear();
- return lengths;
- }
-
- static InfiniteCharSequence getInfiniteSeq() {
- return (InfiniteCharSequence)infiniteSeqTL.get();
- }
-
- /**
- * Reads a byte string from the specified buffer.
- *
- * @param buffer
- *
- * @return the buffer as a String.
- */
- static String getString(final ByteBuffer buffer) {
- final int length = buffer.remaining();
- final char[] charArray = getArray(length);
-
- for ( int i = buffer.position(); i < buffer.limit(); i++ )
- charArray[i - buffer.position()] = (char)buffer.get(i);
-
- return new String(charArray, 0, length);
- }
-
- private static void encode(final ByteBuffer buffer, final CharSequence string) {
- final InfiniteCharSequence infiniteSeq = getInfiniteSeq();
- infiniteSeq.setString(string);
- encoder.encode(infiniteSeq.buffer, buffer, true);
- }
-
- /**
- * Returns a buffer containing the specified string as bytes.
- *
- * @param string
- *
- * @return the String as a ByteBuffer
- */
- static ByteBuffer getBuffer(final CharSequence string) {
- final ByteBuffer buffer = getBuffer(string.length());
-
- encode(buffer, string);
-
- buffer.flip();
- return buffer;
- }
-
- /**
- * Returns a buffer containing the specified string as bytes, starting at the specified offset.
- *
- * @param string
- *
- * @return the String as a ByteBuffer
- */
- static ByteBuffer getBufferOffset(final CharSequence string, final int offset) {
- final ByteBuffer buffer = getBufferOffset(offset + string.length());
-
- encode(buffer, string);
-
- buffer.flip();
- return buffer;
- }
-
- /**
- * Returns a buffer containing the specified string as bytes, including null-termination.
- *
- * @param string
- *
- * @return the String as a ByteBuffer
- */
- static ByteBuffer getBufferNT(final CharSequence string) {
- final ByteBuffer buffer = getBuffer(string.length() + 1);
-
- encode(buffer, string);
-
- buffer.put((byte)0);
- buffer.flip();
- return buffer;
- }
-
- private static int getTotalLength(final CharSequence[] strings) {
- int length = 0;
- for ( int i = 0; i < strings.length; i++ )
- length += strings[i].length();
-
- return length;
- }
-
- /**
- * Returns a buffer containing the specified strings as bytes.
- *
- * @param strings
- *
- * @return the Strings as a ByteBuffer
- */
- static ByteBuffer getBuffer(final CharSequence[] strings) {
- final ByteBuffer buffer = getBuffer(getTotalLength(strings));
-
- final InfiniteCharSequence infiniteSeq = getInfiniteSeq();
- for ( int i = 0; i < strings.length; i++ ) {
- infiniteSeq.setString(strings[i]);
- encoder.encode(infiniteSeq.buffer, buffer, true);
- }
- infiniteSeq.clear();
-
- buffer.flip();
- return buffer;
- }
-
- /**
- * Returns a buffer containing the specified strings as bytes, including null-termination.
- *
- * @param strings
- *
- * @return the Strings as a ByteBuffer
- */
- static ByteBuffer getBufferNT(final CharSequence[] strings) {
- final ByteBuffer buffer = getBuffer(getTotalLength(strings) + strings.length);
-
- final InfiniteCharSequence infiniteSeq = getInfiniteSeq();
- for ( int i = 0; i < strings.length; i++ ) {
- infiniteSeq.setString(strings[i]);
- encoder.encode(infiniteSeq.buffer, buffer, true);
- buffer.put((byte)0);
- }
- infiniteSeq.clear();
-
- buffer.flip();
- return buffer;
- }
-
- /**
- * Returns a buffer containing the lengths of the specified strings.
- *
- * @param strings
- *
- * @return the String lengths in an IntBuffer
- */
- static IntBuffer getLengths(final CharSequence[] strings) {
- IntBuffer buffer = getLengths(strings.length);
-
- for ( int i = 0; i < strings.length; i++ )
- buffer.put(strings[i].length());
-
- buffer.flip();
- return buffer;
- }
-
- /**
- * A mutable CharSequence with very large initial length. We can wrap this in a re-usable CharBuffer for decoding.
- * We cannot subclass CharBuffer because of {@link CharBuffer#toString(int,int)}.
- */
- private static class InfiniteCharSequence implements CharSequence {
-
- final CharBuffer buffer;
-
- CharSequence string;
-
- InfiniteCharSequence() {
- buffer = CharBuffer.wrap(this);
- }
-
- void setString(final CharSequence string) {
- this.string = string;
- this.buffer.position(0);
- this.buffer.limit(string.length());
- }
-
- void clear() {
- this.string = null;
- }
-
- public int length() {
- return Integer.MAX_VALUE;
- }
-
- public char charAt(final int index) {
- return string.charAt(index);
- }
-
- public CharSequence subSequence(final int start, final int end) {
- return string.subSequence(start, end);
- }
- }
-
-}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/SyncTest.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/SyncTest.java 2010-03-14 00:19:48 UTC (rev 3286)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/SyncTest.java 2010-03-14 23:24:40 UTC (rev 3287)
@@ -31,17 +31,13 @@
*/
package org.lwjgl.test.opengl;
-import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLException;
import org.lwjgl.Sys;
import org.lwjgl.opengl.*;
-import java.nio.IntBuffer;
import java.util.Random;
-/**
- * @author spasi <sp...@us...>
- */
+/** @author spasi <sp...@us...> */
public final class SyncTest {
private SyncTest() {
@@ -131,9 +127,7 @@
System.out.println("Unexpected wait status: 0x" + Integer.toHexString(status));
}
- IntBuffer property = BufferUtils.createIntBuffer(1);
- GL32.glGetSync(sync, GL32.GL_SYNC_STATUS, null, property);
- System.out.println("Sync Status: " + (property.get(0) == GL32.GL_UNSIGNALED ? "UNSIGNALED" : "SIGNALED"));
+ System.out.println("Sync Status: " + (GL32.glGetSync(sync, GL32.GL_SYNC_STATUS) == GL32.GL_UNSIGNALED ? "UNSIGNALED" : "SIGNALED"));
GL32.glDeleteSync(sync);
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/VBOTest.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/VBOTest.java 2010-03-14 00:19:48 UTC (rev 3286)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/VBOTest.java 2010-03-14 23:24:40 UTC (rev 3287)
@@ -44,7 +44,6 @@
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
-import java.nio.IntBuffer;
import org.lwjgl.Sys;
import org.lwjgl.input.Keyboard;
@@ -191,9 +190,7 @@
System.out.println("ARB VBO not supported!");
System.exit(1);
}
- IntBuffer int_buffer = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer();
- ARBBufferObject.glGenBuffersARB(int_buffer);
- buffer_id = int_buffer.get(0);
+ buffer_id = ARBBufferObject.glGenBuffersARB();
ARBBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, buffer_id);
vertices = ByteBuffer.allocateDirect(2 * 4 * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();
vertices.put(-50).put(-50).put(50).put(-50).put(50).put(50).put(-50).put(50);
@@ -206,9 +203,7 @@
* Cleanup
*/
private static void cleanup() {
- IntBuffer int_buffer = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer();
- int_buffer.put(0, buffer_id);
- ARBBufferObject.glDeleteBuffersARB(int_buffer);
+ ARBBufferObject.glDeleteBuffersARB(buffer_id);
Display.destroy();
}
}
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/Shader.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/Shader.java 2010-03-14 00:19:48 UTC (rev 3286)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/Shader.java 2010-03-14 23:24:40 UTC (rev 3287)
@@ -37,21 +37,18 @@
*/
package org.lwjgl.test.opengl.shaders;
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.ByteBuffer;
-import java.nio.IntBuffer;
-
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.ARBProgram;
import org.lwjgl.opengl.ARBShaderObjects;
import org.lwjgl.opengl.GL11;
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+
abstract class Shader {
- private static final IntBuffer int_buffer = BufferUtils.createIntBuffer(16);
- protected static IntBuffer programBuffer = BufferUtils.createIntBuffer(1);
protected static ByteBuffer fileBuffer = BufferUtils.createByteBuffer(1024 * 10);
protected Shader() {
@@ -61,18 +58,6 @@
abstract void cleanup();
- /**
- * Obtain a GL integer value from the driver
- *
- * @param gl_enum The GL value you want
- *
- * @return the integer value
- */
- public static int glGetInteger(int gl_enum) {
- GL11.glGetInteger(gl_enum, int_buffer);
- return int_buffer.get(0);
- }
-
protected static String getShaderText(String file) {
String shader = null;
@@ -107,7 +92,7 @@
protected static void checkProgramError(String programFile, String programSource) {
if ( GL11.glGetError() == GL11.GL_INVALID_OPERATION ) {
- final int errorPos = glGetInteger(ARBProgram.GL_PROGRAM_ERROR_POSITION_ARB);
+ final int errorPos = GL11.glGetInteger(ARBProgram.GL_PROGRAM_ERROR_POSITION_ARB);
int lineStart = 0;
int lineEnd = -1;
for ( int i = 0; i < programSource.length(); i++ ) {
@@ -140,9 +125,7 @@
}
protected static void printShaderObjectInfoLog(String file, int ID) {
- ARBShaderObjects.glGetObjectParameterARB(ID, ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB, programBuffer);
-
- final int logLength = programBuffer.get(0);
+ final int logLength = ARBShaderObjects.glGetObjectParameteriARB(ID, ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB);
if ( logLength <= 1 )
return;
@@ -153,9 +136,7 @@
}
protected static void printShaderProgramInfoLog(int ID) {
- ARBShaderObjects.glGetObjectParameterARB(ID, ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB, programBuffer);
-
- final int logLength = programBuffer.get(0);
+ final int logLength = ARBShaderObjects.glGetObjectParameteriARB(ID, ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB);
if ( logLength <= 1 )
return;
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderFP.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderFP.java 2010-03-14 00:19:48 UTC (rev 3286)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderFP.java 2010-03-14 23:24:40 UTC (rev 3287)
@@ -60,10 +60,8 @@
vpFile = vpShaderFile;
vpSource = getShaderText(vpShaderFile);
- ARBProgram.gl...
[truncated message content] |
|
From: <sp...@us...> - 2010-03-16 17:58:55
|
Revision: 3288
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3288&view=rev
Author: spasi
Date: 2010-03-16 17:58:48 +0000 (Tue, 16 Mar 2010)
Log Message:
-----------
Added some alternate AL functions.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java
trunk/LWJGL/src/templates/org/lwjgl/openal/AL10.java
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java 2010-03-14 23:24:40 UTC (rev 3287)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java 2010-03-16 17:58:48 UTC (rev 3288)
@@ -153,6 +153,8 @@
}
void cleanup() {
+ GL15.glDeleteBuffers(bufferID);
+
GL20.glDetachShader(programID, shaderID);
GL20.glDeleteShader(shaderID);
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-03-14 23:24:40 UTC (rev 3287)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-03-16 17:58:48 UTC (rev 3288)
@@ -173,9 +173,7 @@
writer.println("static " + Utils.getTypedefName(method) + " " + method.getSimpleName() + ";");
}
- private void generateJavaSource(InterfaceDeclaration d) throws IOException {
- validateMethods(d);
- PrintWriter java_writer = env.getFiler().createTextFile(Filer.Location.SOURCE_TREE, d.getPackage().getQualifiedName(), new File(Utils.getSimpleClassName(d) + ".java"), null);
+ private void generateJavaSource(InterfaceDeclaration d, PrintWriter java_writer) throws IOException {
java_writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */");
java_writer.println();
java_writer.println("package " + d.getPackage().getQualifiedName() + ";");
@@ -252,23 +250,25 @@
File input = d.getPosition().file();
File output = new File(env.getOptions().get("-s") + '/' + d.getPackage().getQualifiedName().replace('.', '/'), Utils.getSimpleClassName(d) + ".java");
+ PrintWriter java_writer = null;
+
try {
// Skip this class if the output exists and the input has not been modified.
if ( output.exists() && input.lastModified() < output.lastModified() )
return;
- if (d.getMethods().size() > 0 || d.getFields().size() > 0)
- generateJavaSource(d);
+ if (d.getMethods().size() > 0 || d.getFields().size() > 0) {
+ validateMethods(d);
+ java_writer = env.getFiler().createTextFile(Filer.Location.SOURCE_TREE, d.getPackage().getQualifiedName(), new File(Utils.getSimpleClassName(d) + ".java"), null);
+ generateJavaSource(d, java_writer);
+ }
if (d.getMethods().size() > 0)
generateNativeSource(d);
} catch (Exception e) {
- try {
- // If anything goes wrong mid-gen, delete output to allow regen next time we run.
- if ( output.exists() )
- output.delete();
- } catch (Exception e2) {
- // ignore
- }
+ // If anything goes wrong mid-gen, delete output to allow regen next time we run.
+ if ( java_writer != null ) java_writer.close();
+ if ( output.exists() ) output.delete();
+
throw new RuntimeException(e);
}
}
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2010-03-14 23:24:40 UTC (rev 3287)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2010-03-16 17:58:48 UTC (rev 3288)
@@ -73,6 +73,8 @@
}
Alternate alt_annotation = method.getAnnotation(Alternate.class);
if ( alt_annotation == null || alt_annotation.nativeAlt() ) {
+ if ( alt_annotation != null && method.getSimpleName().equals(alt_annotation.value()) )
+ throw new RuntimeException("An alternate function with native code should have a different name than the main function.");
printJavaNativeStub(writer, method, Mode.NORMAL, generate_error_checks, context_specific);
if (Utils.hasMethodBufferObjectParameter(method)) {
printMethodWithMultiType(env, type_map, writer, interface_decl, method, TypeInfo.getDefaultTypeInfoMap(method), Mode.BUFFEROBJECT, generate_error_checks, context_specific);
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java 2010-03-14 23:24:40 UTC (rev 3287)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java 2010-03-16 17:58:48 UTC (rev 3288)
@@ -52,6 +52,8 @@
Iterator<? extends MethodDeclaration> it = d.getMethods().iterator();
while (it.hasNext()) {
MethodDeclaration method = it.next();
+ if ( method.getAnnotation(Alternate.class) != null )
+ continue;
EnumSet<Platform> platforms;
PlatformDependent platform_annotation = method.getAnnotation(PlatformDependent.class);
if (platform_annotation != null)
Modified: trunk/LWJGL/src/templates/org/lwjgl/openal/AL10.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/openal/AL10.java 2010-03-14 23:24:40 UTC (rev 3287)
+++ trunk/LWJGL/src/templates/org/lwjgl/openal/AL10.java 2010-03-16 17:58:48 UTC (rev 3288)
@@ -721,6 +721,10 @@
@ALvoid
void alGenSources(@AutoSize("sources") @ALsizei int n, @OutParameter @ALuint IntBuffer sources);
+ @Alternate(value = "alGenSources", nativeAlt = true)
+ @ALvoid
+ void alGenSources2(@Constant("1") @ALsizei int n, @Result @ALuint int source);
+
/**
* The application requests deletion of a number of Sources by DeleteSources.
*
@@ -729,6 +733,10 @@
@ALvoid
void alDeleteSources(@AutoSize("sources") @ALsizei int n, @ALuint IntBuffer sources);
+ @Alternate(value = "alDeleteSources", nativeAlt = true)
+ @ALvoid
+ void alDeleteSources2(@Constant("1") @ALsizei int n, @Indirect @ALuint int source);
+
/**
* The application can verify whether a source name is valid using the IsSource query.
*
@@ -945,6 +953,10 @@
@ALvoid
void alGenBuffers(@AutoSize("buffers") @ALsizei int n, @OutParameter @ALuint IntBuffer buffers);
+ @Alternate(value = "alGenBuffers", nativeAlt = true)
+ @ALvoid
+ void alGenBuffers2(@Constant("1") @ALsizei int n, @Result @ALuint int buffer);
+
/**
* <p>
* The application requests deletion of a number of Buffers by calling DeleteBuffers.
@@ -964,6 +976,10 @@
@ALvoid
void alDeleteBuffers(@AutoSize("buffers") @ALsizei int n, @ALuint IntBuffer buffers);
+ @Alternate(value = "alDeleteBuffers", nativeAlt = true)
+ @ALvoid
+ void alDeleteBuffers2(@Constant("1") @ALsizei int n, @Indirect @ALuint int buffer);
+
/**
* The application can verify whether a buffer Name is valid using the IsBuffer query.
*
@@ -1052,6 +1068,10 @@
@ALvoid
void alSourceQueueBuffers(@ALuint int source, @AutoSize("buffers") @ALsizei int n, @ALuint IntBuffer buffers);
+ @Alternate(value = "alSourceQueueBuffers", nativeAlt = true)
+ @ALvoid
+ void alSourceQueueBuffers2(@ALuint int source, @Constant("1") @ALsizei int n, @Indirect @ALuint int buffer);
+
/**
* <p>
* Once a queue entry for a buffer has been appended to a queue and is pending
@@ -1074,6 +1094,10 @@
@ALvoid
void alSourceUnqueueBuffers(@ALuint int source, @AutoSize("buffers") @ALsizei int n, @OutParameter @ALuint IntBuffer buffers);
+ @Alternate(value = "alSourceUnqueueBuffers", nativeAlt = true)
+ @ALvoid
+ void alSourceUnqueueBuffers2(@ALuint int source, @Constant("1") @ALsizei int n, @Result @ALuint int buffer);
+
/**
* <p>
* Samples usually use the entire dynamic range of the chosen format/encoding,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-03-16 19:05:26
|
Revision: 3289
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3289&view=rev
Author: spasi
Date: 2010-03-16 19:05:19 +0000 (Tue, 16 Mar 2010)
Log Message:
-----------
Added JNIEXPORT to AL alternate methods.
Now forcing full regen when any class in the Generator changes.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java
Property Changed:
----------------
trunk/LWJGL/src/native/common/
trunk/LWJGL/src/native/linux/
trunk/LWJGL/src/native/macosx/
trunk/LWJGL/src/native/windows/
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java 2010-03-16 17:58:48 UTC (rev 3288)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java 2010-03-16 19:05:19 UTC (rev 3289)
@@ -35,6 +35,8 @@
import com.sun.mirror.apt.*;
import com.sun.mirror.declaration.*;
+import java.io.File;
+import java.io.FileFilter;
import java.util.Collection;
import java.util.Set;
import java.util.Map;
@@ -108,10 +110,11 @@
TypeDeclaration lastFile = null;
try {
+ long generatorLM = getGeneratorLastModified();
TypeMap type_map = (TypeMap)(Class.forName(typemap_classname).newInstance());
for (TypeDeclaration typedecl : env.getSpecifiedTypeDeclarations()) {
lastFile = typedecl;
- typedecl.accept(getDeclarationScanner(new GeneratorVisitor(env, type_map, generate_error_checks, context_specific), NO_OP));
+ typedecl.accept(getDeclarationScanner(new GeneratorVisitor(env, type_map, generate_error_checks, context_specific, generatorLM), NO_OP));
}
} catch (Exception e) {
if ( lastFile == null )
@@ -120,5 +123,35 @@
throw new RuntimeException("\n-- Failed to process template: " + lastFile.getQualifiedName() + " --", e);
}
}
+
+ /**
+ * Gets the time of the latest change on the Generator classes.
+ *
+ * @return time of the latest change
+ */
+ private static long getGeneratorLastModified() {
+ final File pck = new File(System.getProperty("user.dir") + "/bin/org/lwjgl/util/generator");
+ if ( !pck.exists() || !pck.isDirectory() )
+ return Long.MAX_VALUE;
+
+ final File[] classes = pck.listFiles(new FileFilter() {
+ public boolean accept(final File pathname) {
+ return pathname.isFile() && pathname.getName().endsWith(".class");
+ }
+ });
+
+ if ( classes == null || classes.length == 0 )
+ return Long.MAX_VALUE;
+
+ long lastModified = 0;
+
+ for ( File clazz : classes ) {
+ long lm = clazz.lastModified();
+ if ( lastModified < lm )
+ lastModified = lm;
+ }
+
+ return lastModified;
+ }
}
-}
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-03-16 17:58:48 UTC (rev 3288)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-03-16 19:05:19 UTC (rev 3289)
@@ -58,12 +58,14 @@
private final TypeMap type_map;
private final boolean generate_error_checks;
private final boolean context_specific;
+ private final long generatorLM;
- public GeneratorVisitor(AnnotationProcessorEnvironment env, TypeMap type_map, boolean generate_error_checks, boolean context_specific) {
+ public GeneratorVisitor(AnnotationProcessorEnvironment env, TypeMap type_map, boolean generate_error_checks, boolean context_specific, long generatorLM) {
this.env = env;
this.type_map = type_map;
this.generate_error_checks = generate_error_checks;
this.context_specific = context_specific;
+ this.generatorLM = generatorLM;
}
private void validateMethods(InterfaceDeclaration d) {
@@ -254,7 +256,7 @@
try {
// Skip this class if the output exists and the input has not been modified.
- if ( output.exists() && input.lastModified() < output.lastModified() )
+ if ( output.exists() && Math.max(input.lastModified(), generatorLM) < output.lastModified() )
return;
if (d.getMethods().size() > 0 || d.getFields().size() > 0) {
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2010-03-16 17:58:48 UTC (rev 3288)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2010-03-16 19:05:19 UTC (rev 3289)
@@ -87,7 +87,7 @@
}
private static void generateMethodStub(AnnotationProcessorEnvironment env, TypeMap type_map, PrintWriter writer, String interface_name, MethodDeclaration method, Mode mode, boolean generate_error_checks, boolean context_specific) {
- if ( !context_specific )
+ if ( !context_specific && method.getAnnotation(Alternate.class) == null )
writer.print("static ");
else
writer.print("JNIEXPORT ");
Property changes on: trunk/LWJGL/src/native/common
___________________________________________________________________
Modified: svn:ignore
- Debug
Release
org_lwjgl_input_Cursor.h
org_lwjgl_input_Keyboard.h
org_lwjgl_input_Mouse.h
org_lwjgl_openal_AL.h
org_lwjgl_openal_ALC.h
org_lwjgl_opengl_GLContext.h
org_lwjgl_opengl_Pbuffer.h
org_lwjgl_Sys.h
org_lwjgl_opengl_Display.h
org_lwjgl_DefaultSysImplementation.h
org_lwjgl_NativeSysImplementation.h
+ Debug
Release
org_lwjgl_DefaultSysImplementation.h
org_lwjgl_NativeSysImplementation.h
org_lwjgl_Sys.h
org_lwjgl_input_Cursor.h
org_lwjgl_input_Cursor_CursorElement.h
org_lwjgl_input_Keyboard.h
org_lwjgl_input_Keyboard_KeyEvent.h
org_lwjgl_input_Mouse.h
org_lwjgl_openal_AL.h
org_lwjgl_openal_ALC.h
org_lwjgl_opengl_AWTSurfaceLock.h
org_lwjgl_opengl_Display.h
org_lwjgl_opengl_GLContext.h
org_lwjgl_opengl_GLContext_CapabilitiesCacheEntry.h
org_lwjgl_opengl_Pbuffer.h
Property changes on: trunk/LWJGL/src/native/linux
___________________________________________________________________
Modified: svn:ignore
- org_lwjgl_opengl_LinuxDisplay.h
+ org_lwjgl_LinuxSysImplementation.h
org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.h
org_lwjgl_opengl_LinuxCanvasImplementation.h
org_lwjgl_opengl_LinuxContextImplementation.h
org_lwjgl_opengl_LinuxDisplay.h
org_lwjgl_opengl_LinuxDisplayPeerInfo.h
org_lwjgl_opengl_LinuxEvent.h
org_lwjgl_opengl_LinuxKeyboard.h
org_lwjgl_opengl_LinuxMouse.h
org_lwjgl_opengl_LinuxPbufferPeerInfo.h
org_lwjgl_opengl_LinuxPeerInfo.h
Property changes on: trunk/LWJGL/src/native/macosx
___________________________________________________________________
Modified: svn:ignore
- org_lwjgl_opengl_MacOSXDisplay.h
+ org_lwjgl_MacOSXSysImplementation.h
org_lwjgl_opengl_MacOSXCanvasPeerInfo.h
org_lwjgl_opengl_MacOSXContextImplementation.h
org_lwjgl_opengl_MacOSXDisplay.h
org_lwjgl_opengl_MacOSXMouseEventQueue.h
org_lwjgl_opengl_MacOSXPbufferPeerInfo.h
org_lwjgl_opengl_MacOSXPeerInfo.h
Property changes on: trunk/LWJGL/src/native/windows
___________________________________________________________________
Modified: svn:ignore
- Debug
Release
org_lwjgl_opengl_Win32Display.h
org_lwjgl_Win32SysImplementation.h
org_lwjgl_NativeSysImplementation.h
+ Debug
Release
org_lwjgl_NativeSysImplementation.h
org_lwjgl_Win32SysImplementation.h
org_lwjgl_WindowsSysImplementation.h
org_lwjgl_opengl_Win32Display.h
org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo.h
org_lwjgl_opengl_WindowsContextImplementation.h
org_lwjgl_opengl_WindowsDisplay.h
org_lwjgl_opengl_WindowsDisplayPeerInfo.h
org_lwjgl_opengl_WindowsDisplay_Rect.h
org_lwjgl_opengl_WindowsKeyboard.h
org_lwjgl_opengl_WindowsPbufferPeerInfo.h
org_lwjgl_opengl_WindowsPeerInfo.h
org_lwjgl_opengl_WindowsRegistry.h
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-03-23 12:43:51
|
Revision: 3293
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3293&view=rev
Author: spasi
Date: 2010-03-23 12:43:44 +0000 (Tue, 23 Mar 2010)
Log Message:
-----------
Added alternatives for glGetActiveUniform/Attrib.
Added a javadoc comment to all alternative methods.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/util/generator/Alternate.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/Alternate.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/Alternate.java 2010-03-17 19:03:03 UTC (rev 3292)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/Alternate.java 2010-03-23 12:43:44 UTC (rev 3293)
@@ -48,4 +48,7 @@
/** If true, an alternate Java->native call will be created. Useful when the alternate implementation uses different types. */
boolean nativeAlt() default false;
+
+ /** If true, the alternate method's name will be used for the Java call. */
+ boolean javaAlt() default false;
}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2010-03-17 19:03:03 UTC (rev 3292)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2010-03-23 12:43:44 UTC (rev 3293)
@@ -210,7 +210,7 @@
StripPostfix strip_annotation = method.getAnnotation(StripPostfix.class);
String method_name;
Alternate alt_annotation = method.getAnnotation(Alternate.class);
- method_name = alt_annotation == null ? method.getSimpleName() : alt_annotation.value();
+ method_name = alt_annotation == null || alt_annotation.javaAlt() ? method.getSimpleName() : alt_annotation.value();
if (strip_annotation != null && mode == Mode.NORMAL)
method_name = getPostfixStrippedName(type_map, interface_decl, method);
writer.print(" " + method_name + "(");
@@ -324,7 +324,7 @@
}
String method_name;
Alternate alt_annotation = method.getAnnotation(Alternate.class);
- method_name = alt_annotation == null ? method.getSimpleName() : alt_annotation.value();
+ method_name = alt_annotation == null || alt_annotation.javaAlt() ? method.getSimpleName() : alt_annotation.value();
String extension_postfix = "NULL".equals(strip_annotation.extension()) ? getExtensionPostfix(interface_decl) : strip_annotation.extension();
String result;
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java 2010-03-17 19:03:03 UTC (rev 3292)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java 2010-03-23 12:43:44 UTC (rev 3293)
@@ -154,7 +154,8 @@
while (doc_lines.hasMoreTokens())
writer.println("\t *" + doc_lines.nextToken());
writer.println("\t */");
- }
+ } else if ( (decl instanceof MethodDeclaration) && decl.getAnnotation(Alternate.class) != null )
+ writer.println("\t/** Overloads " + decl.getAnnotation(Alternate.class).value() + " */");
}
public static AnnotationMirror getParameterAutoAnnotation(ParameterDeclaration param) {
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java 2010-03-17 19:03:03 UTC (rev 3292)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java 2010-03-23 12:43:44 UTC (rev 3293)
@@ -227,6 +227,22 @@
@OutParameter @GLenum @Check("1") IntBuffer type,
@OutParameter @GLcharARB ByteBuffer name);
+ @Alternate(value = "glGetActiveUniformARB", javaAlt = true)
+ @GLreturn(value = "size")
+ void glGetActiveUniformSizeARB(@GLhandleARB int programObj, @GLuint int index, @Constant("0") @GLsizei int maxLength,
+ @OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
+ @OutParameter IntBuffer size,
+ @OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore
+ @GLcharARB @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
+
+ @Alternate(value = "glGetActiveUniformARB", javaAlt = true)
+ @GLreturn(value = "type")
+ void glGetActiveUniformTypeARB(@GLhandleARB int programObj, @GLuint int index, @Constant("0") @GLsizei int maxLength,
+ @OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
+ @OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore
+ @OutParameter @GLenum IntBuffer type,
+ @GLcharARB @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
+
@StripPostfix("params")
void glGetUniformfvARB(@GLhandleARB int programObj, int location, @OutParameter @Check FloatBuffer params);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java 2010-03-17 19:03:03 UTC (rev 3292)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java 2010-03-23 12:43:44 UTC (rev 3293)
@@ -117,7 +117,7 @@
@GLreturn("params")
@StripPostfix("params")
void glGetActiveUniformsiv(@GLuint int program, @Constant("1") @GLsizei int uniformCount,
- @Constant(value = "APIUtils.getBufferInt().put(1, uniformIndex), 1", keepParam = true) int uniformIndex, // index 0 used by return value
+ @Constant(value = "params.put(1, uniformIndex), 1", keepParam = true) int uniformIndex, // Reuse params buffer
@GLenum int pname,
@OutParameter @GLint IntBuffer params);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java 2010-03-17 19:03:03 UTC (rev 3292)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java 2010-03-23 12:43:44 UTC (rev 3293)
@@ -63,15 +63,11 @@
int GL_VERTEX_PROGRAM_POINT_SIZE_ARB = 0x8642;
int GL_VERTEX_PROGRAM_TWO_SIDE_ARB = 0x8643;
- /**
- * Accepted by the <pname> parameter GetObjectParameter{if}vARB:
- */
+ /** Accepted by the <pname> parameter GetObjectParameter{if}vARB: */
int GL_OBJECT_ACTIVE_ATTRIBUTES_ARB = 0x8B89;
int GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB = 0x8B8A;
- /**
- * Accepted by the <pname> parameter of GetVertexAttrib{dfi}vARB:
- */
+ /** Accepted by the <pname> parameter of GetVertexAttrib{dfi}vARB: */
int GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB = 0x8622;
int GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB = 0x8623;
int GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB = 0x8624;
@@ -79,14 +75,10 @@
int GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB = 0x886A;
int GL_CURRENT_VERTEX_ATTRIB_ARB = 0x8626;
- /**
- * Accepted by the <pname> parameter of GetVertexAttribPointervARB:
- */
+ /** Accepted by the <pname> parameter of GetVertexAttribPointervARB: */
int GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB = 0x8645;
- /**
- * Returned by the <type> parameter of GetActiveAttribARB:
- */
+ /** Returned by the <type> parameter of GetActiveAttribARB: */
int GL_FLOAT = 0x1406;
int GL_FLOAT_VEC2_ARB = 0x8B50;
int GL_FLOAT_VEC3_ARB = 0x8B51;
@@ -122,7 +114,7 @@
void glVertexAttrib4NubARB(@GLuint int index, @GLubyte byte x, @GLubyte byte y, @GLubyte byte z, @GLubyte byte w);
void glVertexAttribPointerARB(@GLuint int index, int size, @AutoType("buffer") @GLenum int type, boolean normalized, @GLsizei int stride,
- @CachedReference(index="index",name="glVertexAttribPointer_buffer")
+ @CachedReference(index = "index", name = "glVertexAttribPointer_buffer")
@BufferObject(BufferKind.ArrayVBO)
@Check
@Const
@@ -145,19 +137,35 @@
void glBindAttribLocationARB(@GLhandleARB int programObj, @GLuint int index, @NullTerminated CharSequence name);
void glGetActiveAttribARB(@GLhandleARB int programObj, @GLuint int index, @AutoSize("name") @GLsizei int maxLength,
- @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length,
- @OutParameter @Check("1") IntBuffer size,
- @OutParameter @GLenum @Check("1") IntBuffer type,
- @OutParameter @GLcharARB ByteBuffer name);
+ @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length,
+ @OutParameter @Check("1") IntBuffer size,
+ @OutParameter @GLenum @Check("1") IntBuffer type,
+ @OutParameter @GLcharARB ByteBuffer name);
@Alternate("glGetActiveAttribARB")
@GLreturn(value = "name", maxLength = "maxLength")
void glGetActiveAttribARB2(@GLhandleARB int programObj, @GLuint int index, @GLsizei int maxLength,
- @OutParameter @GLsizei @Constant("name_length, 0") IntBuffer length,
- @OutParameter @Check("1") IntBuffer size,
- @OutParameter @GLenum @Check("1") IntBuffer type,
- @OutParameter @GLcharARB ByteBuffer name);
+ @OutParameter @GLsizei @Constant("name_length, 0") IntBuffer length,
+ @OutParameter @Check("1") IntBuffer size,
+ @OutParameter @GLenum @Check("1") IntBuffer type,
+ @OutParameter @GLcharARB ByteBuffer name);
+ @Alternate(value = "glGetActiveAttribARB", javaAlt = true)
+ @GLreturn(value = "size")
+ void glGetActiveAttribSizeARB(@GLhandleARB int programObj, @GLuint int index, @Constant("0") @GLsizei int maxLength,
+ @OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
+ @OutParameter IntBuffer size,
+ @OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore
+ @GLcharARB @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
+
+ @Alternate(value = "glGetActiveAttribARB", javaAlt = true)
+ @GLreturn(value = "type")
+ void glGetActiveAttribTypeARB(@GLhandleARB int programObj, @GLuint int index, @Constant("0") @GLsizei int maxLength,
+ @OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
+ @OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore
+ @OutParameter @GLenum IntBuffer type,
+ @GLcharARB @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
+
int glGetAttribLocationARB(@GLhandleARB int programObj, @NullTerminated @Const @GLcharARB ByteBuffer name);
@Alternate("glGetAttribLocationARB")
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java 2010-03-17 19:03:03 UTC (rev 3292)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java 2010-03-23 12:43:44 UTC (rev 3293)
@@ -250,6 +250,22 @@
@OutParameter @GLenum @Check("1") IntBuffer type,
@OutParameter @GLchar ByteBuffer name);
+ @Alternate(value = "glGetActiveUniform", javaAlt = true)
+ @GLreturn(value = "size")
+ void glGetActiveUniformSize(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int maxLength,
+ @OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
+ @OutParameter IntBuffer size,
+ @OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore
+ @GLchar @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
+
+ @Alternate(value = "glGetActiveUniform", javaAlt = true)
+ @GLreturn(value = "type")
+ void glGetActiveUniformType(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int maxLength,
+ @OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
+ @OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore
+ @OutParameter @GLenum IntBuffer type,
+ @GLchar @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
+
@StripPostfix("params")
void glGetUniformfv(@GLuint int program, int location, @OutParameter @Check FloatBuffer params);
@@ -386,6 +402,22 @@
@OutParameter @GLenum @Check("1") IntBuffer type,
@OutParameter @GLchar ByteBuffer name);
+ @Alternate(value = "glGetActiveAttrib", javaAlt = true)
+ @GLreturn(value = "size")
+ void glGetActiveAttribSize(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int maxLength,
+ @OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
+ @OutParameter IntBuffer size,
+ @OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore
+ @GLchar @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
+
+ @Alternate(value = "glGetActiveAttrib", javaAlt = true)
+ @GLreturn(value = "type")
+ void glGetActiveAttribType(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int maxLength,
+ @OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
+ @OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore
+ @OutParameter @GLenum IntBuffer type,
+ @GLchar @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
+
int glGetAttribLocation(@GLuint int program, @NullTerminated @Const @GLchar ByteBuffer name);
@Alternate("glGetAttribLocation")
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java 2010-03-17 19:03:03 UTC (rev 3292)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java 2010-03-23 12:43:44 UTC (rev 3293)
@@ -250,7 +250,7 @@
@GLreturn("params")
@StripPostfix("params")
void glGetActiveUniformsiv(@GLuint int program, @Constant("1") @GLsizei int uniformCount,
- @Constant(value = "APIUtils.getBufferInt().put(0, uniformIndex), 0", keepParam = true) int uniformIndex,
+ @Constant(value = "params.put(1, uniformIndex), 1", keepParam = true) int uniformIndex, // Reuse params buffer
@GLenum int pname,
@OutParameter @GLint IntBuffer params);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-03-31 20:56:15
|
Revision: 3300
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3300&view=rev
Author: spasi
Date: 2010-03-31 20:56:07 +0000 (Wed, 31 Mar 2010)
Log Message:
-----------
Added yet another glGetActiveUniform alternative.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java
Modified: trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java 2010-03-31 15:46:16 UTC (rev 3299)
+++ trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java 2010-03-31 20:56:07 UTC (rev 3300)
@@ -45,7 +45,7 @@
* $Id$
*/
final class WindowsSysImplementation extends DefaultSysImplementation {
- private final static int JNI_VERSION = 22;
+ private final static int JNI_VERSION = 22;
static {
Sys.initialize();
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java 2010-03-31 15:46:16 UTC (rev 3299)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java 2010-03-31 20:56:07 UTC (rev 3300)
@@ -227,6 +227,16 @@
@OutParameter @GLenum @Check("1") IntBuffer type,
@OutParameter @GLcharARB ByteBuffer name);
+ /** This version returns both size and type in the sizeType buffer (at .position() and .position() + 1). */
+ @Alternate("glGetActiveUniformARB")
+ @GLreturn(value = "name", maxLength = "maxLength")
+ void glGetActiveUniformARB3(@GLhandleARB int programObj, @GLuint int index, @GLsizei int maxLength,
+ @OutParameter @GLsizei @Constant("name_length, 0") IntBuffer length,
+ @OutParameter @Check("2") IntBuffer sizeType,
+ @OutParameter @GLenum @Constant("sizeType, sizeType.position() + 1") IntBuffer type,
+ @OutParameter @GLcharARB ByteBuffer name);
+
+ /** This version returns only the uniform size. */
@Alternate(value = "glGetActiveUniformARB", javaAlt = true)
@GLreturn(value = "size")
void glGetActiveUniformSizeARB(@GLhandleARB int programObj, @GLuint int index, @Constant("0") @GLsizei int maxLength,
@@ -235,6 +245,7 @@
@OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore
@GLcharARB @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
+ /** This version returns only the uniform type. */
@Alternate(value = "glGetActiveUniformARB", javaAlt = true)
@GLreturn(value = "type")
void glGetActiveUniformTypeARB(@GLhandleARB int programObj, @GLuint int index, @Constant("0") @GLsizei int maxLength,
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java 2010-03-31 15:46:16 UTC (rev 3299)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java 2010-03-31 20:56:07 UTC (rev 3300)
@@ -250,6 +250,16 @@
@OutParameter @GLenum @Check("1") IntBuffer type,
@OutParameter @GLchar ByteBuffer name);
+ /** This version returns both size and type in the sizeType buffer (at .position() and .position() + 1). */
+ @Alternate("glGetActiveUniformARB")
+ @GLreturn(value = "name", maxLength = "maxLength")
+ void glGetActiveUniform3(@GLuint int program, @GLuint int index, @GLsizei int maxLength,
+ @OutParameter @GLsizei @Constant("name_length, 0") IntBuffer length,
+ @OutParameter @Check("2") IntBuffer sizeType,
+ @OutParameter @GLenum @Constant("sizeType, sizeType.position() + 1") IntBuffer type,
+ @OutParameter @GLchar ByteBuffer name);
+
+ /** This version returns only the uniform size. */
@Alternate(value = "glGetActiveUniform", javaAlt = true)
@GLreturn(value = "size")
void glGetActiveUniformSize(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int maxLength,
@@ -258,6 +268,7 @@
@OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore
@GLchar @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
+ /** This version returns only the uniform type. */
@Alternate(value = "glGetActiveUniform", javaAlt = true)
@GLreturn(value = "type")
void glGetActiveUniformType(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int maxLength,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-03-31 23:56:31
|
Revision: 3302
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3302&view=rev
Author: spasi
Date: 2010-03-31 23:56:24 +0000 (Wed, 31 Mar 2010)
Log Message:
-----------
Fixed mouse grabbing on secondary monitors.
Added extra device polling when vsync is enabled, to reduce input lag.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2010-03-31 21:15:12 UTC (rev 3301)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2010-03-31 23:56:24 UTC (rev 3302)
@@ -627,6 +627,7 @@
display_impl.update();
}
+ pollDevices();
}
/**
@@ -666,8 +667,9 @@
throw new RuntimeException(e);
}
}
+ if ( swap_interval != 0 ) // Handle events again when vsync is enabled, to reduced input lag.
+ processMessages();
- pollDevices();
if ( parent_resized ) {
reshape();
parent_resized = false;
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2010-03-31 21:15:12 UTC (rev 3301)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2010-03-31 23:56:24 UTC (rev 3302)
@@ -542,6 +542,7 @@
if (getForegroundWindow() != hwnd && !hasParent)
return;
getGlobalClientRect(hwnd, rect);
+ /* -- This is wrong on multi-monitor setups
int local_offset_x = rect.left;
int local_offset_y = rect.top;
getGlobalClientRect(getDesktopWindow(), rect2);
@@ -551,6 +552,9 @@
nSetCursorPosition(center_x, center_y);
int local_x = center_x - local_offset_x;
int local_y = center_y - local_offset_y;
+ */
+ int local_x = (rect.right - rect.left) / 2;
+ int local_y = (rect.bottom - rect.top) / 2;
if (current_display != null)
current_display.setMousePosition(local_x, transformY(hwnd, local_y));
}
Modified: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2010-03-31 21:15:12 UTC (rev 3301)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2010-03-31 23:56:24 UTC (rev 3302)
@@ -121,8 +121,10 @@
PM_REMOVE // removal options
))
{
+ if (msg.message == WM_QUIT)
+ break;
+ TranslateMessage(&msg);
DispatchMessage(&msg);
- TranslateMessage(&msg);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
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 && StateTra...
[truncated message content] |