You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(134) |
Sep
(52) |
Oct
(13) |
Nov
(342) |
Dec
(163) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(44) |
Feb
(62) |
Mar
(158) |
Apr
(38) |
May
(70) |
Jun
(58) |
Jul
(104) |
Aug
(207) |
Sep
(83) |
Oct
(122) |
Nov
(23) |
Dec
(49) |
| 2004 |
Jan
(119) |
Feb
(132) |
Mar
(192) |
Apr
(140) |
May
(77) |
Jun
(74) |
Jul
(201) |
Aug
(63) |
Sep
(102) |
Oct
(70) |
Nov
(173) |
Dec
(78) |
| 2005 |
Jan
(174) |
Feb
(197) |
Mar
(105) |
Apr
(59) |
May
(77) |
Jun
(43) |
Jul
(21) |
Aug
(18) |
Sep
(47) |
Oct
(37) |
Nov
(74) |
Dec
(50) |
| 2006 |
Jan
(44) |
Feb
(19) |
Mar
(32) |
Apr
(24) |
May
(31) |
Jun
(55) |
Jul
(138) |
Aug
(28) |
Sep
(12) |
Oct
(41) |
Nov
(58) |
Dec
(24) |
| 2007 |
Jan
(28) |
Feb
(14) |
Mar
(10) |
Apr
(68) |
May
(30) |
Jun
(26) |
Jul
(18) |
Aug
(63) |
Sep
(19) |
Oct
(29) |
Nov
(20) |
Dec
(10) |
| 2008 |
Jan
(38) |
Feb
(7) |
Mar
(37) |
Apr
(120) |
May
(41) |
Jun
(36) |
Jul
(39) |
Aug
(24) |
Sep
(28) |
Oct
(30) |
Nov
(36) |
Dec
(75) |
| 2009 |
Jan
(46) |
Feb
(22) |
Mar
(50) |
Apr
(70) |
May
(134) |
Jun
(105) |
Jul
(75) |
Aug
(34) |
Sep
(38) |
Oct
(34) |
Nov
(19) |
Dec
(20) |
| 2010 |
Jan
(11) |
Feb
(20) |
Mar
(65) |
Apr
(83) |
May
(104) |
Jun
(73) |
Jul
(78) |
Aug
(57) |
Sep
(43) |
Oct
(35) |
Nov
(9) |
Dec
(4) |
| 2011 |
Jan
(21) |
Feb
(11) |
Mar
(18) |
Apr
(10) |
May
(18) |
Jun
(15) |
Jul
(48) |
Aug
(25) |
Sep
(17) |
Oct
(45) |
Nov
(15) |
Dec
(12) |
| 2012 |
Jan
(21) |
Feb
(9) |
Mar
(12) |
Apr
(9) |
May
(9) |
Jun
(5) |
Jul
(1) |
Aug
(10) |
Sep
(12) |
Oct
(1) |
Nov
(28) |
Dec
(5) |
| 2013 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2016 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
1
|
2
(5) |
3
(1) |
4
(1) |
5
|
|
6
|
7
(6) |
8
(2) |
9
(11) |
10
|
11
(1) |
12
|
|
13
(1) |
14
(2) |
15
(30) |
16
(46) |
17
(13) |
18
(2) |
19
|
|
20
(26) |
21
(12) |
22
(9) |
23
(22) |
24
(5) |
25
(2) |
26
|
|
27
|
28
|
|
|
|
|
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20041/src/java/org/lwjgl/opengl Modified Files: AWTGLCanvas.java Context.java ContextImplementation.java Display.java DisplayImplementation.java LinuxContextImplementation.java LinuxDisplay.java LinuxDisplayPeerInfo.java LinuxPbufferPeerInfo.java MacOSXDisplay.java MacOSXFrame.java MacOSXGLCanvas.java Pbuffer.java PeerInfo.java Win32ContextImplementation.java Win32Display.java Win32DisplayPeerInfo.java Added Files: MacOSXAWTGLCanvasPeerInfo.java MacOSXCanvasImplementation.java MacOSXCanvasPeerInfo.java MacOSXContextImplementation.java MacOSXDisplayPeerInfo.java MacOSXPbufferPeerInfo.java MacOSXPeerInfo.java Log Message: Mac OS X port of the refactoring. Linux and Win32 fixes. --- NEW FILE: MacOSXPbufferPeerInfo.java --- /* * Copyright (c) 2002-2004 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 java.nio.ByteBuffer; import java.nio.IntBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; /** * $Id: MacOSXPbufferPeerInfo.java,v 1.1 2005/02/23 11:11:07 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ final class MacOSXPbufferPeerInfo extends MacOSXPeerInfo { public MacOSXPbufferPeerInfo(int width, int height, PixelFormat pixel_format) throws LWJGLException { super(pixel_format, false, false, true, false); nCreate(getHandle(), width, height); } private static native void nCreate(ByteBuffer handle, int width, int height) throws LWJGLException; public void destroy() { nDestroy(getHandle()); } private static native void nDestroy(ByteBuffer handle); protected void doLockAndInitHandle() throws LWJGLException { // NO-OP } protected void doUnlock() throws LWJGLException { // NO-OP } } Index: Win32DisplayPeerInfo.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Win32DisplayPeerInfo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Win32DisplayPeerInfo.java 21 Feb 2005 14:46:43 -0000 1.1 +++ Win32DisplayPeerInfo.java 23 Feb 2005 11:11:07 -0000 1.2 @@ -45,11 +45,17 @@ */ final class Win32DisplayPeerInfo extends Win32PeerInfo { public Win32DisplayPeerInfo(PixelFormat pixel_format) throws LWJGLException { - createDummyDC(getHandle()); + GLContext.loadOpenGLLibrary(); try { - choosePixelFormat(0, 0, pixel_format, null, true, true, false, true); + createDummyDC(getHandle()); + try { + choosePixelFormat(0, 0, pixel_format, null, true, true, false, true); + } catch (LWJGLException e) { + nDestroy(getHandle()); + throw e; + } } catch (LWJGLException e) { - destroy(); + GLContext.unloadOpenGLLibrary(); throw e; } } @@ -60,10 +66,6 @@ } private static native void nInitDC(ByteBuffer peer_info_handle); - void destroy() { - nDestroy(getHandle()); - } - private static native void nDestroy(ByteBuffer peer_info_handle); protected void doLockAndInitHandle() throws LWJGLException { @@ -75,4 +77,10 @@ protected void doUnlock() throws LWJGLException { // NO-OP } + + public void destroy() { + super.destroy(); + nDestroy(getHandle()); + GLContext.unloadOpenGLLibrary(); + } } Index: ContextImplementation.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/ContextImplementation.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ContextImplementation.java 20 Feb 2005 11:24:17 -0000 1.1 +++ ContextImplementation.java 23 Feb 2005 11:11:06 -0000 1.2 @@ -61,6 +61,11 @@ public void releaseCurrentContext() throws LWJGLException; /** + * Update the context. Should be called whenever it's drawable is moved or resized + */ + public void update(ByteBuffer context_handle); + + /** * Query whether the context is current */ public void makeCurrent(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException; Index: AWTGLCanvas.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- AWTGLCanvas.java 22 Feb 2005 14:10:06 -0000 1.7 +++ AWTGLCanvas.java 23 Feb 2005 11:11:06 -0000 1.8 @@ -39,6 +39,13 @@ import org.lwjgl.LWJGLException; import org.lwjgl.Sys; +import java.awt.Point; +import java.awt.Dimension; +import java.awt.event.ComponentEvent; +import java.awt.event.HierarchyEvent; +import java.awt.event.ComponentListener; +import java.awt.event.HierarchyListener; + /** * $Id$ * <p> @@ -47,8 +54,9 @@ * @version $Revision$ * @author $Author$ */ -public class AWTGLCanvas extends Canvas implements Drawable { +public class AWTGLCanvas extends Canvas implements Drawable, ComponentListener, HierarchyListener { private final static AWTCanvasImplementation implementation; + private boolean update_context; static { Sys.initialize(); @@ -59,7 +67,7 @@ } else if (OS_NAME.startsWith("Windows")) { class_name = "org.lwjgl.opengl.Win32CanvasImplementation"; } else if (OS_NAME.startsWith("Mac")) { - class_name = "org.lwjgl.opengl.DefaultCanvasImplementation"; + class_name = "org.lwjgl.opengl.MacOSXCanvasImplementation"; } else throw new IllegalStateException("The platform " + OS_NAME + " is not supported"); try { @@ -75,14 +83,20 @@ } /** The requested pixel format */ - private final PeerInfo peer_info; + private final PixelFormat pixel_format; /** The drawable to share context with */ private final Drawable drawable; /** Context handle */ + private PeerInfo peer_info; private Context context; + + private synchronized void setUpdate() { + update_context = true; + } + /** * This method should only be called internally. */ @@ -126,8 +140,9 @@ */ public AWTGLCanvas(GraphicsDevice device, PixelFormat pixel_format, Drawable drawable) throws LWJGLException { super(implementation.findConfiguration(device, pixel_format)); - this.peer_info = implementation.createPeerInfo(this, pixel_format); + addHierarchyListener(this); this.drawable = drawable; + this.pixel_format = pixel_format; } /* (non-Javadoc) @@ -188,6 +203,8 @@ if (context != null) { context.forceDestroy(); context = null; + peer_info.destroy(); + peer_info = null; } } catch (LWJGLException e) { throw new RuntimeException(e); @@ -202,12 +219,19 @@ public final void paint(Graphics g) { try { + if (peer_info == null) + this.peer_info = implementation.createPeerInfo(this, pixel_format); peer_info.lockAndGetHandle(); try { - if (context == null) - context = new Context(peer_info, drawable != null ? drawable.getContext() : null); + if (context == null) { + this.context = new Context(peer_info, drawable != null ? drawable.getContext() : null); + } if (!context.isCurrent()) context.makeCurrent(); + if (update_context) { + context.update(); + update_context = false; + } paintGL(); } finally { peer_info.unlock(); @@ -223,4 +247,47 @@ public void update(Graphics g) { paint(g); } + + public void componentShown(ComponentEvent e) { + } + + public void componentHidden(ComponentEvent e) { + } + + public void componentResized(ComponentEvent e) { + setUpdate(); + } + + public void componentMoved(ComponentEvent e) { + setUpdate(); + } + + public void setLocation(int x, int y) { + super.setLocation(x, y); + setUpdate(); + } + + public void setLocation(Point p) { + super.setLocation(p); + setUpdate(); + } + + public void setSize(Dimension d) { + super.setSize(d); + setUpdate(); + } + + public void setSize(int width, int height) { + super.setSize(width, height); + setUpdate(); + } + + public void setBounds(int x, int y, int width, int height) { + super.setBounds(x, y, width, height); + setUpdate(); + } + + public void hierarchyChanged(HierarchyEvent e) { + setUpdate(); + } } Index: Display.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Display.java,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- Display.java 20 Feb 2005 11:24:17 -0000 1.44 +++ Display.java 23 Feb 2005 11:11:06 -0000 1.45 @@ -86,6 +86,7 @@ private static boolean vsync; /** A unique context object, so we can track different contexts between creates() and destroys() */ + private static PeerInfo peer_info; private static Context context; private static boolean window_created = false; @@ -252,6 +253,13 @@ } private static void destroyWindow() { + try { + if (context.isCurrent()) + Context.releaseCurrentContext(); + } catch (LWJGLException e) { + Sys.log("Exception occurred while trying to release context"); + } + if (!window_created) throw new InternalError("Window already created"); // Automatically destroy keyboard, mouse, and controller @@ -583,7 +591,7 @@ if (fullscreen) switchDisplayMode(); try { - PeerInfo peer_info = display_impl.createPeerInfo(pixel_format); + peer_info = display_impl.createPeerInfo(pixel_format); context = new Context(peer_info, shared_drawable != null ? shared_drawable.getContext() : null); try { createWindow(); @@ -659,11 +667,11 @@ private static void destroyContext() { try { context.forceDestroy(); + peer_info.destroy(); } catch (LWJGLException e) { throw new RuntimeException(e); } finally { context = null; - display_impl.destroyPeerInfo(); } } --- NEW FILE: MacOSXAWTGLCanvasPeerInfo.java --- /* * Copyright (c) 2002-2004 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 java.nio.ByteBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; /** * $Id: MacOSXAWTGLCanvasPeerInfo.java,v 1.1 2005/02/23 11:11:07 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ final class MacOSXAWTGLCanvasPeerInfo extends MacOSXCanvasPeerInfo { private final AWTGLCanvas canvas; public MacOSXAWTGLCanvasPeerInfo(AWTGLCanvas canvas, PixelFormat pixel_format) throws LWJGLException { super(pixel_format); this.canvas = canvas; } protected void doLockAndInitHandle() throws LWJGLException { initHandle(canvas); } } Index: Pbuffer.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Pbuffer.java,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- Pbuffer.java 20 Feb 2005 11:24:17 -0000 1.38 +++ Pbuffer.java 23 Feb 2005 11:11:07 -0000 1.39 @@ -247,7 +247,7 @@ return; try { context.forceDestroy(); - Display.getImplementation().destroyPbuffer(peer_info); + peer_info.destroy(); destroyed = true; } catch (LWJGLException e) { Sys.log("Exception occurred while destroying pbuffer: " + e); --- NEW FILE: MacOSXContextImplementation.java --- /* * Copyright (c) 2002-2004 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 java.nio.ByteBuffer; import org.lwjgl.LWJGLException; import org.lwjgl.BufferUtils; /** * $Id: MacOSXContextImplementation.java,v 1.1 2005/02/23 11:11:07 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ final class MacOSXContextImplementation implements ContextImplementation { private static PeerInfo getCurrentPeerInfo() { return Context.getCurrentContext().getPeerInfo(); } public ByteBuffer create(PeerInfo peer_info, ByteBuffer shared_context_handle) throws LWJGLException { ByteBuffer peer_handle = peer_info.lockAndGetHandle(); try { return nCreate(peer_handle, shared_context_handle); } finally { peer_info.unlock(); } } private static native ByteBuffer nCreate(ByteBuffer peer_handle, ByteBuffer shared_context_handle) throws LWJGLException; public void swapBuffers() throws LWJGLException { Context current_context = Context.getCurrentContext(); nSwapBuffers(current_context.getHandle()); } private static native void nSwapBuffers(ByteBuffer context_handle) throws LWJGLException; public void update(ByteBuffer context_handle) { System.out.println("context_handle = " + context_handle); nUpdate(context_handle); } private static native void nUpdate(ByteBuffer context_handle); public void releaseCurrentContext() throws LWJGLException { Context current_context = Context.getCurrentContext(); if (current_context != null) clearDrawable(current_context.getHandle()); nReleaseCurrentContext(); } private static native void nReleaseCurrentContext() throws LWJGLException; private static native void clearDrawable(ByteBuffer handle) throws LWJGLException; public void makeCurrent(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException { ByteBuffer peer_handle = peer_info.lockAndGetHandle(); try { setView(peer_handle, handle); nMakeCurrent(handle); } finally { peer_info.unlock(); } } private static native void setView(ByteBuffer peer_handle, ByteBuffer context_handle) throws LWJGLException; private static native void nMakeCurrent(ByteBuffer context_handle) throws LWJGLException; public boolean isCurrent(ByteBuffer handle) throws LWJGLException { boolean result = nIsCurrent(handle); return result; } private static native boolean nIsCurrent(ByteBuffer context_handle) throws LWJGLException; public void setVSync(boolean enabled) { nSetVSync(Context.getCurrentContext().getHandle(), enabled); } private static native void nSetVSync(ByteBuffer context_handle, boolean enabled); public void destroy(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException { nDestroy(handle); } private static native void nDestroy(ByteBuffer context_handle) throws LWJGLException; } Index: LinuxPbufferPeerInfo.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/LinuxPbufferPeerInfo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- LinuxPbufferPeerInfo.java 20 Feb 2005 11:36:15 -0000 1.1 +++ LinuxPbufferPeerInfo.java 23 Feb 2005 11:11:07 -0000 1.2 @@ -45,12 +45,33 @@ */ final class LinuxPbufferPeerInfo extends LinuxPeerInfo { public LinuxPbufferPeerInfo(int width, int height, PixelFormat pixel_format) throws LWJGLException { - nInitHandle(getHandle(), width, height, pixel_format); + LinuxDisplay.lockAWT(); + try { + LinuxDisplay.incDisplay(); + try { + GLContext.loadOpenGLLibrary(); + try { + nInitHandle(getHandle(), width, height, pixel_format); + } catch (LWJGLException e) { + GLContext.unloadOpenGLLibrary(); + throw e; + } + } catch (LWJGLException e) { + LinuxDisplay.decDisplay(); + throw e; + } + } finally { + LinuxDisplay.unlockAWT(); + } } private static native void nInitHandle(ByteBuffer handle, int width, int height, PixelFormat pixel_format) throws LWJGLException; public void destroy() { + LinuxDisplay.lockAWT(); nDestroy(getHandle()); + LinuxDisplay.decDisplay(); + GLContext.unloadOpenGLLibrary(); + LinuxDisplay.unlockAWT(); } private static native void nDestroy(ByteBuffer handle); Index: DisplayImplementation.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/DisplayImplementation.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- DisplayImplementation.java 20 Feb 2005 11:24:17 -0000 1.10 +++ DisplayImplementation.java 23 Feb 2005 11:11:07 -0000 1.11 @@ -108,7 +108,7 @@ */ PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLException; - void destroyPeerInfo(); +// void destroyPeerInfo(); /** * Updates the windows internal state. This must be called at least once per video frame @@ -221,11 +221,6 @@ IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs) throws LWJGLException; - /** - * Destroy pbuffer - */ - public void destroyPbuffer(PeerInfo handle); - public void setPbufferAttrib(PeerInfo handle, int attrib, int value); public void bindTexImageToPbuffer(PeerInfo handle, int buffer); Index: PeerInfo.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/PeerInfo.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- PeerInfo.java 22 Feb 2005 13:35:08 -0000 1.2 +++ PeerInfo.java 23 Feb 2005 11:11:07 -0000 1.3 @@ -85,4 +85,7 @@ protected final ByteBuffer getHandle() { return handle; } + + public void destroy() { + } } Index: Win32Display.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Win32Display.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- Win32Display.java 21 Feb 2005 14:46:42 -0000 1.12 +++ Win32Display.java 23 Feb 2005 11:11:07 -0000 1.13 @@ -73,21 +73,11 @@ // public native void swapBuffers(); // public native void makeCurrent() throws LWJGLException; public PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLException { - GLContext.loadOpenGLLibrary(); - try { - peer_info = new Win32DisplayPeerInfo(pixel_format); - return peer_info; - } catch (LWJGLException e) { - GLContext.unloadOpenGLLibrary(); - throw e; - } + peer_info = new Win32DisplayPeerInfo(pixel_format); + return peer_info; } // public native void createContext(PixelFormat pixel_format) throws LWJGLException; // public native void destroyContext(); - public void destroyPeerInfo() { - peer_info.destroy(); - GLContext.unloadOpenGLLibrary(); - } public void update() { nUpdate(); if (didMaximize()) { @@ -167,9 +157,6 @@ IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs, ByteBuffer shared_pbuffer_handle) throws LWJGLException; */ - public void destroyPbuffer(PeerInfo handle) { - ((Win32PbufferPeerInfo)handle).destroy(); - } // public native void destroyPbuffer(ByteBuffer handle); public void setPbufferAttrib(PeerInfo handle, int attrib, int value) { Index: MacOSXFrame.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/MacOSXFrame.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- MacOSXFrame.java 22 Jan 2005 00:34:49 -0000 1.10 +++ MacOSXFrame.java 23 Feb 2005 11:11:07 -0000 1.11 @@ -57,10 +57,10 @@ /* States */ private Rectangle bounds; - private boolean should_update; private boolean active; private boolean visible; private boolean minimized; + private boolean should_warp_cursor; MacOSXFrame(DisplayMode mode, java.awt.DisplayMode requested_mode, boolean fullscreen, int x, int y) throws LWJGLException { setResizable(false); @@ -160,8 +160,8 @@ public void windowActivated(WindowEvent e) { synchronized ( this ) { - should_update = true; active = true; + should_warp_cursor = true; } } @@ -190,11 +190,11 @@ return canvas; } - public boolean syncShouldUpdateContext() { + public boolean syncShouldWarpCursor() { boolean result; synchronized ( this ) { - result = canvas.syncShouldUpdateContext() || should_update; - should_update = false; + result = should_warp_cursor; + should_warp_cursor = false; } return result; } Index: MacOSXDisplay.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- MacOSXDisplay.java 20 Feb 2005 11:24:17 -0000 1.22 +++ MacOSXDisplay.java 23 Feb 2005 11:11:07 -0000 1.23 @@ -95,7 +95,7 @@ if (frame != null) { if (MacOSXFrame.getDevice().getFullScreenWindow() == frame) MacOSXFrame.getDevice().setFullScreenWindow(null); - setView(null); +// setView(null); if (frame.isDisplayable()) frame.dispose(); frame = null; @@ -193,29 +193,35 @@ return frame.syncIsActive(); } + public MacOSXFrame getFrame() { + return frame; + } + public boolean isDirty() { return frame.getCanvas().syncIsDirty(); } - public native void setView(MacOSXGLCanvas canvas); +// public native void setView(MacOSXGLCanvas canvas); // public native void swapBuffers(); // public native void makeCurrent() throws LWJGLException; public PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLException { - throw new RuntimeException("Not supported yet"); + return new MacOSXDisplayPeerInfo(pixel_format); } // public native void createContext(PixelFormat pixel_format) throws LWJGLException; - public native void destroyPeerInfo(); +// public native void destroyPeerInfo(); // public native void destroyContext(); public void update() { - if (frame.syncShouldUpdateContext()) { - updateContext(); + if (frame.getCanvas().syncShouldUpdateContext()) { + Display.getContext().update(); /* This is necessary to make sure the context won't "forget" about the view size */ GL11.glViewport(0, 0, frame.getCanvas().syncGetWidth(), frame.getCanvas().syncGetHeight()); + } + if (frame.syncShouldWarpCursor()) { warpCursor(); } } @@ -240,7 +246,7 @@ private native void updateContext(); - public native void setVSyncEnabled(boolean sync); +// public native void setVSyncEnabled(boolean sync); public void reshape(int x, int y, int width, int height) { frame.resize(x, y, width, height); @@ -422,7 +428,7 @@ public PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs) throws LWJGLException { - throw new RuntimeException("Not yet supported"); + return new MacOSXPbufferPeerInfo(width, height, pixel_format); } /* public ByteBuffer createPbuffer(int width, int height, PixelFormat pixel_format, @@ -438,7 +444,6 @@ IntBuffer pBufferAttribs, ByteBuffer shared_pbuffer_handle) throws LWJGLException; */ // public native void destroyPbuffer(ByteBuffer handle); - public native void destroyPbuffer(PeerInfo handle); public void setPbufferAttrib(PeerInfo handle, int attrib, int value) { throw new UnsupportedOperationException(); --- NEW FILE: MacOSXDisplayPeerInfo.java --- /* * Copyright (c) 2002-2004 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 java.nio.ByteBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; import java.awt.Canvas; /** * $Id: MacOSXDisplayPeerInfo.java,v 1.1 2005/02/23 11:11:07 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ final class MacOSXDisplayPeerInfo extends MacOSXCanvasPeerInfo { private boolean locked = false; public MacOSXDisplayPeerInfo(PixelFormat pixel_format) throws LWJGLException { super(pixel_format); } protected void doLockAndInitHandle() throws LWJGLException { if (locked) throw new RuntimeException("Already locked"); MacOSXFrame frame = ((MacOSXDisplay)Display.getImplementation()).getFrame(); if (frame != null) { Canvas gl_canvas = frame.getCanvas(); initHandle(gl_canvas); locked = true; } } protected void doUnlock() throws LWJGLException { if (locked) { super.doUnlock(); locked = false; } } } --- NEW FILE: MacOSXCanvasImplementation.java --- /* * Copyright (c) 2002-2004 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 java.nio.ByteBuffer; import org.lwjgl.LWJGLException; import org.lwjgl.BufferUtils; import java.awt.GraphicsDevice; import java.awt.GraphicsConfiguration; import java.awt.Rectangle; import java.lang.reflect.Method; /** * $Id: MacOSXCanvasImplementation.java,v 1.1 2005/02/23 11:11:07 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ final class MacOSXCanvasImplementation implements AWTCanvasImplementation { public PeerInfo createPeerInfo(AWTGLCanvas canvas, PixelFormat pixel_format) throws LWJGLException { return new MacOSXAWTGLCanvasPeerInfo(canvas, pixel_format); } /** * Find a proper GraphicsConfiguration from the given GraphicsDevice and PixelFormat. * * @return The GraphicsConfiguration corresponding to a visual that matches the pixel format. */ public GraphicsConfiguration findConfiguration(GraphicsDevice device, PixelFormat pixel_format) throws LWJGLException { /* * It seems like the best way is to simply return null */ return null; } } Index: Context.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Context.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Context.java 20 Feb 2005 11:24:17 -0000 1.1 +++ Context.java 23 Feb 2005 11:11:06 -0000 1.2 @@ -140,6 +140,15 @@ } /** + * Update the context. Should be called whenever it's drawable is moved or resized + */ + public synchronized void update() { + if (destroyed) + throw new IllegalStateException("Context is destroyed"); + implementation.update(getHandle()); + } + + /** * Swap the buffers on the current context. Only valid for double-buffered contexts */ public static void swapBuffers() throws LWJGLException { @@ -168,6 +177,10 @@ GLContext.useContext(this); } + ByteBuffer getHandle() { + return handle; + } + /** * Query whether the context is current */ Index: LinuxContextImplementation.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/LinuxContextImplementation.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- LinuxContextImplementation.java 22 Feb 2005 13:59:32 -0000 1.2 +++ LinuxContextImplementation.java 23 Feb 2005 11:11:07 -0000 1.3 @@ -99,6 +99,9 @@ } private static native void nReleaseCurrentContext(ByteBuffer peer_info_handle) throws LWJGLException; + public void update(ByteBuffer context_handle) { + } + public void makeCurrent(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException { LinuxDisplay.lockAWT(); try { Index: LinuxDisplay.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- LinuxDisplay.java 21 Feb 2005 15:56:50 -0000 1.17 +++ LinuxDisplay.java 23 Feb 2005 11:11:07 -0000 1.18 @@ -185,35 +185,10 @@ private static native boolean nIsDirty(); public PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLException { - lockAWT(); - try { - incDisplay(); - try { - GLContext.loadOpenGLLibrary(); - try { - peer_info = new LinuxDisplayPeerInfo(pixel_format); - return peer_info; - } catch (LWJGLException e) { - GLContext.unloadOpenGLLibrary(); - throw e; - } - } catch (LWJGLException e) { - decDisplay(); - throw e; - } - } finally { - unlockAWT(); - } + peer_info = new LinuxDisplayPeerInfo(pixel_format); + return peer_info; } - public void destroyPeerInfo() { - lockAWT(); - peer_info = null; - GLContext.unloadOpenGLLibrary(); - decDisplay(); - unlockAWT(); - } - public void update() { lockAWT(); nUpdate(); @@ -432,33 +407,7 @@ public PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs) throws LWJGLException { - lockAWT(); - try { - incDisplay(); - try { - GLContext.loadOpenGLLibrary(); - try { - PeerInfo peer_info = new LinuxPbufferPeerInfo(width, height, pixel_format); - return peer_info; - } catch (LWJGLException e) { - GLContext.unloadOpenGLLibrary(); - throw e; - } - } catch (LWJGLException e) { - decDisplay(); - throw e; - } - } finally { - unlockAWT(); - } - } - - public void destroyPbuffer(PeerInfo handle) { - lockAWT(); - ((LinuxPbufferPeerInfo)handle).destroy(); - decDisplay(); - GLContext.unloadOpenGLLibrary(); - unlockAWT(); + return new LinuxPbufferPeerInfo(width, height, pixel_format); } public void setPbufferAttrib(PeerInfo handle, int attrib, int value) { Index: Win32ContextImplementation.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Win32ContextImplementation.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Win32ContextImplementation.java 21 Feb 2005 14:46:43 -0000 1.1 +++ Win32ContextImplementation.java 23 Feb 2005 11:11:07 -0000 1.2 @@ -70,6 +70,9 @@ } private static native void nSwapBuffers(ByteBuffer peer_info_handle) throws LWJGLException; + public void update(ByteBuffer context_handle) { + } + public void releaseCurrentContext() throws LWJGLException { nReleaseCurrentContext(); } --- NEW FILE: MacOSXCanvasPeerInfo.java --- /* * Copyright (c) 2002-2004 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 java.nio.ByteBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; import java.awt.Canvas; /** * $Id: MacOSXCanvasPeerInfo.java,v 1.1 2005/02/23 11:11:07 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ abstract class MacOSXCanvasPeerInfo extends MacOSXPeerInfo { private final AWTSurfaceLock awt_surface = new AWTSurfaceLock(); public MacOSXCanvasPeerInfo(PixelFormat pixel_format) throws LWJGLException { super(pixel_format, true, true, false, true); } protected void initHandle(Canvas canvas) throws LWJGLException { nInitHandle(awt_surface.lockAndGetHandle(canvas), getHandle()); } private static native void nInitHandle(ByteBuffer surface_buffer, ByteBuffer peer_info_handle) throws LWJGLException; protected void doUnlock() throws LWJGLException { awt_surface.unlock(); } } Index: LinuxDisplayPeerInfo.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplayPeerInfo.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- LinuxDisplayPeerInfo.java 21 Feb 2005 14:46:42 -0000 1.2 +++ LinuxDisplayPeerInfo.java 23 Feb 2005 11:11:07 -0000 1.3 @@ -47,7 +47,19 @@ public LinuxDisplayPeerInfo(PixelFormat pixel_format) throws LWJGLException { LinuxDisplay.lockAWT(); try { - initDefaultPeerInfo(getHandle(), pixel_format); + LinuxDisplay.incDisplay(); + try { + GLContext.loadOpenGLLibrary(); + try { + initDefaultPeerInfo(getHandle(), pixel_format); + } catch (LWJGLException e) { + GLContext.unloadOpenGLLibrary(); + throw e; + } + } catch (LWJGLException e) { + LinuxDisplay.decDisplay(); + throw e; + } } finally { LinuxDisplay.unlockAWT(); } @@ -67,4 +79,12 @@ protected void doUnlock() throws LWJGLException { // NO-OP } + + public void destroy() { + super.destroy(); + LinuxDisplay.lockAWT(); + GLContext.unloadOpenGLLibrary(); + LinuxDisplay.decDisplay(); + LinuxDisplay.unlockAWT(); + } } Index: MacOSXGLCanvas.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/MacOSXGLCanvas.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- MacOSXGLCanvas.java 21 Jan 2005 22:07:20 -0000 1.6 +++ MacOSXGLCanvas.java 23 Feb 2005 11:11:07 -0000 1.7 @@ -42,8 +42,10 @@ import java.awt.Point; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; +import java.awt.event.HierarchyEvent; +import java.awt.event.HierarchyListener; -final class MacOSXGLCanvas extends Canvas implements ComponentListener { +final class MacOSXGLCanvas extends Canvas implements ComponentListener, HierarchyListener { private int width; private int height; @@ -68,7 +70,8 @@ /* Input methods are not enabled in fullscreen anyway, so disable always */ enableInputMethods(false); addComponentListener(this); - ((MacOSXDisplay)Display.getImplementation()).setView(this); + addHierarchyListener(this); +// ((MacOSXDisplay)Display.getImplementation()).setView(this); setUpdate(); } @@ -148,4 +151,8 @@ super.setBounds(x, y, width, height); setUpdate(); } + + public void hierarchyChanged(HierarchyEvent e) { + setUpdate(); + } } --- NEW FILE: MacOSXPeerInfo.java --- /* * Copyright (c) 2002-2004 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 java.nio.ByteBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; import java.nio.IntBuffer; /** * $Id: MacOSXPeerInfo.java,v 1.1 2005/02/23 11:11:07 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ abstract class MacOSXPeerInfo extends PeerInfo { public MacOSXPeerInfo(PixelFormat pixel_format, boolean use_display_bpp, boolean support_window, boolean support_pbuffer, boolean double_buffered) throws LWJGLException { super(createHandle()); choosePixelFormat(pixel_format, use_display_bpp, support_window, support_pbuffer, double_buffered); } private static native ByteBuffer createHandle(); private void choosePixelFormat(PixelFormat pixel_format, boolean use_display_bpp, boolean support_window, boolean support_pbuffer, boolean double_buffered) throws LWJGLException { nChoosePixelFormat(getHandle(), pixel_format, use_display_bpp, support_window, support_pbuffer, double_buffered); } private static native void nChoosePixelFormat(ByteBuffer peer_info_handle, PixelFormat pixel_format, boolean use_display_bpp, boolean support_window, boolean support_pbuffer, boolean double_buffered) throws LWJGLException; public void destroy() { nDestroy(getHandle()); } private static native void nDestroy(ByteBuffer handle); } |
|
From: Elias N. <eli...@us...> - 2005-02-23 11:11:17
|
Update of /cvsroot/java-game-lib/LWJGL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20041 Modified Files: build.xml Log Message: Mac OS X port of the refactoring. Linux and Win32 fixes. Index: build.xml =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/build.xml,v retrieving revision 1.68 retrieving revision 1.69 diff -u -d -r1.68 -r1.69 --- build.xml 22 Feb 2005 13:59:31 -0000 1.68 +++ build.xml 23 Feb 2005 11:11:05 -0000 1.69 @@ -576,7 +576,11 @@ <class name="org.lwjgl.opengl.Win32ContextImplementation" /> </javah> <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/macosx" force="yes"> + <class name="org.lwjgl.opengl.MacOSXCanvasPeerInfo" /> + <class name="org.lwjgl.opengl.MacOSXPeerInfo" /> + <class name="org.lwjgl.opengl.MacOSXPbufferPeerInfo" /> <class name="org.lwjgl.opengl.MacOSXDisplay" /> + <class name="org.lwjgl.opengl.MacOSXContextImplementation" /> </javah> <!-- lwjgl --> <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.headers}" force="yes"> |
|
From: Elias N. <eli...@us...> - 2005-02-23 11:11:17
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20041/src/native/win32 Modified Files: org_lwjgl_opengl_Win32AWTGLCanvasPeerInfo.c Log Message: Mac OS X port of the refactoring. Linux and Win32 fixes. Index: org_lwjgl_opengl_Win32AWTGLCanvasPeerInfo.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_Win32AWTGLCanvasPeerInfo.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- org_lwjgl_opengl_Win32AWTGLCanvasPeerInfo.c 21 Feb 2005 14:46:47 -0000 1.1 +++ org_lwjgl_opengl_Win32AWTGLCanvasPeerInfo.c 23 Feb 2005 11:11:08 -0000 1.2 @@ -47,7 +47,6 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32AWTGLCanvasPeerInfo_nInitHandle (JNIEnv *env, jclass clazz, jobject lock_buffer_handle, jobject peer_info_handle) { - const AWTSurfaceLock *awt_lock = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle); Win32PeerInfo *peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); AWTSurfaceLock *surface = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle); JAWT_Win32DrawingSurfaceInfo *win32_dsi = (JAWT_Win32DrawingSurfaceInfo *)surface->dsi->platformInfo; |
|
From: Elias N. <eli...@us...> - 2005-02-23 11:11:17
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/macosx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20041/src/native/macosx Modified Files: org_lwjgl_opengl_Display.m Added Files: context.h context.m org_lwjgl_opengl_MacOSXCanvasPeerInfo.m org_lwjgl_opengl_MacOSXPbufferPeerInfo.m org_lwjgl_opengl_MacOSXPeerInfo.m Removed Files: display.h org_lwjgl_opengl_Pbuffer.m Log Message: Mac OS X port of the refactoring. Linux and Win32 fixes. --- display.h DELETED --- Index: org_lwjgl_opengl_Display.m =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_opengl_Display.m,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- org_lwjgl_opengl_Display.m 27 Jan 2005 21:26:45 -0000 1.7 +++ org_lwjgl_opengl_Display.m 23 Feb 2005 11:11:07 -0000 1.8 @@ -33,7 +33,7 @@ /** * $Id$ * - * Mac OS Xspecific display functions. + * Mac OS X specific display functions. * * @author elias_naur <eli...@us...> * @version $Revision$ @@ -44,12 +44,12 @@ #import <jawt_md.h> #import <jni.h> #import <unistd.h> -#import "display.h" +//#import "display.h" #import "common_tools.h" #define WAIT_DELAY 100 -static NSOpenGLContext *gl_context; +/*static NSOpenGLContext *gl_context; NSOpenGLContext *createContext(JNIEnv *env, jobject pixel_format, bool double_buffered, bool use_display_bpp, long drawable_type, NSOpenGLContext *share_context) { int bpp; @@ -173,7 +173,7 @@ ds->Unlock(ds); awt.FreeDrawingSurface(ds); } - +*/ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_restoreGamma(JNIEnv *env, jobject this) { CGDisplayRestoreColorSyncSettings(); } @@ -194,7 +194,7 @@ SetSystemUIMode(kUIModeNormal, 0); } } - +/* JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_setVSyncEnabled(JNIEnv *env, jobject this, jboolean vsync) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; long vsync_value = vsync == JNI_TRUE ? 1 : 0; @@ -233,3 +233,4 @@ } [pool release]; } +*/ --- NEW FILE: context.m --- /* * Copyright (c) 2002-2004 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. */ /** * $Id: context.m,v 1.1 2005/02/23 11:11:07 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ #import "context.h" #import <Cocoa/Cocoa.h> #import <Carbon/Carbon.h> NSOpenGLPixelFormat *choosePixelFormat(JNIEnv *env, jobject pixel_format, bool use_display_bpp, bool support_window, bool support_pbuffer, bool double_buffered) { int bpp; jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); if (use_display_bpp) bpp = CGDisplayBitsPerPixel(kCGDirectMainDisplay); else bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I")); int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); bool stereo = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); attrib_list_t attribs; jboolean allow_software_acceleration = getBooleanProperty(env, "org.lwjgl.opengl.Display.allowSoftwareOpenGL"); initAttribList(&attribs); if (!allow_software_acceleration) putAttrib(&attribs, NSOpenGLPFAAccelerated); if (double_buffered) putAttrib(&attribs, NSOpenGLPFADoubleBuffer); putAttrib(&attribs, NSOpenGLPFAColorSize); putAttrib(&attribs, bpp); putAttrib(&attribs, NSOpenGLPFAAlphaSize); putAttrib(&attribs, alpha); putAttrib(&attribs, NSOpenGLPFADepthSize); putAttrib(&attribs, depth); putAttrib(&attribs, NSOpenGLPFAStencilSize); putAttrib(&attribs, stencil); putAttrib(&attribs, NSOpenGLPFAAccumSize); putAttrib(&attribs, accum_bpp + accum_alpha); putAttrib(&attribs, NSOpenGLPFASampleBuffers); putAttrib(&attribs, samples > 0 ? 1 : 0); putAttrib(&attribs, NSOpenGLPFASamples); putAttrib(&attribs, samples); putAttrib(&attribs, NSOpenGLPFAAuxBuffers); putAttrib(&attribs, num_aux_buffers); if (support_window) putAttrib(&attribs, NSOpenGLPFAWindow); if (support_pbuffer) putAttrib(&attribs, NSOpenGLPFAPixelBuffer); if (stereo) putAttrib(&attribs, NSOpenGLPFAStereo); putAttrib(&attribs, 0); NSOpenGLPixelFormat* fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:(NSOpenGLPixelFormatAttribute *)attribs.attribs]; if (fmt == nil) { throwException(env, "Could not create pixel format"); return NULL; } return fmt; } --- NEW FILE: org_lwjgl_opengl_MacOSXCanvasPeerInfo.m --- /* * Copyright (c) 2002-2004 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. */ /** * $Id: org_lwjgl_opengl_MacOSXCanvasPeerInfo.m,v 1.1 2005/02/23 11:11:07 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ #include <jni.h> #include <jawt.h> #include <jawt_md.h> #include "awt_tools.h" #include "org_lwjgl_opengl_MacOSXCanvasPeerInfo.h" #include "context.h" #include "common_tools.h" JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXCanvasPeerInfo_nInitHandle (JNIEnv *env, jclass clazz, jobject lock_buffer_handle, jobject peer_info_handle) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); AWTSurfaceLock *surface = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle); JAWT_MacOSXDrawingSurfaceInfo *macosx_dsi = (JAWT_MacOSXDrawingSurfaceInfo *)surface->dsi->platformInfo; peer_info->nsview = macosx_dsi->cocoaViewRef; peer_info->window = true; [pool release]; } --- NEW FILE: context.h --- /* * Copyright (c) 2002-2004 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. */ /** * $Id: context.h,v 1.1 2005/02/23 11:11:07 elias_naur Exp $ * * Base Win32 display * * @author cix_foo <ci...@us...> * @version $Revision: 1.1 $ */ #ifndef __LWJGL_CONTEXT_H #define __LWJGL_CONTEXT_H #include <Cocoa/Cocoa.h> #include <OpenGL/gl.h> #include <OpenGL/glext.h> #include "common_tools.h" typedef struct { NSOpenGLPixelFormat *pixel_format; bool window; union { NSView *nsview; NSOpenGLPixelBuffer *pbuffer; }; } MacOSXPeerInfo; NSOpenGLPixelFormat *choosePixelFormat(JNIEnv *env, jobject pixel_format, bool use_display_bpp, bool support_window, bool support_pbuffer, bool double_buffered); #endif --- NEW FILE: org_lwjgl_opengl_MacOSXPeerInfo.m --- /* * Copyright (c) 2002-2004 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. */ /** * $Id: org_lwjgl_opengl_MacOSXPeerInfo.m,v 1.1 2005/02/23 11:11:07 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ #import <jni.h> #import <Cocoa/Cocoa.h> #import "org_lwjgl_opengl_MacOSXPeerInfo.h" #import "context.h" #import "common_tools.h" JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_MacOSXPeerInfo_createHandle (JNIEnv *env, jclass clazz) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; jobject handle = newJavaManagedByteBuffer(env, sizeof(MacOSXPeerInfo)); [pool release]; return handle; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXPeerInfo_nChoosePixelFormat (JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject pixel_format, jboolean use_display_bpp, jboolean support_window, jboolean support_pbuffer, jboolean double_buffered) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); NSOpenGLPixelFormat *macosx_pixel_format = choosePixelFormat(env, pixel_format, use_display_bpp, support_window, support_pbuffer, double_buffered); if (pixel_format == nil) { throwException(env, "Could not find pixel format"); return; } peer_info->pixel_format = macosx_pixel_format; [pool release]; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXPeerInfo_nDestroy (JNIEnv *env, jclass clazz, jobject peer_info_handle) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); [peer_info->pixel_format release]; [pool release]; } --- NEW FILE: org_lwjgl_opengl_MacOSXPbufferPeerInfo.m --- /* * Copyright (c) 2002-2004 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. */ /** * $Id: org_lwjgl_opengl_MacOSXPbufferPeerInfo.m,v 1.1 2005/02/23 11:11:07 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ #import <jni.h> #import <Cocoa/Cocoa.h> #import "org_lwjgl_opengl_MacOSXPbufferPeerInfo.h" #import "context.h" #import "common_tools.h" JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXPbufferPeerInfo_nCreate(JNIEnv *env, jclass clazz, jobject peer_info_handle, jint width, jint height) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSOpenGLPixelBuffer *pbuffer = nil; // check if the texture is power of 2 if ( (( width > 0 ) && ( width & ( width-1)) == 0) || (( height > 0 ) && ( height & ( height-1)) == 0) ) { pbuffer = [[NSOpenGLPixelBuffer alloc] initWithTextureTarget:GL_TEXTURE_2D textureInternalFormat:GL_RGBA textureMaxMipMapLevel:0 pixelsWide:width pixelsHigh:height]; } else { pbuffer = [[NSOpenGLPixelBuffer alloc] initWithTextureTarget:GL_TEXTURE_RECTANGLE_EXT textureInternalFormat:GL_RGBA textureMaxMipMapLevel:0 pixelsWide:width pixelsHigh:height]; } MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); peer_info->pbuffer = pbuffer; peer_info->window = false; [pool release]; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXPbufferPeerInfo_nDestroy (JNIEnv *env, jclass clazz, jobject peer_info_handle) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); [peer_info->pbuffer release]; [pool release]; } --- org_lwjgl_opengl_Pbuffer.m DELETED --- |
|
From: Elias N. <eli...@us...> - 2005-02-22 14:10:27
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5836 Modified Files: AWTGLCanvas.java Log Message: Removed loading of jawt, since it does not exist on mac Index: AWTGLCanvas.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- AWTGLCanvas.java 22 Feb 2005 13:35:08 -0000 1.6 +++ AWTGLCanvas.java 22 Feb 2005 14:10:06 -0000 1.7 @@ -51,7 +51,6 @@ private final static AWTCanvasImplementation implementation; static { - System.loadLibrary("jawt"); Sys.initialize(); String class_name; String OS_NAME = System.getProperty("os.name"); |
|
From: Elias N. <eli...@us...> - 2005-02-22 14:08:06
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4990/common Modified Files: awt_tools.h Log Message: Removed redundant include from awt_tools.h Index: awt_tools.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/awt_tools.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- awt_tools.h 22 Feb 2005 13:14:04 -0000 1.3 +++ awt_tools.h 22 Feb 2005 14:07:50 -0000 1.4 @@ -42,7 +42,6 @@ #include <jni.h> #include <jawt.h> -#include <jawt_md.h> typedef struct { JAWT awt; |
|
From: Elias N. <eli...@us...> - 2005-02-22 13:59:43
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2336/src/native/linux Modified Files: org_lwjgl_opengl_LinuxContextImplementation.c Added Files: org_lwjgl_opengl_LinuxPeerInfo.c Log Message: Linux: moved handle allocations to native Index: org_lwjgl_opengl_LinuxContextImplementation.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxContextImplementation.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- org_lwjgl_opengl_LinuxContextImplementation.c 20 Feb 2005 11:24:22 -0000 1.1 +++ org_lwjgl_opengl_LinuxContextImplementation.c 22 Feb 2005 13:59:32 -0000 1.2 @@ -99,18 +99,19 @@ } } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nCreate - (JNIEnv *env , jclass clazz, jobject peer_handle, jobject context_handle, jobject shared_context_handle) { - if ((*env)->GetDirectBufferCapacity(env, context_handle) < sizeof(X11Context)) { - throwException(env, "Handle buffer not large enough"); - return; +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nCreate + (JNIEnv *env , jclass clazz, jobject peer_handle, jobject shared_context_handle) { + jobject context_handle = newJavaManagedByteBuffer(env, sizeof(X11Context)); + if (context_handle == NULL) { + throwException(env, "Could not allocate handle buffer"); + return NULL; } X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_handle); X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle); if (!extgl_InitGLX(env, peer_info->display, peer_info->screen)) { throwException(env, "Could not initialize GLX"); - return; + return NULL; } GLXContext shared_context = NULL; if (shared_context_handle != NULL) { @@ -122,6 +123,7 @@ } else { createContextGLX(env, peer_info, context_info, shared_context); } + return context_handle; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nDestroy --- NEW FILE: org_lwjgl_opengl_LinuxPeerInfo.c --- /* * Copyright (c) 2002-2004 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. */ /** * $Id: org_lwjgl_opengl_LinuxPeerInfo.c,v 1.1 2005/02/22 13:59:33 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ #include <jni.h> #include "org_lwjgl_opengl_LinuxPeerInfo.h" #include "context.h" #include "common_tools.h" JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxPeerInfo_createHandle (JNIEnv *env, jclass clazz) { return newJavaManagedByteBuffer(env, sizeof(X11PeerInfo)); } |
|
From: Elias N. <eli...@us...> - 2005-02-22 13:59:43
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2336/src/java/org/lwjgl/opengl Modified Files: LinuxContextImplementation.java LinuxPeerInfo.java Log Message: Linux: moved handle allocations to native Index: LinuxPeerInfo.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/LinuxPeerInfo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- LinuxPeerInfo.java 20 Feb 2005 11:24:17 -0000 1.1 +++ LinuxPeerInfo.java 22 Feb 2005 13:59:32 -0000 1.2 @@ -44,9 +44,8 @@ * @version $Revision$ */ abstract class LinuxPeerInfo extends PeerInfo { - private static final int PEER_HANDLE_SIZE = 64; - public LinuxPeerInfo() { - super(BufferUtils.createByteBuffer(PEER_HANDLE_SIZE)); + super(createHandle()); } + private static native ByteBuffer createHandle(); } Index: LinuxContextImplementation.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/LinuxContextImplementation.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- LinuxContextImplementation.java 20 Feb 2005 11:24:17 -0000 1.1 +++ LinuxContextImplementation.java 22 Feb 2005 13:59:32 -0000 1.2 @@ -43,20 +43,16 @@ * @version $Revision$ */ final class LinuxContextImplementation implements ContextImplementation { - private final static int HANDLE_SIZE = 64; - private static PeerInfo getCurrentPeerInfo() { return Context.getCurrentContext().getPeerInfo(); } public ByteBuffer create(PeerInfo peer_info, ByteBuffer shared_context_handle) throws LWJGLException { - ByteBuffer handle = BufferUtils.createByteBuffer(HANDLE_SIZE); LinuxDisplay.lockAWT(); try { ByteBuffer peer_handle = peer_info.lockAndGetHandle(); try { - nCreate(peer_handle, handle, shared_context_handle); - return handle; + return nCreate(peer_handle, shared_context_handle); } finally { peer_info.unlock(); } @@ -65,7 +61,7 @@ } } - private static native void nCreate(ByteBuffer peer_handle, ByteBuffer context_handle, ByteBuffer shared_context_handle) throws LWJGLException; + private static native ByteBuffer nCreate(ByteBuffer peer_handle, ByteBuffer shared_context_handle) throws LWJGLException; public void swapBuffers() throws LWJGLException { PeerInfo current_peer_info = getCurrentPeerInfo(); |
|
From: Elias N. <eli...@us...> - 2005-02-22 13:59:41
|
Update of /cvsroot/java-game-lib/LWJGL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2336 Modified Files: build.xml Log Message: Linux: moved handle allocations to native Index: build.xml =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/build.xml,v retrieving revision 1.67 retrieving revision 1.68 diff -u -d -r1.67 -r1.68 --- build.xml 21 Feb 2005 14:46:40 -0000 1.67 +++ build.xml 22 Feb 2005 13:59:31 -0000 1.68 @@ -559,6 +559,7 @@ <!-- platform specific classes --> <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/linux" force="yes"> <class name="org.lwjgl.opengl.LinuxDisplay" /> + <class name="org.lwjgl.opengl.LinuxPeerInfo" /> <class name="org.lwjgl.opengl.LinuxPbufferPeerInfo" /> <class name="org.lwjgl.opengl.LinuxDisplayPeerInfo" /> <class name="org.lwjgl.opengl.LinuxAWTGLCanvasPeerInfo" /> |
|
From: Elias N. <eli...@us...> - 2005-02-22 13:35:24
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/awt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27972/src/java/org/lwjgl/test/opengl/awt Modified Files: AWTTest.java Log Message: Fix AWTGLCanvas to create context and make it current in paint(). GL usage can then only happen from an overidden paintGL(). Index: AWTTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- AWTTest.java 20 Feb 2005 11:24:20 -0000 1.2 +++ AWTTest.java 22 Feb 2005 13:35:09 -0000 1.3 @@ -37,7 +37,7 @@ setSize(640, 320); setLayout(null); add(canvas0 = new AWTGLCanvas() { - public void paint(Graphics g) { + public void paintGL() { try { makeCurrent(); GL11.glViewport(0, 0, getWidth(), getHeight()); @@ -61,7 +61,7 @@ }); canvas0.setBounds(0, 0, 320, 320); add(canvas1 = new AWTGLCanvas() { - public void paint(Graphics g) { + public void paintGL() { try { makeCurrent(); GL11.glViewport(0, 0, getWidth(), getHeight()); |
|
From: Elias N. <eli...@us...> - 2005-02-22 13:35:23
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27972/src/java/org/lwjgl/opengl Modified Files: AWTGLCanvas.java PeerInfo.java Log Message: Fix AWTGLCanvas to create context and make it current in paint(). GL usage can then only happen from an overidden paintGL(). Index: AWTGLCanvas.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- AWTGLCanvas.java 21 Feb 2005 15:58:21 -0000 1.5 +++ AWTGLCanvas.java 22 Feb 2005 13:35:08 -0000 1.6 @@ -136,22 +136,13 @@ */ public void addNotify() { super.addNotify(); - try { - createContext(); - } catch (LWJGLException e) { - throw new RuntimeException(e); - } } /* (non-Javadoc) * @see java.awt.Component#removeNotify() */ public void removeNotify() { - try { - destroyContext(); - } catch (LWJGLException e) { - throw new RuntimeException(e); - } + destroyContext(); super.removeNotify(); } @@ -191,26 +182,40 @@ } /** - * Create the OpenGL context. This occurs when the component becomes displayable - * @throws LWJGLException - */ - private synchronized void createContext() throws LWJGLException { - if (context == null) - context = new Context(peer_info, drawable != null ? drawable.getContext() : null); - } - - /** * Destroy the OpenGL context. This happens when the component becomes undisplayable */ - private synchronized void destroyContext() throws LWJGLException { - context.forceDestroy(); - context = null; + private synchronized void destroyContext() { + try { + if (context != null) { + context.forceDestroy(); + context = null; + } + } catch (LWJGLException e) { + throw new RuntimeException(e); + } } /** - * Empty paint to avoid clearing + * Override this to do painting */ - public void paint(Graphics g) { + protected void paintGL() { + } + + public final void paint(Graphics g) { + try { + peer_info.lockAndGetHandle(); + try { + if (context == null) + context = new Context(peer_info, drawable != null ? drawable.getContext() : null); + if (!context.isCurrent()) + context.makeCurrent(); + paintGL(); + } finally { + peer_info.unlock(); + } + } catch (LWJGLException e) { + throw new RuntimeException(e); + } } /** Index: PeerInfo.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/PeerInfo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- PeerInfo.java 20 Feb 2005 11:24:17 -0000 1.1 +++ PeerInfo.java 22 Feb 2005 13:35:08 -0000 1.2 @@ -44,6 +44,8 @@ */ abstract class PeerInfo { private final ByteBuffer handle; + private Thread locking_thread; // Thread that has locked this PeerInfo + private int lock_count; protected PeerInfo(ByteBuffer handle) { this.handle = handle; @@ -54,14 +56,29 @@ } public synchronized final void unlock() throws LWJGLException { - doUnlock(); + if (lock_count <= 0) + throw new IllegalStateException("PeerInfo not locked!"); + if (Thread.currentThread() != locking_thread) + throw new IllegalStateException("PeerInfo already locked by " + locking_thread); + lock_count--; + if (lock_count == 0) { + doUnlock(); + locking_thread = null; + } } protected abstract void doLockAndInitHandle() throws LWJGLException; protected abstract void doUnlock() throws LWJGLException; public synchronized final ByteBuffer lockAndGetHandle() throws LWJGLException { - lockAndInitHandle(); + Thread this_thread = Thread.currentThread(); + if (locking_thread != null && locking_thread != this_thread) + throw new IllegalStateException("PeerInfo already locked by " + locking_thread); + if (lock_count == 0) { + locking_thread = this_thread; + doLockAndInitHandle(); + } + lock_count++; return getHandle(); } |
|
From: Elias N. <eli...@us...> - 2005-02-22 13:14:15
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22246/linux Modified Files: Makefile Log Message: Linux makefile fix Index: Makefile =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/Makefile,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- Makefile 15 Feb 2005 11:05:20 -0000 1.18 +++ Makefile 22 Feb 2005 13:14:05 -0000 1.19 @@ -4,7 +4,7 @@ LINKER=gcc STRIP=strip CFLAGS_LINK=-shared -Wall -LIBS=-L/usr/X11/lib -lX11 -lXext -lXxf86vm -lpthread -L/usr/lib/jvm/java-1.5.0-sun-1.5.0.01/jre/lib/i386/ -ljawt -Wl,-static,-lXcursor,-lXrender,-lXrandr,-call_shared +LIBS=-L/usr/X11/lib -lX11 -lXext -lXxf86vm -lpthread -L$(JAVA_HOME)/jre/lib/i386 -ljawt -Wl,-static,-lXcursor,-lXrender,-lXrandr,-call_shared CFLAGS_O=-fPIC -O2 -D_X11 -Wall -pthread -c -I../common -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux SRC=$(wildcard *.c) $(wildcard ../common/*.c) $(wildcard ../common/arb/*.c) $(wildcard ../common/ati/*.c) $(wildcard ../common/ext/*.c) $(wildcard ../common/nv/*.c) OBJECTS=$(subst .c,.o,$(SRC)) |
|
From: Elias N. <eli...@us...> - 2005-02-22 13:14:14
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22246/common Modified Files: awt_tools.h Log Message: Linux makefile fix Index: awt_tools.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/awt_tools.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- awt_tools.h 21 Feb 2005 14:46:43 -0000 1.2 +++ awt_tools.h 22 Feb 2005 13:14:04 -0000 1.3 @@ -50,4 +50,5 @@ JAWT_DrawingSurfaceInfo *dsi; } AWTSurfaceLock; -#endif \ No newline at end of file +#endif + |
|
From: Elias N. <eli...@us...> - 2005-02-21 15:59:04
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14467/src/java/org/lwjgl/opengl Modified Files: AWTGLCanvas.java Log Message: Index: AWTGLCanvas.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- AWTGLCanvas.java 21 Feb 2005 14:46:42 -0000 1.4 +++ AWTGLCanvas.java 21 Feb 2005 15:58:21 -0000 1.5 @@ -51,6 +51,7 @@ private final static AWTCanvasImplementation implementation; static { + System.loadLibrary("jawt"); Sys.initialize(); String class_name; String OS_NAME = System.getProperty("os.name"); |
|
From: Elias N. <eli...@us...> - 2005-02-21 15:58:44
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14467/src/java/org/lwjgl Modified Files: Sys.java Log Message: Index: Sys.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Sys.java,v retrieving revision 1.77 retrieving revision 1.78 diff -u -d -r1.77 -r1.78 --- Sys.java 21 Feb 2005 14:46:42 -0000 1.77 +++ Sys.java 21 Feb 2005 15:58:24 -0000 1.78 @@ -63,8 +63,6 @@ private final static SysImplementation implementation; static { - System.loadLibrary("awt"); - System.loadLibrary("jawt"); System.loadLibrary(LIBRARY_NAME); implementation = createImplementation(); String native_version = implementation.getNativeLibraryVersion(); |
|
From: Elias N. <eli...@us...> - 2005-02-21 15:57:53
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13863/src/native/linux Modified Files: org_lwjgl_input_Cursor.c Log Message: Linux: moved Cursor handle allocation to native side Index: org_lwjgl_input_Cursor.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Cursor.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- org_lwjgl_input_Cursor.c 20 Feb 2005 11:24:22 -0000 1.7 +++ org_lwjgl_input_Cursor.c 21 Feb 2005 15:56:53 -0000 1.8 @@ -77,12 +77,13 @@ return width_return > height_return ? height_return : width_return; } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateCursor - (JNIEnv *env, jclass clazz, jobject handle_buffer, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jint images_offset, jobject delay_buffer, jint delays_offset) +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateCursor + (JNIEnv *env, jclass clazz, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jint images_offset, jobject delay_buffer, jint delays_offset) { - if ((*env)->GetDirectBufferCapacity(env, handle_buffer) < sizeof(Cursor)) { - throwException(env, "Handle buffer not large enough"); - return; + jobject handle_buffer = newJavaManagedByteBuffer(env, sizeof(Cursor)); + if (handle_buffer == NULL) { + throwException(env, "Could not allocate handle buffer"); + return NULL; } const int *delays = NULL; if (delay_buffer != NULL) @@ -92,7 +93,7 @@ XcursorImages *cursor_images = XcursorImagesCreate(num_images); if (cursor_images == NULL) { throwException(env, "Could not allocate cursor."); - return; + return NULL; } cursor_images->nimage = num_images; int i; @@ -108,6 +109,7 @@ Cursor *cursor = (Cursor *)(*env)->GetDirectBufferAddress(env, handle_buffer); *cursor = XcursorImagesLoadCursor(getDisplay(), cursor_images); XcursorImagesDestroy(cursor_images); + return handle_buffer; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDestroyCursor |
|
From: Elias N. <eli...@us...> - 2005-02-21 15:57:33
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13863/src/java/org/lwjgl/opengl Modified Files: LinuxDisplay.java Log Message: Linux: moved Cursor handle allocation to native side Index: LinuxDisplay.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- LinuxDisplay.java 21 Feb 2005 14:46:42 -0000 1.16 +++ LinuxDisplay.java 21 Feb 2005 15:56:50 -0000 1.17 @@ -48,7 +48,6 @@ import org.lwjgl.input.Keyboard; final class LinuxDisplay implements DisplayImplementation { - private static final int CURSOR_HANDLE_SIZE = 8; // private static final int PBUFFER_HANDLE_SIZE = 24; private static final int NUM_BUTTONS = 3; @@ -359,16 +358,14 @@ return Keyboard.STATE_UNKNOWN; } - private static native void nCreateCursor(ByteBuffer handle, int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, int images_offset, IntBuffer delays, int delays_offset) throws LWJGLException; + private static native ByteBuffer nCreateCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, int images_offset, IntBuffer delays, int delays_offset) throws LWJGLException; public Object createCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException { lockAWT(); try { incDisplay(); try { - ByteBuffer handle = BufferUtils.createByteBuffer(CURSOR_HANDLE_SIZE); - nCreateCursor(handle, width, height, xHotspot, yHotspot, numImages, images, images.position(), delays, delays != null ? delays.position() : -1); - return handle; + return nCreateCursor(width, height, xHotspot, yHotspot, numImages, images, images.position(), delays, delays != null ? delays.position() : -1); } catch (LWJGLException e) { decDisplay(); throw e; |
|
From: Elias N. <eli...@us...> - 2005-02-21 15:35:33
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8303 Modified Files: context.c Log Message: Linux: fixed GLX 1.3 Index: context.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/context.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- context.c 20 Feb 2005 11:24:22 -0000 1.1 +++ context.c 21 Feb 2005 15:35:09 -0000 1.2 @@ -79,7 +79,7 @@ } GLXFBConfig *getFBConfigFromPeerInfo(JNIEnv *env, X11PeerInfo *peer_info) { - int attribs[] = {GLX_FBCONFIG_ID, peer_info->config.glx13_config.config_id}; + int attribs[] = {GLX_FBCONFIG_ID, peer_info->config.glx13_config.config_id, None, None}; int num_elements; GLXFBConfig *configs = glXChooseFBConfig(peer_info->display, peer_info->screen, attribs, &num_elements); if (configs == NULL) { |
|
From: Elias N. <eli...@us...> - 2005-02-21 15:00:57
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29772/src/native/win32 Modified Files: org_lwjgl_Sys.c Log Message: Index: org_lwjgl_Sys.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Sys.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- org_lwjgl_Sys.c 29 Jan 2005 10:17:56 -0000 1.8 +++ org_lwjgl_Sys.c 21 Feb 2005 15:00:46 -0000 1.9 @@ -40,7 +40,6 @@ */ #include "Window.h" -#include "org_lwjgl_Sys.h" #include "org_lwjgl_NativeSysImplementation.h" #include "common_tools.h" #include <malloc.h> |
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25733/src/native/win32 Modified Files: Window.h display.c extgl_wgl.c extgl_wgl.h org_lwjgl_input_Cursor.c org_lwjgl_opengl_Display.c org_lwjgl_opengl_Pbuffer.c Added Files: context.c context.h org_lwjgl_opengl_Win32AWTGLCanvasPeerInfo.c org_lwjgl_opengl_Win32ContextImplementation.c org_lwjgl_opengl_Win32DisplayPeerInfo.c org_lwjgl_opengl_Win32PeerInfo.c Removed Files: org_lwjgl_opengl_AWTGLCanvas.c Log Message: Win32 part of refactor and AWTGLCanvas Index: extgl_wgl.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/extgl_wgl.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- extgl_wgl.h 17 Feb 2005 12:39:33 -0000 1.2 +++ extgl_wgl.h 21 Feb 2005 14:46:47 -0000 1.3 @@ -37,6 +37,8 @@ #define _EXTGL_WGL_H #include <windows.h> +#include "extgl.h" +#include "common_tools.h" typedef struct { bool WGL_ARB_buffer_region; Index: display.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/display.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- display.c 16 Jan 2005 11:12:57 -0000 1.2 +++ display.c 21 Feb 2005 14:46:47 -0000 1.3 @@ -40,6 +40,10 @@ */ #include <windows.h> +// Multimon.h enables multi monitor emulation on win95 and winnt4 +// So we only need the extended, multi-monitor aware path +#define COMPILE_MULTIMON_STUBS +#include <Multimon.h> #include <jni.h> #include "display.h" #include "common_tools.h" @@ -49,22 +53,18 @@ #define GAMMA_SIZE (3*256) static jobjectArray GetAvailableDisplayModesEx(JNIEnv * env); -static jobjectArray GetAvailableDisplayModes(JNIEnv * env); static char * getDriver(); static bool modeSet = false; // Whether we've done a display mode change static WORD originalGamma[GAMMA_SIZE]; // Original gamma settings static WORD currentGamma[GAMMA_SIZE]; // Current gamma settings static DEVMODE devmode; // Now we'll remember this value for the future extern HWND display_hwnd; // Handle to the window -extern RECT clientSize; + + jobjectArray getAvailableDisplayModes(JNIEnv *env) { jobjectArray result = GetAvailableDisplayModesEx(env); - if (result == NULL) { - printfDebug("Extended display mode selection failed, using fallback\n"); - result = GetAvailableDisplayModes(env); - } return result; } @@ -72,12 +72,7 @@ * Choose displaymodes using extended codepath (multiple displaydevices) */ static jobjectArray GetAvailableDisplayModesEx(JNIEnv * env) { - typedef BOOL (WINAPI * EnumDisplayDevicesAPROC)(IN LPCSTR lpDevice, IN DWORD iDevNum, OUT PDISPLAY_DEVICEA lpDisplayDevice, IN DWORD dwFlags); - typedef BOOL (WINAPI * EnumDisplaySettingsExAPROC)(IN LPCSTR lpszDeviceName, IN DWORD iModeNum, OUT LPDEVMODEA lpDevMode, IN DWORD dwFlags); - EnumDisplayDevicesAPROC EnumDisplayDevicesA; - EnumDisplaySettingsExAPROC EnumDisplaySettingsExA; - HMODULE lib_handle = LoadLibrary("user32.dll"); int i = 0, j = 0, n = 0; DISPLAY_DEVICE DisplayDevice; @@ -90,17 +85,6 @@ jobjectArray ret; jmethodID displayModeConstructor; - if (lib_handle == NULL) { - printfDebug("Could not load user32.dll\n"); - return NULL; - } - EnumDisplayDevicesA = (EnumDisplayDevicesAPROC)GetProcAddress(lib_handle, "EnumDisplayDevicesA"); - if (EnumDisplayDevicesA == NULL) - return NULL; - EnumDisplaySettingsExA = (EnumDisplaySettingsExAPROC)GetProcAddress(lib_handle, "EnumDisplaySettingsExA"); - if (EnumDisplaySettingsExA == NULL) - return NULL; - ZeroMemory(&DevMode, sizeof(DEVMODE)); ZeroMemory(&DisplayDevice, sizeof(DISPLAY_DEVICE)); @@ -110,14 +94,14 @@ displayModeClass = (*env)->FindClass(env, "org/lwjgl/opengl/DisplayMode"); displayModeConstructor = (*env)->GetMethodID(env, displayModeClass, "<init>", "(IIII)V"); - while(EnumDisplayDevicesA(NULL, i++, &DisplayDevice, 0) != 0) { + while(EnumDisplayDevices(NULL, i++, &DisplayDevice, 0) != 0) { // continue if mirroring device if((DisplayDevice.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) != 0) { continue; } j = 0; - while(EnumDisplaySettingsExA((const char *) DisplayDevice.DeviceName, j++, &DevMode, 0) != 0) { + while(EnumDisplaySettings((const char *) DisplayDevice.DeviceName, j++, &DevMode) != 0) { // Filter out indexed modes if (DevMode.dmBitsPerPel > 8 && ChangeDisplaySettings(&DevMode, CDS_FULLSCREEN | CDS_TEST) == DISP_CHANGE_SUCCESSFUL) { jobject displayMode; @@ -141,55 +125,6 @@ (*env)->SetObjectArrayElement(env, ret, i, display_mode_objects[i]); } free(display_mode_objects); - FreeLibrary(lib_handle); - return ret; -} - -/** - * Choose displaymodes using standard codepath (single displaydevice) - */ -static jobjectArray GetAvailableDisplayModes(JNIEnv * env) { - int i = 0, j = 0, n = 0; - - DEVMODE DevMode; - - jclass displayModeClass; - - jobjectArray ret; - jmethodID displayModeConstructor; - jobject *display_mode_objects = NULL; - int list_size = 0; - - ZeroMemory(&DevMode, sizeof(DEVMODE)); - - DevMode.dmSize = sizeof(DEVMODE); - - displayModeClass = (*env)->FindClass(env, "org/lwjgl/opengl/DisplayMode"); - - displayModeConstructor = (*env)->GetMethodID(env, displayModeClass, "<init>", "(IIII)V"); - - while(EnumDisplaySettings(NULL, j++, &DevMode) != 0) { - // Filter out indexed modes - if (DevMode.dmBitsPerPel > 8 && ChangeDisplaySettings(&DevMode, CDS_FULLSCREEN | CDS_TEST) == DISP_CHANGE_SUCCESSFUL) { - jobject displayMode; - if (list_size <= n) { - list_size += 1; - display_mode_objects = (jobject *)realloc(display_mode_objects, sizeof(jobject)*list_size); - if (display_mode_objects == NULL) - return NULL; - } - displayMode = (*env)->NewObject(env, displayModeClass, displayModeConstructor, - DevMode.dmPelsWidth, DevMode.dmPelsHeight, - DevMode.dmBitsPerPel, DevMode.dmDisplayFrequency); - display_mode_objects[n++] = displayMode; - } - } - ret = (*env)->NewObjectArray(env, n, displayModeClass, NULL); - for (i = 0; i < n; i++) { - (*env)->SetObjectArrayElement(env, ret, i, display_mode_objects[i]); - } - free(display_mode_objects); - printfDebug("Found %d displaymodes\n", n); return ret; } --- NEW FILE: org_lwjgl_opengl_Win32AWTGLCanvasPeerInfo.c --- /* * Copyright (c) 2002-2004 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. */ /** * $Id: org_lwjgl_opengl_Win32AWTGLCanvasPeerInfo.c,v 1.1 2005/02/21 14:46:47 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ #include <jni.h> #include <jawt.h> #include <jawt_md.h> #include "awt_tools.h" #include "org_lwjgl_opengl_Win32AWTGLCanvasPeerInfo.h" #include "context.h" #include "common_tools.h" JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32AWTGLCanvasPeerInfo_nInitHandle (JNIEnv *env, jclass clazz, jobject lock_buffer_handle, jobject peer_info_handle) { const AWTSurfaceLock *awt_lock = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle); Win32PeerInfo *peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); AWTSurfaceLock *surface = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle); JAWT_Win32DrawingSurfaceInfo *win32_dsi = (JAWT_Win32DrawingSurfaceInfo *)surface->dsi->platformInfo; peer_info->format_hwnd = win32_dsi->hwnd; peer_info->format_hdc = win32_dsi->hdc; peer_info->drawable_hdc = win32_dsi->hdc; } Index: Window.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/Window.h,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- Window.h 29 Jan 2005 10:17:56 -0000 1.22 +++ Window.h 21 Feb 2005 14:46:47 -0000 1.23 @@ -61,12 +61,14 @@ #endif /* _PRIVATE_WINDOW_H_ */ WINDOW_H_API HWND getCurrentHWND(); + + WINDOW_H_API HDC getCurrentHDC(); - WINDOW_H_API HGLRC getCurrentContext(); +// WINDOW_H_API HGLRC getCurrentContext(); - WINDOW_H_API bool applyPixelFormat(HDC hdc, int iPixelFormat); +// WINDOW_H_API bool applyPixelFormat(HDC hdc, int iPixelFormat); - WINDOW_H_API void closeWindow(HWND *hwnd, HDC *hdc); +// WINDOW_H_API void closeWindow(HWND *hwnd, HDC *hdc); WINDOW_H_API void handleMouseMoved(int x, int y); @@ -79,21 +81,12 @@ /* * Find a suitable pixel format */ - WINDOW_H_API int findPixelFormat(JNIEnv *env, HDC hdc, jobject pixel_format); +// WINDOW_H_API int findPixelFormat(JNIEnv *env, HDC hdc, jobject pixel_format); /* * Find a suitable pixel format using the WGL_ARB_pixel_format extension */ - WINDOW_H_API int findPixelFormatARB(JNIEnv *env, HDC hdc, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer); - - /* - * 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 - */ - WINDOW_H_API HWND createWindow(int x, int y, int width, int height, bool fullscreen, bool undecorated); +// WINDOW_H_API int findPixelFormatARB(JNIEnv *env, HDC hdc, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer); /* Index: extgl_wgl.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/extgl_wgl.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- extgl_wgl.c 17 Feb 2005 12:39:33 -0000 1.2 +++ extgl_wgl.c 21 Feb 2005 14:46:47 -0000 1.3 @@ -35,9 +35,8 @@ #include <stdio.h> #include <string.h> -#include "extgl.h" #include "extgl_wgl.h" -#include "common_tools.h" +#include "extgl.h" WGLExtensions extension_flags; --- org_lwjgl_opengl_AWTGLCanvas.c DELETED --- --- NEW FILE: context.c --- /* * Copyright (c) 2002-2004 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. */ /** * $Id: context.c,v 1.1 2005/02/21 14:46:47 elias_naur Exp $ * * Base Win32 display * * @author cix_foo <ci...@us...> * @version $Revision: 1.1 $ */ #include <malloc.h> #include "common_tools.h" #include "extgl.h" #include "extgl_wgl.h" #include "context.h" extern HINSTANCE dll_handle; // Handle to the LWJGL dll #define _CONTEXT_PRIVATE_CLASS_NAME "__lwjgl_context_class_name" /* * Register the LWJGL window class. * Returns true for success, or false for failure */ bool registerWindow(WNDPROC win_proc, LPCTSTR class_name) { WNDCLASS windowClass; windowClass.style = CS_OWNDC; windowClass.lpfnWndProc = win_proc; windowClass.cbClsExtra = 0; windowClass.cbWndExtra = 0; windowClass.hInstance = dll_handle; windowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION); windowClass.hCursor = LoadCursor(NULL, IDC_ARROW); windowClass.hbrBackground = NULL; windowClass.lpszMenuName = NULL; windowClass.lpszClassName = class_name; if (RegisterClass(&windowClass) == 0) { printfDebug("Failed to register window class\n"); return false; } return true; } static LRESULT CALLBACK dummyWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { return DefWindowProc(hwnd, msg, wParam, lParam); } bool applyPixelFormat(HDC hdc, int iPixelFormat) { PIXELFORMATDESCRIPTOR desc; if (DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &desc) == 0) { return false; } // make that the pixel format of the device context if (SetPixelFormat(hdc, iPixelFormat, &desc) == FALSE) { return false; } return true; } /* * Close the window */ void closeWindow(HWND *hwnd, HDC *hdc) { // Release device context if (*hdc != NULL && *hwnd != NULL) { ReleaseDC(*hwnd, *hdc); *hdc = NULL; } // Close the window if (*hwnd != NULL) { ShowWindow(*hwnd, SW_HIDE); DestroyWindow(*hwnd); *hwnd = NULL; } } /* * 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) { RECT clientSize; int exstyle, windowflags; HWND new_hwnd; if (fullscreen) { exstyle = WS_EX_APPWINDOW | WS_EX_TOPMOST; windowflags = WS_POPUP; } else if (undecorated) { exstyle = WS_EX_APPWINDOW; windowflags = WS_POPUP; } else { exstyle = WS_EX_APPWINDOW; windowflags = WS_OVERLAPPED | WS_BORDER | WS_CAPTION | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_MINIMIZEBOX | WS_SYSMENU; } // 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; clientSize.top = 0; AdjustWindowRectEx( &clientSize, // client-rectangle structure windowflags, // window styles FALSE, // menu-present option exstyle // extended window style ); // Create the window now, using that class: new_hwnd = CreateWindowEx ( exstyle, window_class_name, "", windowflags, x, y, clientSize.right - clientSize.left, clientSize.bottom - clientSize.top, NULL, NULL, dll_handle, NULL); return new_hwnd; } static int findPixelFormatARBFromBPP(JNIEnv *env, HDC hdc, jobject pixel_format, jobject pixelFormatCaps, int bpp, bool window, bool pbuffer, bool double_buffer) { jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); jboolean stereo = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); int iPixelFormat; unsigned int num_formats_returned; attrib_list_t attrib_list; GLuint *pixelFormatCaps_ptr; jlong pixelFormatCapsSize; BOOL result; jlong i; initAttribList(&attrib_list); if (window) { putAttrib(&attrib_list, WGL_DRAW_TO_WINDOW_ARB); putAttrib(&attrib_list, TRUE); } if (pbuffer) { putAttrib(&attrib_list, WGL_DRAW_TO_PBUFFER_ARB); putAttrib(&attrib_list, TRUE); } if (!getBooleanProperty(env, "org.lwjgl.opengl.Display.allowSoftwareOpenGL")) putAttrib(&attrib_list, WGL_ACCELERATION_ARB); putAttrib(&attrib_list, WGL_FULL_ACCELERATION_ARB); putAttrib(&attrib_list, WGL_PIXEL_TYPE_ARB); putAttrib(&attrib_list, WGL_TYPE_RGBA_ARB); putAttrib(&attrib_list, WGL_DOUBLE_BUFFER_ARB); putAttrib(&attrib_list, double_buffer ? TRUE : FALSE); putAttrib(&attrib_list, WGL_SUPPORT_OPENGL_ARB); putAttrib(&attrib_list, TRUE); putAttrib(&attrib_list, WGL_COLOR_BITS_ARB); putAttrib(&attrib_list, bpp); putAttrib(&attrib_list, WGL_ALPHA_BITS_ARB); putAttrib(&attrib_list, alpha); putAttrib(&attrib_list, WGL_DEPTH_BITS_ARB); putAttrib(&attrib_list, depth); putAttrib(&attrib_list, WGL_STENCIL_BITS_ARB); putAttrib(&attrib_list, stencil); if (samples > 0 && extension_flags.WGL_ARB_multisample) { putAttrib(&attrib_list, WGL_SAMPLE_BUFFERS_ARB); putAttrib(&attrib_list, 1); putAttrib(&attrib_list, WGL_SAMPLES_ARB); putAttrib(&attrib_list, samples); } putAttrib(&attrib_list, WGL_ACCUM_BITS_ARB); putAttrib(&attrib_list, accum_bpp); putAttrib(&attrib_list, WGL_ACCUM_ALPHA_BITS_ARB); putAttrib(&attrib_list, accum_alpha); putAttrib(&attrib_list, WGL_STEREO_ARB); putAttrib(&attrib_list, stereo ? TRUE : FALSE); putAttrib(&attrib_list, WGL_AUX_BUFFERS_ARB); putAttrib(&attrib_list, num_aux_buffers); if ( pixelFormatCaps != NULL ) { if ( !extension_flags.WGL_ARB_render_texture ) { return -1; } pixelFormatCaps_ptr = (GLuint *)(*env)->GetDirectBufferAddress(env, pixelFormatCaps); pixelFormatCapsSize = (*env)->GetDirectBufferCapacity(env, pixelFormatCaps); for (i = 0; i < pixelFormatCapsSize; i++) putAttrib(&attrib_list, pixelFormatCaps_ptr[i]); } putAttrib(&attrib_list, 0); putAttrib(&attrib_list, 0); result = wglChoosePixelFormatARB(hdc, attrib_list.attribs, NULL, 1, &iPixelFormat, &num_formats_returned); if (result == FALSE || num_formats_returned < 1) { return -1; } return iPixelFormat; } static int findPixelFormatARB(JNIEnv *env, HDC hdc, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer) { int bpp; int iPixelFormat; jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); if (use_hdc_bpp) { bpp = GetDeviceCaps(hdc, BITSPIXEL); iPixelFormat = findPixelFormatARBFromBPP(env, hdc, pixel_format, pixelFormatCaps, bpp, window, pbuffer, double_buffer); if (iPixelFormat == -1) bpp = 16; else return iPixelFormat; } else bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I")); return findPixelFormatARBFromBPP(env, hdc, pixel_format, pixelFormatCaps, bpp, window, pbuffer, double_buffer); } /* * Find an appropriate pixel format */ static int findPixelFormatFromBPP(JNIEnv *env, HDC hdc, jobject pixel_format, int bpp, bool double_buffer) { jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); jboolean stereo = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); unsigned int flags = PFD_DRAW_TO_WINDOW | // support window PFD_SUPPORT_OPENGL | (double_buffer ? PFD_DOUBLEBUFFER : 0) | (stereo ? PFD_STEREO : 0); PIXELFORMATDESCRIPTOR desc; int iPixelFormat; PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd 1, // version number flags, // RGBA type PFD_TYPE_RGBA, (BYTE)bpp, 0, 0, 0, 0, 0, 0, // color bits ignored (BYTE)alpha, 0, // shift bit ignored accum_bpp + accum_alpha, // no accumulation buffer 0, 0, 0, 0, // accum bits ignored (BYTE)depth, (BYTE)stencil, num_aux_buffers, PFD_MAIN_PLANE, // main layer 0, // reserved 0, 0, 0 // layer masks ignored }; // get the best available match of pixel format for the device context iPixelFormat = ChoosePixelFormat(hdc, &pfd); if (iPixelFormat == 0) { printfDebugJava(env, "Failed to choose pixel format"); return -1; } if (DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &desc) == 0) { printfDebugJava(env, "Could not describe pixel format"); return -1; } if (desc.cColorBits < bpp) { printfDebugJava(env, "Insufficient color precision"); return -1; } if (desc.cAlphaBits < alpha) { printfDebugJava(env, "Insufficient alpha precision"); return -1; } if (desc.cStencilBits < stencil) { printfDebugJava(env, "Insufficient stencil precision"); return -1; } if (desc.cDepthBits < depth) { printfDebugJava(env, "Insufficient depth buffer precision"); return -1; } if ((desc.dwFlags & PFD_GENERIC_FORMAT) != 0 || (desc.dwFlags & PFD_GENERIC_ACCELERATED) != 0) { jboolean allowSoftwareOpenGL = getBooleanProperty(env, "org.lwjgl.opengl.Display.allowSoftwareOpenGL"); // secondary check for software override if(!allowSoftwareOpenGL) { printfDebugJava(env, "Pixel format not accelerated"); return -1; } } if ((desc.dwFlags & flags) != flags) { printfDebugJava(env, "Capabilities not supported"); return -1; } return iPixelFormat; } static int findPixelFormatDefault(JNIEnv *env, HDC hdc, jobject pixel_format, bool use_hdc_bpp, bool double_buffer) { int bpp; int iPixelFormat; jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); if (use_hdc_bpp) { bpp = GetDeviceCaps(hdc, BITSPIXEL); iPixelFormat = findPixelFormatFromBPP(env, hdc, pixel_format, bpp, double_buffer); if (iPixelFormat == -1) bpp = 16; else return iPixelFormat; } else bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I")); return findPixelFormatFromBPP(env, hdc, pixel_format, bpp, double_buffer); } int findPixelFormatOnDC(JNIEnv *env, HDC hdc, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer) { HGLRC dummy_hglrc; HDC saved_current_hdc; HGLRC saved_current_hglrc; int pixel_format_id; jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); bool use_arb_selection = samples > 0 || pbuffer || pixelFormatCaps != NULL; pixel_format_id = findPixelFormatDefault(env, hdc, pixel_format, use_hdc_bpp, double_buffer); if (use_arb_selection) { if (!applyPixelFormat(hdc, pixel_format_id)) { throwException(env, "Could not apply pixel format to window"); return -1; } dummy_hglrc = wglCreateContext(hdc); if (dummy_hglrc == NULL) { throwException(env, "Failed to create OpenGL rendering context"); return -1; } // Save the current HDC and HGLRC to avoid disruption saved_current_hdc = wglGetCurrentDC(); saved_current_hglrc = wglGetCurrentContext(); if (!wglMakeCurrent(hdc, dummy_hglrc)) { wglDeleteContext(dummy_hglrc); throwException(env, "Could not bind context to dummy window"); return -1; } extgl_InitWGL(env); if (!extension_flags.WGL_ARB_pixel_format) { throwException(env, "No support for WGL_ARB_pixel_format"); return -1; } pixel_format_id = findPixelFormatARB(env, hdc, pixel_format, pixelFormatCaps, use_hdc_bpp, window, pbuffer, double_buffer); wglMakeCurrent(saved_current_hdc, saved_current_hglrc); wglDeleteContext(dummy_hglrc); } if (pixel_format_id == -1) { throwException(env, "Could not find a valid pixel format"); } return pixel_format_id; } static bool registerDummyWindow() { static bool window_registered = false; if (!window_registered) { if (!registerWindow(dummyWindowProc, _CONTEXT_PRIVATE_CLASS_NAME)) { return false; } window_registered = true; } return true; } 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); } int findPixelFormat(JNIEnv *env, int origin_x, int origin_y, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer) { HWND dummy_hwnd; HDC dummy_hdc; int pixel_format_id; dummy_hwnd = createDummyWindow(origin_x, origin_y); if (dummy_hwnd == NULL) { throwException(env, "Failed to create the dummy window."); return -1; } dummy_hdc = GetDC(dummy_hwnd); pixel_format_id = findPixelFormatOnDC(env, dummy_hdc, pixel_format, pixelFormatCaps, use_hdc_bpp, window, pbuffer, double_buffer); closeWindow(&dummy_hwnd, &dummy_hdc); return pixel_format_id; } --- NEW FILE: org_lwjgl_opengl_Win32ContextImplementation.c --- /* * Copyright (c) 2002-2004 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. */ /** * $Id: org_lwjgl_opengl_Win32ContextImplementation.c,v 1.1 2005/02/21 14:46:47 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ #include <jni.h> #include "org_lwjgl_opengl_Win32ContextImplementation.h" #include "context.h" #include "common_tools.h" typedef struct { HGLRC context; } Win32Context; JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_Win32ContextImplementation_nCreate (JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject shared_context_handle) { Win32PeerInfo *peer_info; Win32Context *shared_context_info; Win32Context *context_info; HGLRC context; HGLRC shared_context = NULL; jobject context_handle = newJavaManagedByteBuffer(env, sizeof(Win32Context)); if (context_handle == NULL) { throwException(env, "Could not create handle buffer"); return NULL; } peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); context = wglCreateContext(peer_info->format_hdc); if (context == NULL) { throwException(env, "Could not create context"); return NULL; } if (shared_context_handle != NULL) { shared_context_info = (Win32Context *)(*env)->GetDirectBufferAddress(env, shared_context_handle); shared_context = shared_context_info->context; if (!wglShareLists(shared_context, context)) { wglDeleteContext(context); throwException(env, "Could not share contexts"); return NULL; } } context_info = (Win32Context *)(*env)->GetDirectBufferAddress(env, context_handle); context_info->context = context; return context_handle; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32ContextImplementation_nSwapBuffers (JNIEnv *env, jclass clazz, jobject peer_info_handle) { Win32PeerInfo *peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); SwapBuffers(peer_info->drawable_hdc); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32ContextImplementation_nReleaseCurrentContext (JNIEnv *env, jclass clazz) { wglMakeCurrent(NULL, NULL); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32ContextImplementation_nMakeCurrent (JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject context_handle) { Win32Context *context_info = (Win32Context *)(*env)->GetDirectBufferAddress(env, context_handle); Win32PeerInfo *peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); if (!wglMakeCurrent(peer_info->drawable_hdc, context_info->context)) throwException(env, "Could not make context current"); } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32ContextImplementation_nIsCurrent (JNIEnv *env, jclass clazz, jobject context_handle) { Win32Context *context_info = (Win32Context *)(*env)->GetDirectBufferAddress(env, context_handle); return wglGetCurrentContext() == context_info->context; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32ContextImplementation_nSetVSync (JNIEnv *env, jclass clazz, jboolean enable) { if (extension_flags.WGL_EXT_swap_control) { if (enable == JNI_TRUE) { wglSwapIntervalEXT(1); } else { wglSwapIntervalEXT(0); } } } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32ContextImplementation_nDestroy (JNIEnv *env, jclass clazz, jobject context_handle) { Win32Context *context_info = (Win32Context *)(*env)->GetDirectBufferAddress(env, context_handle); wglDeleteContext(context_info->context); } --- NEW FILE: context.h --- /* * Copyright (c) 2002-2004 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. */ /** * $Id: context.h,v 1.1 2005/02/21 14:46:47 elias_naur Exp $ * * Base Win32 display * * @author cix_foo <ci...@us...> * @version $Revision: 1.1 $ */ #ifndef __LWJGL_CONTEXT_H #define __LWJGL_CONTEXT_H #include <windows.h> #include "common_tools.h" #include "extgl.h" #include "extgl_wgl.h" typedef struct { union { HWND format_hwnd; HPBUFFERARB pbuffer; }; HDC format_hdc; HDC drawable_hdc; } Win32PeerInfo; /* * Register the LWJGL window class. * Returns true for success, or false for failure */ extern bool registerWindow(); extern bool applyPixelFormat(HDC hdc, int iPixelFormat); /* * Close the window */ extern void closeWindow(HWND *hwnd, HDC *hdc); /** * Create a dummy window suitable to create contexts from */ extern HWND createDummyWindow(int x, int y); /* * Create a window with the specified position, size, and * fullscreen attribute. The window will have DirectInput associated * with it. * * 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); extern int findPixelFormat(JNIEnv *env, int origin_x, int origin_y, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer); #endif --- NEW FILE: org_lwjgl_opengl_Win32PeerInfo.c --- /* * Copyright (c) 2002-2004 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. */ /** * $Id: org_lwjgl_opengl_Win32PeerInfo.c,v 1.1 2005/02/21 14:46:47 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ #include <jni.h> #include "org_lwjgl_opengl_Win32PeerInfo.h" #include "context.h" #include "common_tools.h" JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_Win32PeerInfo_createHandle (JNIEnv *env, jclass clazz) { return newJavaManagedByteBuffer(env, sizeof(Win32PeerInfo)); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32PeerInfo_nChoosePixelFormat (JNIEnv *env, jclass clazz, jobject peer_info_handle, jint origin_x, jint origin_y, jobject pixel_format, jobject pixel_format_caps, jboolean use_hdc_bpp, jboolean window, jboolean pbuffer, jboolean double_buffer) { Win32PeerInfo *peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); int pixel_format_id = findPixelFormat(env, origin_x, origin_y, pixel_format, pixel_format_caps, use_hdc_bpp, window, pbuffer, double_buffer); if (pixel_format_id == -1) return; if (!applyPixelFormat(peer_info->format_hdc, pixel_format_id)) { throwException(env, "Could not apply pixel format"); return; } } Index: org_lwjgl_opengl_Pbuffer.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_Pbuffer.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- org_lwjgl_opengl_Pbuffer.c 17 Feb 2005 12:39:33 -0000 1.9 +++ org_lwjgl_opengl_Pbuffer.c 21 Feb 2005 14:46:47 -0000 1.10 @@ -42,7 +42,7 @@ #include <stdlib.h> #include "org_lwjgl_opengl_Win32Display.h" #include "org_lwjgl_opengl_Pbuffer.h" -#include "Window.h" +#include "context.h" #include "extgl.h" #include "extgl_wgl.h" @@ -78,7 +78,7 @@ return caps; } -static HPBUFFERARB createPbuffer(JNIEnv *env, int width, int height, jobject pixel_format, jobject pixelFormatCaps, const int *pBufferAttribs_ptr) { +/*static HPBUFFERARB createPbuffer(JNIEnv *env, int width, int height, jobject pixel_format, jobject pixelFormatCaps, const int *pBufferAttribs_ptr) { HWND dummy_hwnd = createWindow(0, 0, 1, 1, false, false); HDC dummy_hdc; int iPixelFormat; @@ -149,15 +149,72 @@ } return Pbuffer_context; } - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_nCreatePbuffer - (JNIEnv *env, jobject self, jobject buffer_handle, +*/ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32PbufferPeerInfo_nCreate + (JNIEnv *env, jobject self, jobject peer_info_handle, jint width, jint height, jobject pixel_format, - jobject pixelFormatCaps, jobject pBufferAttribs, jobject shared_context_handle_buffer) + jobject pixelFormatCaps, jobject pBufferAttribs) { + int origin_x = 0; int origin_y = 0; + HWND dummy_hwnd; + HDC dummy_hdc; HPBUFFERARB Pbuffer; + HDC Pbuffer_dc; const int *pBufferAttribs_ptr; - HDC Pbuffer_dc; + Win32PeerInfo *peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + int pixel_format_id; + + if ( pBufferAttribs != NULL ) { + pBufferAttribs_ptr = (const int *)(*env)->GetDirectBufferAddress(env, pBufferAttribs); + } else { + pBufferAttribs_ptr = NULL; + } + pixel_format_id = findPixelFormat(env, origin_x, origin_y, pixel_format, pixelFormatCaps, false, false, true, false); + + dummy_hwnd = createDummyWindow(origin_x, origin_y); + if (dummy_hwnd == NULL) { + throwException(env, "Could not create dummy window"); + return; + } + dummy_hdc = GetDC(dummy_hwnd); + if (!applyPixelFormat(dummy_hdc, pixel_format_id)) { + closeWindow(&dummy_hwnd, &dummy_hdc); + throwException(env, "Could not apply pixel format"); + return; + } + Pbuffer = wglCreatePbufferARB(dummy_hdc, pixel_format_id, width, height, pBufferAttribs_ptr); + closeWindow(&dummy_hwnd, &dummy_hdc); + if (Pbuffer == NULL) { + throwException(env, "Could not create Pbuffer"); + return; + } + Pbuffer_dc = wglGetPbufferDCARB(Pbuffer); + if (Pbuffer_dc == NULL) { + wglDestroyPbufferARB(Pbuffer); + throwException(env, "Could not get Pbuffer DC"); + return; + } + peer_info->format_hdc = Pbuffer_dc; + peer_info->pbuffer = Pbuffer; + peer_info->drawable_hdc = Pbuffer_dc; + +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32PbufferPeerInfo_nDestroy + (JNIEnv *env, jclass clazz, jobject peer_info_handle) { + Win32PeerInfo *peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + wglReleasePbufferDCARB(peer_info->pbuffer, peer_info->drawable_hdc); + wglDestroyPbufferARB(peer_info->pbuffer); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32PbufferPeerInfo_nIsBufferLost + (JNIEnv *env, jclass clazz, jobject peer_info_handle) { + Win32PeerInfo *peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + BOOL buffer_lost; + wglQueryPbufferARB(peer_info->pbuffer, WGL_PBUFFER_LOST_ARB, &buffer_lost); + return buffer_lost ? JNI_TRUE : JNI_FALSE; +} +/* HDC Pbuffer_dc; HGLRC Pbuffer_context; HGLRC shared_context; PbufferInfo *Pbuffer_info; @@ -165,11 +222,6 @@ throwException(env, "Buffer handle not large enough"); return; } - if ( pBufferAttribs != NULL ) { - pBufferAttribs_ptr = (const int *)(*env)->GetDirectBufferAddress(env, pBufferAttribs); - } else { - pBufferAttribs_ptr = NULL; - } Pbuffer = createPbuffer(env, width, height, pixel_format, pixelFormatCaps, pBufferAttribs_ptr); if (Pbuffer == NULL) { @@ -203,7 +255,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32Display_isBufferLost (JNIEnv *env, jobject self, jobject buffer_handle) { - PbufferInfo *Pbuffer_info = (PbufferInfo *)(*env)->GetDirectBufferAddress(env, buffer_handle); + PbufferInfo *Pbuffer_info = (PbufferInfo *)(*env)->GetDirectBufferAddress(env, buffer_handle); BOOL buffer_lost; wglQueryPbufferARB(Pbuffer_info->Pbuffer, WGL_PBUFFER_LOST_ARB, &buffer_lost); return buffer_lost ? JNI_TRUE : JNI_FALSE; @@ -226,7 +278,32 @@ wglReleasePbufferDCARB(Pbuffer_info->Pbuffer, Pbuffer_info->Pbuffer_dc); wglDestroyPbufferARB(Pbuffer_info->Pbuffer); } +*/ + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32PbufferPeerInfo_nSetPbufferAttrib + (JNIEnv *env, jclass clazz, jobject peer_info_handle, jint attrib, jint value) { + Win32PeerInfo *peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + int attribs[3]; + + attribs[0] = attrib; + attribs[1] = value; + attribs[2] = 0; + + wglSetPbufferAttribARB(peer_info->pbuffer, attribs); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32PbufferPeerInfo_nBindTexImageToPbuffer + (JNIEnv *env, jclass clazz, jobject peer_info_handle, jint buffer) { + Win32PeerInfo *peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + wglBindTexImageARB(peer_info->pbuffer, buffer); +} +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32PbufferPeerInfo_nReleaseTexImageFromPbuffer + (JNIEnv *env, jclass clazz, jobject peer_info_handle, jint buffer) { + Win32PeerInfo *peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + wglReleaseTexImageARB(peer_info->pbuffer, buffer); +} +/* JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_setPbufferAttrib (JNIEnv *env, jobject self, jobject buffer_handle, jint attrib, jint value) { @@ -253,4 +330,4 @@ { PbufferInfo *Pbuffer_info = (PbufferInfo *)(*env)->GetDirectBufferAddress(env, buffer_handle); wglReleaseTexImageARB(Pbuffer_info->Pbuffer, buffer); -} +}*/ Index: org_lwjgl_input_Cursor.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Cursor.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- org_lwjgl_input_Cursor.c 18 Jan 2005 16:42:31 -0000 1.3 +++ org_lwjgl_input_Cursor.c 21 Feb 2005 14:46:47 -0000 1.4 @@ -45,110 +45,111 @@ #include "common_tools.h" JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_getMaxCursorSize - (JNIEnv *env, jobject self) +(JNIEnv *env, jobject self) { return GetSystemMetrics(SM_CXCURSOR); } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_getMinCursorSize - (JNIEnv *env, jobject self) +(JNIEnv *env, jobject self) { return GetSystemMetrics(SM_CXCURSOR); } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_nCreateCursor - (JNIEnv *env, jobject self, jobject handle_buffer, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jint images_offset, jobject delay_buffer, jint delays_offset) +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_Win32Display_nCreateCursor +(JNIEnv *env, jobject self, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jint images_offset, jobject delay_buffer, jint delays_offset) { - unsigned char col0, col1, col2, col3, col4, col5, col6, col7; - unsigned char mask; - BITMAPINFO bitmapInfo; + unsigned char col0, col1, col2, col3, col4, col5, col6, col7; + unsigned char mask; + BITMAPINFO bitmapInfo; - HBITMAP cursorMask; - HCURSOR *cursor_handle; + HBITMAP cursorMask; + HCURSOR *cursor_handle; - HCURSOR cursor = NULL; - ICONINFO iconInfo; - char *ptrCursorImage; - HBITMAP colorDIB; - int *srcPtr; - char *dstPtr; - int bitWidth; - int scanlinePad; - int imageSize; // Size in bits - unsigned char *maskPixels; - int pixelCount = 0; - int maskCount = 0; + HCURSOR cursor = NULL; + ICONINFO iconInfo; + char *ptrCursorImage; + HBITMAP colorDIB; + int *srcPtr; + char *dstPtr; + int bitWidth; + int scanlinePad; + int imageSize; // Size in bits + unsigned char *maskPixels; + int pixelCount = 0; + int maskCount = 0; HBITMAP colorBitmap; int x, y; + jobject handle_buffer = newJavaManagedByteBuffer(env, sizeof(HCURSOR)); - int *pixels; - if ((*env)->GetDirectBufferCapacity(env, handle_buffer) < sizeof(HCURSOR)) { - throwException(env, "Handle buffer not large enough"); - return; + int *pixels; + if (handle_buffer == NULL) { + throwException(env, "Could not allocate handle"); + return NULL; } - pixels = (int *)(*env)->GetDirectBufferAddress(env, image_buffer) + images_offset; + pixels = (int *)(*env)->GetDirectBufferAddress(env, image_buffer) + images_offset; - memset(&bitmapInfo, 0, sizeof(BITMAPINFO)); - bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bitmapInfo.bmiHeader.biWidth = width; - bitmapInfo.bmiHeader.biHeight = -height; - bitmapInfo.bmiHeader.biPlanes = 1; + memset(&bitmapInfo, 0, sizeof(BITMAPINFO)); + bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bitmapInfo.bmiHeader.biWidth = width; + bitmapInfo.bmiHeader.biHeight = -height; + bitmapInfo.bmiHeader.biPlanes = 1; - bitmapInfo.bmiHeader.biBitCount = 24; - bitmapInfo.bmiHeader.biCompression = BI_RGB; + bitmapInfo.bmiHeader.biBitCount = 24; + bitmapInfo.bmiHeader.biCompression = BI_RGB; - colorDIB = CreateDIBSection(GetDC(NULL), (BITMAPINFO*)&(bitmapInfo), - DIB_RGB_COLORS, - (void**)&(ptrCursorImage), - NULL, 0); - srcPtr = pixels; - dstPtr = ptrCursorImage; - if (!dstPtr) { + colorDIB = CreateDIBSection(GetDC(NULL), (BITMAPINFO*)&(bitmapInfo), + DIB_RGB_COLORS, + (void**)&(ptrCursorImage), + NULL, 0); + srcPtr = pixels; + dstPtr = ptrCursorImage; + if (!dstPtr) { throwException(env, "Could not allocate DIB section."); - return; - } - for (y = 0; y < height; y++ ) { - for (x = 0; x < width; x++ ) { - dstPtr[2] = (*srcPtr >> 0x10) & 0xFF; - dstPtr[1] = (*srcPtr >> 0x08) & 0xFF; - dstPtr[0] = *srcPtr & 0xFF; + return NULL; + } + for (y = 0; y < height; y++ ) { + for (x = 0; x < width; x++ ) { + dstPtr[2] = (*srcPtr >> 0x10) & 0xFF; + dstPtr[1] = (*srcPtr >> 0x08) & 0xFF; + dstPtr[0] = *srcPtr & 0xFF; - srcPtr++; - dstPtr += 3; - } - } + srcPtr++; + dstPtr += 3; + } + } - colorBitmap = CreateDIBitmap(GetDC(NULL), - (BITMAPINFOHEADER*)&bitmapInfo.bmiHeader, - CBM_INIT, - (void *)ptrCursorImage, - (BITMAPINFO*)&bitmapInfo, - DIB_RGB_COLORS); + colorBitmap = CreateDIBitmap(GetDC(NULL), + (BITMAPINFOHEADER*)&bitmapInfo.bmiHeader, + CBM_INIT, + (void *)ptrCursorImage, + (BITMAPINFO*)&bitmapInfo, + DIB_RGB_COLORS); - DeleteObject(colorDIB); + DeleteObject(colorDIB); // Convert alpha map to pixel packed mask - bitWidth = width >> 3; - scanlinePad = bitWidth & (sizeof(WORD) - 1); - imageSize = (bitWidth + scanlinePad)*height; // Size in bits - maskPixels = (unsigned char*)malloc(sizeof(unsigned char)*imageSize); + bitWidth = width >> 3; + scanlinePad = bitWidth & (sizeof(WORD) - 1); + imageSize = (bitWidth + scanlinePad)*height; // Size in bits + maskPixels = (unsigned char*)malloc(sizeof(unsigned char)*imageSize); memset(maskPixels, 0, imageSize); for (y = 0; y < height; y++) for (x = 0; x < bitWidth; x++) { - col0 = (pixels[pixelCount++] & 0x01000000) >> 17; - col1 = (pixels[pixelCount++] & 0x01000000) >> 18; - col2 = (pixels[pixelCount++] & 0x01000000) >> 19; - col3 = (pixels[pixelCount++] & 0x01000000) >> 20; - col4 = (pixels[pixelCount++] & 0x01000000) >> 21; - col5 = (pixels[pixelCount++] & 0x01000000) >> 22; - col6 = (pixels[pixelCount++] & 0x01000000) >> 23; - col7 = (pixels[pixelCount++] & 0x01000000) >> 24; - mask = col0 | col1 | col2 | col3 | col4 | col5 | col6 | col7; + col0 = (pixels[pixelCount++] & 0x01000000) >> 17; + col1 = (pixels[pixelCount++] & 0x01000000) >> 18; + col2 = (pixels[pixelCount++] & 0x01000000) >> 19; + col3 = (pixels[pixelCount++] & 0x01000000) >> 20; + col4 = (pixels[pixelCount++] & 0x01000000) >> 21; + col5 = (pixels[pixelCount++] & 0x01000000) >> 22; + col6 = (pixels[pixelCount++] & 0x01000000) >> 23; + col7 = (pixels[pixelCount++] & 0x01000000) >> 24; + mask = col0 | col1 | col2 | col3 | col4 | col5 | col6 | col7; maskPixels[maskCount++] = ~mask; // 1 is tranparant, 0 opaque } - cursorMask = CreateBitmap(width, height, 1, 1, maskPixels); + cursorMask = CreateBitmap(width, height, 1, 1, maskPixels); memset(&iconInfo, 0, sizeof(ICONINFO)); iconInfo.hbmMask = cursorMask; @@ -159,19 +160,15 @@ cursor = CreateIconIndirect(&iconInfo); DeleteObject(colorBitmap); DeleteObject(cursorMask); - free(maskPixels); + free(maskPixels); - cursor_handle = (HCURSOR *)(*env)->GetDirectBufferAddress(env, handle_buffer); + cursor_handle = (HCURSOR *)(*env)->GetDirectBufferAddress(env, handle_buffer); *cursor_handle = cursor; + return handle_buffer; } -/* - * Class: org_lwjgl_input_Cursor - * Method: nDestroyCursor - * Signature: (I)V - */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_destroyCursor - (JNIEnv *env, jobject self, jobject handle_buffer) +(JNIEnv *env, jobject self, jobject handle_buffer) { HCURSOR *cursor_handle = (HCURSOR *)(*env)->GetDirectBufferAddress(env, handle_buffer); DestroyCursor(*cursor_handle); Index: org_lwjgl_opengl_Display.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_Display.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- org_lwjgl_opengl_Display.c 17 Feb 2005 12:39:33 -0000 1.15 +++ org_lwjgl_opengl_Display.c 21 Feb 2005 14:46:47 -0000 1.16 @@ -40,34 +40,32 @@ */ #define _PRIVATE_WINDOW_H_ -#include "Window.h" #include <windowsx.h> +#include <malloc.h> +#include "Window.h" #include "extgl_wgl.h" #include "common_tools.h" -#include "extgl_wgl.h" #include "display.h" #include "org_lwjgl_opengl_Win32Display.h" -#include <malloc.h> - -static bool oneShotInitialised = false; // Registers the LWJGL window class +#include "context.h" static HWND display_hwnd = NULL; // Handle to the window static HDC display_hdc = NULL; // Device context -static HGLRC display_hglrc = NULL; // OpenGL context +//static HGLRC display_hglrc = NULL; // OpenGL context static bool isFullScreen = false; // Whether we're fullscreen or not static bool isMinimized = false; // Whether we're minimized or not static bool isFocused = false; // whether we're focused or not static bool isDirty = false; // Whether we're dirty or not static bool isUndecorated = false; // Whether we're undecorated or not -extern HINSTANCE dll_handle; // Handle to the LWJGL dll -RECT clientSize; // client size rect used when creating and positioning window +static bool did_maximize = false; // A flag to tell when a window + // has recovered from minimized static bool closerequested; -static int pixel_format_index; +//static int pixel_format_index; #define WINDOWCLASSNAME "LWJGL" -bool applyPixelFormat(HDC hdc, int iPixelFormat) { +/*bool applyPixelFormat(HDC hdc, int iPixelFormat) { PIXELFORMATDESCRIPTOR desc; if (DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &desc) == 0) { return false; @@ -79,12 +77,17 @@ } return true; } +*/ + +HDC getCurrentHDC() { + return display_hdc; +} HWND getCurrentHWND() { return display_hwnd; } -HGLRC getCurrentContext() { +/*HGLRC getCurrentContext() { return display_hglrc; } @@ -164,10 +167,11 @@ bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I")); return findPixelFormatARBFromBPP(env, hdc, pixel_format, pixelFormatCaps, bpp, window, pbuffer, double_buffer); } - +*/ /* * Find an appropriate pixel format */ +/* static int findPixelFormatFromBPP(JNIEnv *env, HDC hdc, jobject pixel_format, int bpp) { jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); @@ -261,28 +265,7 @@ } else return iPixelFormat; } - -/* - * Close the window - */ -void closeWindow(HWND *hwnd, HDC *hdc) -{ - // Release device context - if (*hdc != NULL && *hwnd != NULL) { - printfDebug("Releasing DC\n"); - ReleaseDC(*hwnd, *hdc); - *hdc = NULL; - } - - // Close the window - if (*hwnd != NULL) { - ShowWindow(*hwnd, SW_HIDE); - printfDebug("Destroy window\n"); - DestroyWindow(*hwnd); - *hwnd = NULL; - } -} - +*/ /* * Called when the application is alt-tabbed to or from */ @@ -301,12 +284,7 @@ ShowWindow(display_hwnd, SW_RESTORE); SetForegroundWindow(display_hwnd); SetFocus(display_hwnd); - /* - * Calling wglMakeCurrent() (redundantly) seems to help some gfx cards - * restore from minimized to fullscreen. - */ - if (wglGetCurrentContext() == display_hglrc) - wglMakeCurrent(display_hdc, display_hglrc); + did_maximize = true; } else if (isFullScreen) { ShowWindow(display_hwnd, SW_SHOWMINNOACTIVE); resetDisplayMode(NULL); @@ -314,6 +292,12 @@ inAppActivate = false; } +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32Display_didMaximize + (JNIEnv *env, jobject self) { + jboolean result = did_maximize ? JNI_TRUE : JNI_FALSE; + did_maximize = false; + return result; +} /* * WindowProc for the GL window. */ @@ -427,7 +411,7 @@ * Register the LWJGL window class. * Returns true for success, or false for failure */ -static bool registerWindow() +/*static bool registerWindow() { WNDCLASS windowClass; if (!oneShotInitialised) { @@ -452,7 +436,7 @@ return true; } - +*/ /* * Handle native Win32 messages */ @@ -477,61 +461,6 @@ } /* - * 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(int x, int y, int width, int height, bool fullscreen, bool undecorated) -{ - int exstyle, windowflags; - HWND new_hwnd; - // 1. Register window class if necessary - if (!registerWindow()) { - return NULL; - } - - if (fullscreen) { - exstyle = WS_EX_APPWINDOW | WS_EX_TOPMOST; - windowflags = WS_POPUP; - } else if (undecorated) { - exstyle = WS_EX_APPWINDOW; - windowflags = WS_POPUP; - } else { - exstyle = WS_EX_APPWINDOW; - windowflags = WS_OVERLAPPED | WS_BORDER | WS_CAPTION | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_MINIMIZEBOX | WS_SYSMENU; - } - - // 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; - clientSize.top = 0; - - AdjustWindowRectEx( - &clientSize, // client-rectangle structure - windowflags, // window styles - FALSE, // menu-present option - exstyle // extended window style - ); - // Create the window now, using that class: - new_hwnd = CreateWindowEx ( - exstyle, - WINDOWCLASSNAME, - "", - windowflags, - x, y, clientSize.right - clientSize.left, clientSize.bottom - clientSize.top, - NULL, - NULL, - dll_handle, - NULL); - - return new_hwnd; -} - -/* * Class: org_lwjgl_Window * Method: nSetTitle * Signature: ()V @@ -549,7 +478,7 @@ * Method: update * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_update +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_nUpdate (JNIEnv * env, jobject self) { handleMessages(); @@ -561,13 +490,13 @@ * Method: swapBuffers * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_swapBuffers +/*JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_swapBuffers (JNIEnv * env, jobject self) { isDirty = false; SwapBuffers(display_hdc); } - +*/ /* * Class: org_lwjgl_opengl_Window * Method: nIsDirty @@ -617,7 +546,7 @@ * Method: nSetVSyncEnabled * Signature: (Z)Z */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_setVSyncEnabled +/*JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_setVSyncEnabled (JNIEnv * env, jobject self, jboolean sync) { if (extension_flags.WGL_EXT_swap_control) { @@ -636,37 +565,45 @@ if (!result) throwException(env, "Could not make display context current"); } - +*/ JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_Win32Display_getAvailableDisplayModes(JNIEnv *env, jobject self) { return getAvailableDisplayModes(env); } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_createWindow(JNIEnv *env, jobject self, jobject mode, jboolean fullscreen, jint x, jint y) { - jclass cls_displayMode = (*env)->GetObjectClass(env, mode); - jfieldID fid_width = (*env)->GetFieldID(env, cls_displayMode, "width", "I"); - jfieldID fid_height = (*env)->GetFieldID(env, cls_displayMode, "height... [truncated message content] |
|
From: Elias N. <eli...@us...> - 2005-02-21 14:47:27
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25733/src/native/common Modified Files: awt_tools.h common_tools.c common_tools.h extgl.h org_lwjgl_opengl_AWTSurfaceLock.c Log Message: Win32 part of refactor and AWTGLCanvas Index: org_lwjgl_opengl_AWTSurfaceLock.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_opengl_AWTSurfaceLock.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- org_lwjgl_opengl_AWTSurfaceLock.c 20 Feb 2005 12:55:35 -0000 1.2 +++ org_lwjgl_opengl_AWTSurfaceLock.c 21 Feb 2005 14:46:47 -0000 1.3 @@ -39,7 +39,9 @@ #include <jni.h> #include <jawt.h> -#ifndef _WIN32 +#ifdef _WIN32 +#include <windows.h> +#else #include <unistd.h> #endif #include "org_lwjgl_opengl_AWTSurfaceLock.h" @@ -48,16 +50,17 @@ #define WAIT_DELAY 100 +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_AWTSurfaceLock_createHandle + (JNIEnv *env, jclass clazz) { + return newJavaManagedByteBuffer(env, sizeof(AWTSurfaceLock)); +} + JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AWTSurfaceLock_lockAndInitHandle (JNIEnv *env, jclass clazz, jobject lock_buffer_handle, jobject canvas) { JAWT awt; JAWT_DrawingSurface* ds; JAWT_DrawingSurfaceInfo *dsi; AWTSurfaceLock *awt_lock = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle); - if ((*env)->GetDirectBufferCapacity(env, lock_buffer_handle) < sizeof(AWTSurfaceLock)) { - throwException(env, "Lock handle buffer not large enough"); - return; - } awt.version = JAWT_VERSION_1_4; while (true) { if (JAWT_GetAWT(env, &awt) == JNI_FALSE) { @@ -84,7 +87,11 @@ printfDebug("Could not get drawing surface info, retrying... \n"); ds->Unlock(ds); awt.FreeDrawingSurface(ds); - usleep(WAIT_DELAY); +#ifdef _WIN32 + Sleep(WAIT_DELAY); +#else + usleep(WAIT_DELAY*1000); +#endif } awt_lock->awt = awt; awt_lock->ds = ds; Index: awt_tools.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/awt_tools.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- awt_tools.h 20 Feb 2005 11:24:21 -0000 1.1 +++ awt_tools.h 21 Feb 2005 14:46:43 -0000 1.2 @@ -37,6 +37,9 @@ * @version $Revision$ */ +#ifndef __LWJGL_AWT_TOOLS_H +#define __LWJGL_AWT_TOOLS_H + #include <jni.h> #include <jawt.h> #include <jawt_md.h> @@ -46,3 +49,5 @@ JAWT_DrawingSurface* ds; JAWT_DrawingSurfaceInfo *dsi; } AWTSurfaceLock; + +#endif \ No newline at end of file Index: common_tools.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/common_tools.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- common_tools.c 15 Feb 2005 11:05:13 -0000 1.19 +++ common_tools.c 21 Feb 2005 14:46:43 -0000 1.20 @@ -273,6 +273,13 @@ return true; } +jobject newJavaManagedByteBuffer(JNIEnv *env, const int size) { + jclass bufferutils_class = (*env)->FindClass(env, "org/lwjgl/BufferUtils"); + jmethodID createByteBuffer = (*env)->GetStaticMethodID(env, bufferutils_class, "createByteBuffer", "(I)Ljava/nio/ByteBuffer;"); + jobject buffer = (*env)->CallStaticObjectMethod(env, bufferutils_class, createByteBuffer, size); + return buffer; +} + void ext_InitializeClass(JNIEnv *env, jclass clazz, ExtGetProcAddressPROC gpa, int num_functions, JavaMethodAndExtFunction *functions) { JNINativeMethod *methods; JavaMethodAndExtFunction *function; Index: extgl.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/extgl.h,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -r1.52 -r1.53 --- extgl.h 17 Feb 2005 12:39:32 -0000 1.52 +++ extgl.h 21 Feb 2005 14:46:43 -0000 1.53 @@ -79,7 +79,6 @@ #if defined(_WIN32) && !defined(APIENTRY) #define WIN32_LEAN_AND_MEAN 1 #include <windows.h> - #endif #define __glext_h_ Index: common_tools.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/common_tools.h,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- common_tools.h 16 Feb 2005 20:24:56 -0000 1.38 +++ common_tools.h 21 Feb 2005 14:46:43 -0000 1.39 @@ -148,6 +148,7 @@ extern bool getBooleanProperty(JNIEnv *env, const char* propertyName); extern char * GetStringNativeChars(JNIEnv *env, jstring jstr); extern jstring NewStringNative(JNIEnv *env, const char *str); +extern jobject newJavaManagedByteBuffer(JNIEnv *env, const int size); extern void ext_InitializeClass(JNIEnv *env, jclass clazz, ExtGetProcAddressPROC gpa, int num_functions, JavaMethodAndExtFunction *functions); extern bool ext_InitializeFunctions(ExtGetProcAddressPROC gpa, int num_functions, ExtFunction *functions); |
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25733/src/java/org/lwjgl/opengl Modified Files: AWTCanvasImplementation.java AWTGLCanvas.java AWTSurfaceLock.java GLContext.java LinuxAWTGLCanvasPeerInfo.java LinuxCanvasImplementation.java LinuxDisplay.java LinuxDisplayPeerInfo.java Win32Display.java Added Files: Win32AWTGLCanvasPeerInfo.java Win32CanvasImplementation.java Win32ContextImplementation.java Win32DisplayPeerInfo.java Win32PbufferPeerInfo.java Win32PeerInfo.java Log Message: Win32 part of refactor and AWTGLCanvas Index: Win32Display.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Win32Display.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- Win32Display.java 20 Feb 2005 11:24:17 -0000 1.11 +++ Win32Display.java 21 Feb 2005 14:46:42 -0000 1.12 @@ -42,15 +42,21 @@ import java.nio.FloatBuffer; import java.nio.IntBuffer; +import org.lwjgl.Sys; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.input.Cursor; final class Win32Display implements DisplayImplementation { - private static final int CURSOR_HANDLE_SIZE = 8; - private static final int PBUFFER_HANDLE_SIZE = 24; +// private static final int PBUFFER_HANDLE_SIZE = 24; - public native void createWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException; + private static Win32DisplayPeerInfo peer_info; + + public void createWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException { + nCreateWindow(mode, fullscreen, x, y); + peer_info.initDC(); + } + private native void nCreateWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException; public native void destroyWindow(); public native void switchDisplayMode(DisplayMode mode) throws LWJGLException; public native void resetDisplayMode(); @@ -67,13 +73,41 @@ // public native void swapBuffers(); // public native void makeCurrent() throws LWJGLException; public PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLException { - throw new RuntimeException("Not supported yet"); + GLContext.loadOpenGLLibrary(); + try { + peer_info = new Win32DisplayPeerInfo(pixel_format); + return peer_info; + } catch (LWJGLException e) { + GLContext.unloadOpenGLLibrary(); + throw e; + } } // public native void createContext(PixelFormat pixel_format) throws LWJGLException; // public native void destroyContext(); - public native void destroyPeerInfo(); - public native void update(); - public native void setVSyncEnabled(boolean sync); + public void destroyPeerInfo() { + peer_info.destroy(); + GLContext.unloadOpenGLLibrary(); + } + public void update() { + nUpdate(); + if (didMaximize()) { + /** + * WORKAROUND: + * Making the context current (redundantly) when the window + * is maximized helps some gfx recover from fullscreen + */ + try { + if (Display.getContext().isCurrent()) + Display.getContext().makeCurrent(); + } catch (LWJGLException e) { + Sys.log("Exception occurred while trying to make context current: " + e); + } + } + } + private native void nUpdate(); + private native boolean didMaximize(); + +// public native void setVSyncEnabled(boolean sync); public native void reshape(int x, int y, int width, int height); public native DisplayMode[] getAvailableDisplayModes() throws LWJGLException; @@ -100,24 +134,25 @@ public native int readKeyboard(IntBuffer buffer, int buffer_position); public native int isStateKeySet(int key); - public native void nCreateCursor(ByteBuffer handle, int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, int images_offset, IntBuffer delays, int delays_offset) throws LWJGLException; + public native ByteBuffer nCreateCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, int images_offset, IntBuffer delays, int delays_offset) throws LWJGLException; public Object createCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException { - ByteBuffer handle = BufferUtils.createByteBuffer(CURSOR_HANDLE_SIZE); - nCreateCursor(handle, width, height, xHotspot, yHotspot, numImages, images, images.position(), delays, delays != null ? delays.position() : -1); - return handle; + return nCreateCursor(width, height, xHotspot, yHotspot, numImages, images, images.position(), delays, delays != null ? delays.position() : -1); } public native void destroyCursor(Object cursorHandle); public native int getPbufferCapabilities(); - public native boolean isBufferLost(PeerInfo handle); + public boolean isBufferLost(PeerInfo handle) { + return ((Win32PbufferPeerInfo)handle).isBufferLost(); + } + // public native boolean isBufferLost(ByteBuffer handle); // public native void makePbufferCurrent(ByteBuffer handle) throws LWJGLException; public PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs) throws LWJGLException { - throw new RuntimeException("Not yet supported"); + return new Win32PbufferPeerInfo(width, height, pixel_format, pixelFormatCaps, pBufferAttribs); } /* public ByteBuffer createPbuffer(int width, int height, PixelFormat pixel_format, @@ -132,12 +167,22 @@ IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs, ByteBuffer shared_pbuffer_handle) throws LWJGLException; */ - public native void destroyPbuffer(PeerInfo handle); + public void destroyPbuffer(PeerInfo handle) { + ((Win32PbufferPeerInfo)handle).destroy(); + } // public native void destroyPbuffer(ByteBuffer handle); - public native void setPbufferAttrib(PeerInfo handle, int attrib, int value); - public native void bindTexImageToPbuffer(PeerInfo handle, int buffer); - public native void releaseTexImageFromPbuffer(PeerInfo handle, int buffer); + public void setPbufferAttrib(PeerInfo handle, int attrib, int value) { + ((Win32PbufferPeerInfo)handle).setPbufferAttrib(attrib, value); + } + + public void bindTexImageToPbuffer(PeerInfo handle, int buffer) { + ((Win32PbufferPeerInfo)handle).bindTexImageToPbuffer(buffer); + } + + public void releaseTexImageFromPbuffer(PeerInfo handle, int buffer) { + ((Win32PbufferPeerInfo)handle).releaseTexImageFromPbuffer(buffer); + } /* public native void setPbufferAttrib(ByteBuffer handle, int attrib, int value); public native void bindTexImageToPbuffer(ByteBuffer handle, int buffer); public native void releaseTexImageFromPbuffer(ByteBuffer handle, int buffer);*/ Index: LinuxCanvasImplementation.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/LinuxCanvasImplementation.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- LinuxCanvasImplementation.java 20 Feb 2005 12:31:42 -0000 1.4 +++ LinuxCanvasImplementation.java 21 Feb 2005 14:46:42 -0000 1.5 @@ -68,7 +68,7 @@ } } - public PeerInfo createPeerInfo(AWTGLCanvas canvas) throws LWJGLException { + public PeerInfo createPeerInfo(AWTGLCanvas canvas, PixelFormat pixel_format) throws LWJGLException { return new LinuxAWTGLCanvasPeerInfo(canvas); } --- NEW FILE: Win32DisplayPeerInfo.java --- /* * Copyright (c) 2002-2004 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 java.nio.ByteBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; /** * $Id: Win32DisplayPeerInfo.java,v 1.1 2005/02/21 14:46:43 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ final class Win32DisplayPeerInfo extends Win32PeerInfo { public Win32DisplayPeerInfo(PixelFormat pixel_format) throws LWJGLException { createDummyDC(getHandle()); try { choosePixelFormat(0, 0, pixel_format, null, true, true, false, true); } catch (LWJGLException e) { destroy(); throw e; } } private static native void createDummyDC(ByteBuffer peer_info_handle) throws LWJGLException; void initDC() { nInitDC(getHandle()); } private static native void nInitDC(ByteBuffer peer_info_handle); void destroy() { nDestroy(getHandle()); } private static native void nDestroy(ByteBuffer peer_info_handle); protected void doLockAndInitHandle() throws LWJGLException { // NO-OP } private static native void setPixelFormat(ByteBuffer peer_info_handle); protected void doUnlock() throws LWJGLException { // NO-OP } } Index: LinuxAWTGLCanvasPeerInfo.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/LinuxAWTGLCanvasPeerInfo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- LinuxAWTGLCanvasPeerInfo.java 20 Feb 2005 11:24:17 -0000 1.1 +++ LinuxAWTGLCanvasPeerInfo.java 21 Feb 2005 14:46:42 -0000 1.2 @@ -44,8 +44,6 @@ * @version $Revision$ */ final class LinuxAWTGLCanvasPeerInfo extends LinuxPeerInfo { - private final static int LOCK_HANDLE_SIZE = 64; - private final ByteBuffer lock_buffer = BufferUtils.createByteBuffer(LOCK_HANDLE_SIZE); private final AWTGLCanvas canvas; private final AWTSurfaceLock awt_surface = new AWTSurfaceLock(); --- NEW FILE: Win32PeerInfo.java --- /* * Copyright (c) 2002-2004 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 java.nio.ByteBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; import java.nio.IntBuffer; /** * $Id: Win32PeerInfo.java,v 1.1 2005/02/21 14:46:43 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ abstract class Win32PeerInfo extends PeerInfo { public Win32PeerInfo() { super(createHandle()); } private static native ByteBuffer createHandle(); protected void choosePixelFormat(int origin_x, int origin_y, PixelFormat pixel_format, IntBuffer pixel_format_caps, boolean use_hdc_bpp, boolean support_window, boolean support_pbuffer, boolean double_buffered) throws LWJGLException { nChoosePixelFormat(getHandle(), origin_x, origin_y, pixel_format, pixel_format_caps, use_hdc_bpp, support_window, support_pbuffer, double_buffered); } private static native void nChoosePixelFormat(ByteBuffer peer_info_handle, int origin_x, int origin_y, PixelFormat pixel_format, IntBuffer pixel_format_caps, boolean use_hdc_bpp, boolean support_window, boolean support_pbuffer, boolean double_buffered) throws LWJGLException; } --- NEW FILE: Win32PbufferPeerInfo.java --- /* * Copyright (c) 2002-2004 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 java.nio.ByteBuffer; import java.nio.IntBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; /** * $Id: Win32PbufferPeerInfo.java,v 1.1 2005/02/21 14:46:43 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ final class Win32PbufferPeerInfo extends Win32PeerInfo { public Win32PbufferPeerInfo(int width, int height, PixelFormat pixel_format, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs) throws LWJGLException { nCreate(getHandle(), width, height, pixel_format, pixelFormatCaps, pBufferAttribs); } private static native void nCreate(ByteBuffer handle, int width, int height, PixelFormat pixel_format, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs) throws LWJGLException; public boolean isBufferLost() { return nIsBufferLost(getHandle()); } private static native boolean nIsBufferLost(ByteBuffer handle); public void setPbufferAttrib(int attrib, int value) { nSetPbufferAttrib(getHandle(), attrib, value); } private static native void nSetPbufferAttrib(ByteBuffer handle, int attrib, int value); public void bindTexImageToPbuffer(int buffer) { nBindTexImageToPbuffer(getHandle(), buffer); } private static native void nBindTexImageToPbuffer(ByteBuffer handle, int buffer); public void releaseTexImageFromPbuffer(int buffer) { nReleaseTexImageFromPbuffer(getHandle(), buffer); } private static native void nReleaseTexImageFromPbuffer(ByteBuffer handle, int buffer); public void destroy() { nDestroy(getHandle()); } private static native void nDestroy(ByteBuffer handle); protected void doLockAndInitHandle() throws LWJGLException { // NO-OP } protected void doUnlock() throws LWJGLException { // NO-OP } } --- NEW FILE: Win32CanvasImplementation.java --- /* * Copyright (c) 2002-2004 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 java.nio.ByteBuffer; import org.lwjgl.LWJGLException; import org.lwjgl.BufferUtils; import java.awt.GraphicsDevice; import java.awt.GraphicsConfiguration; import java.awt.Rectangle; import java.lang.reflect.Method; /** * $Id: Win32CanvasImplementation.java,v 1.1 2005/02/21 14:46:42 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ final class Win32CanvasImplementation implements AWTCanvasImplementation { public PeerInfo createPeerInfo(AWTGLCanvas canvas, PixelFormat pixel_format) throws LWJGLException { return new Win32AWTGLCanvasPeerInfo(canvas, pixel_format); } /** * Find a proper GraphicsConfiguration from the given GraphicsDevice and PixelFormat. * * @return The GraphicsConfiguration corresponding to a visual that matches the pixel format. */ public GraphicsConfiguration findConfiguration(GraphicsDevice device, PixelFormat pixel_format) throws LWJGLException { /* * It seems like the best way is to simply return null and let * use SetPixelFormat in JNI later. */ return null; } } Index: GLContext.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/GLContext.java,v retrieving revision 1.47 retrieving revision 1.48 diff -u -d -r1.47 -r1.48 --- GLContext.java 17 Feb 2005 12:23:38 -0000 1.47 +++ GLContext.java 21 Feb 2005 14:46:42 -0000 1.48 @@ -111,6 +111,8 @@ static Set getSupportedExtensions() { Set supported_extensions = new HashSet(); String extensions_string = GL11.glGetString(GL11.GL_EXTENSIONS); + if (extensions_string == null) + throw new IllegalStateException("glGetString(GL_EXTENSIONS) returned null - is there a context current?"); StringTokenizer tokenizer = new StringTokenizer(extensions_string); while ( tokenizer.hasMoreTokens() ) { String extension_string = tokenizer.nextToken(); Index: AWTCanvasImplementation.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/AWTCanvasImplementation.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- AWTCanvasImplementation.java 20 Feb 2005 11:24:17 -0000 1.1 +++ AWTCanvasImplementation.java 21 Feb 2005 14:46:42 -0000 1.2 @@ -48,7 +48,7 @@ /** * Return an opaque handle to the canvas peer information required to create a context from it. */ - public PeerInfo createPeerInfo(AWTGLCanvas canvas) throws LWJGLException; + public PeerInfo createPeerInfo(AWTGLCanvas canvas, PixelFormat pixel_format) throws LWJGLException; /** * Find a proper GraphicsConfiguration from the given GraphicsDevice and PixelFormat. Index: LinuxDisplay.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- LinuxDisplay.java 20 Feb 2005 11:24:17 -0000 1.15 +++ LinuxDisplay.java 21 Feb 2005 14:46:42 -0000 1.16 @@ -49,7 +49,7 @@ final class LinuxDisplay implements DisplayImplementation { private static final int CURSOR_HANDLE_SIZE = 8; - private static final int PBUFFER_HANDLE_SIZE = 24; +// private static final int PBUFFER_HANDLE_SIZE = 24; private static final int NUM_BUTTONS = 3; private static PeerInfo peer_info; --- NEW FILE: Win32ContextImplementation.java --- /* * Copyright (c) 2002-2004 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 java.nio.ByteBuffer; import org.lwjgl.LWJGLException; import org.lwjgl.BufferUtils; /** * $Id: Win32ContextImplementation.java,v 1.1 2005/02/21 14:46:43 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ final class Win32ContextImplementation implements ContextImplementation { private static PeerInfo getCurrentPeerInfo() { return Context.getCurrentContext().getPeerInfo(); } public ByteBuffer create(PeerInfo peer_info, ByteBuffer shared_context_handle) throws LWJGLException { ByteBuffer peer_handle = peer_info.lockAndGetHandle(); try { return nCreate(peer_handle, shared_context_handle); } finally { peer_info.unlock(); } } private static native ByteBuffer nCreate(ByteBuffer peer_handle, ByteBuffer shared_context_handle) throws LWJGLException; public void swapBuffers() throws LWJGLException { PeerInfo current_peer_info = getCurrentPeerInfo(); if (current_peer_info == null) throw new IllegalStateException("No context is current"); ByteBuffer peer_handle = current_peer_info.lockAndGetHandle(); try { nSwapBuffers(peer_handle); } finally { current_peer_info.unlock(); } } private static native void nSwapBuffers(ByteBuffer peer_info_handle) throws LWJGLException; public void releaseCurrentContext() throws LWJGLException { nReleaseCurrentContext(); } private static native void nReleaseCurrentContext() throws LWJGLException; public void makeCurrent(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException { ByteBuffer peer_handle = peer_info.lockAndGetHandle(); try { nMakeCurrent(peer_handle, handle); } finally { peer_info.unlock(); } } private static native void nMakeCurrent(ByteBuffer peer_handle, ByteBuffer context_handle) throws LWJGLException; public boolean isCurrent(ByteBuffer handle) throws LWJGLException { boolean result = nIsCurrent(handle); return result; } private static native boolean nIsCurrent(ByteBuffer context_handle) throws LWJGLException; public void setVSync(boolean enabled) { nSetVSync(enabled); } private static native void nSetVSync(boolean enabled); public void destroy(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException { nDestroy(handle); } private static native void nDestroy(ByteBuffer context_handle) throws LWJGLException; } Index: AWTGLCanvas.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- AWTGLCanvas.java 20 Feb 2005 11:24:17 -0000 1.3 +++ AWTGLCanvas.java 21 Feb 2005 14:46:42 -0000 1.4 @@ -51,14 +51,13 @@ private final static AWTCanvasImplementation implementation; static { - System.loadLibrary("jawt"); Sys.initialize(); String class_name; String OS_NAME = System.getProperty("os.name"); if (OS_NAME.startsWith("Linux")) { class_name = "org.lwjgl.opengl.LinuxCanvasImplementation"; } else if (OS_NAME.startsWith("Windows")) { - class_name = "org.lwjgl.opengl.DefaultCanvasImplementation"; + class_name = "org.lwjgl.opengl.Win32CanvasImplementation"; } else if (OS_NAME.startsWith("Mac")) { class_name = "org.lwjgl.opengl.DefaultCanvasImplementation"; } else @@ -127,7 +126,7 @@ */ public AWTGLCanvas(GraphicsDevice device, PixelFormat pixel_format, Drawable drawable) throws LWJGLException { super(implementation.findConfiguration(device, pixel_format)); - this.peer_info = implementation.createPeerInfo(this); + this.peer_info = implementation.createPeerInfo(this, pixel_format); this.drawable = drawable; } Index: AWTSurfaceLock.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/AWTSurfaceLock.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- AWTSurfaceLock.java 20 Feb 2005 11:24:17 -0000 1.1 +++ AWTSurfaceLock.java 21 Feb 2005 14:46:42 -0000 1.2 @@ -46,8 +46,12 @@ * @version $Revision$ */ final class AWTSurfaceLock { - private final static int LOCK_HANDLE_SIZE = 64; - private final ByteBuffer lock_buffer = BufferUtils.createByteBuffer(LOCK_HANDLE_SIZE); + private final ByteBuffer lock_buffer; + + public AWTSurfaceLock() { + lock_buffer = createHandle(); + } + private static native ByteBuffer createHandle(); public ByteBuffer lockAndGetHandle(Canvas canvas) throws LWJGLException { lockAndInitHandle(lock_buffer, canvas); Index: LinuxDisplayPeerInfo.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplayPeerInfo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- LinuxDisplayPeerInfo.java 20 Feb 2005 11:24:17 -0000 1.1 +++ LinuxDisplayPeerInfo.java 21 Feb 2005 14:46:42 -0000 1.2 @@ -46,15 +46,21 @@ final class LinuxDisplayPeerInfo extends LinuxPeerInfo { public LinuxDisplayPeerInfo(PixelFormat pixel_format) throws LWJGLException { LinuxDisplay.lockAWT(); - initDefaultPeerInfo(getHandle(), pixel_format); - LinuxDisplay.unlockAWT(); + try { + initDefaultPeerInfo(getHandle(), pixel_format); + } finally { + LinuxDisplay.unlockAWT(); + } } private static native void initDefaultPeerInfo(ByteBuffer peer_info_handle, PixelFormat pixel_format) throws LWJGLException; protected void doLockAndInitHandle() throws LWJGLException { LinuxDisplay.lockAWT(); - initDrawable(getHandle()); - LinuxDisplay.unlockAWT(); + try { + initDrawable(getHandle()); + } finally { + LinuxDisplay.unlockAWT(); + } } private static native void initDrawable(ByteBuffer peer_info_handle); --- NEW FILE: Win32AWTGLCanvasPeerInfo.java --- /* * Copyright (c) 2002-2004 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 java.nio.ByteBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; /** * $Id: Win32AWTGLCanvasPeerInfo.java,v 1.1 2005/02/21 14:46:42 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ final class Win32AWTGLCanvasPeerInfo extends Win32PeerInfo { private final AWTGLCanvas canvas; private final AWTSurfaceLock awt_surface = new AWTSurfaceLock(); private final PixelFormat pixel_format; private boolean has_pixel_format= false; public Win32AWTGLCanvasPeerInfo(AWTGLCanvas canvas, PixelFormat pixel_format) { this.canvas = canvas; this.pixel_format = pixel_format; } protected void doLockAndInitHandle() throws LWJGLException { nInitHandle(awt_surface.lockAndGetHandle(canvas), getHandle()); if (!has_pixel_format) { // If we haven't applied a pixel format yet, do it now choosePixelFormat(canvas.getX(), canvas.getY(), pixel_format, null, true, true, false, true); has_pixel_format = true; } } private static native void nInitHandle(ByteBuffer surface_buffer, ByteBuffer peer_info_handle) throws LWJGLException; protected void doUnlock() throws LWJGLException { awt_surface.unlock(); } } |
|
From: Elias N. <eli...@us...> - 2005-02-21 14:47:23
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25733/src/java/org/lwjgl Modified Files: Sys.java Log Message: Win32 part of refactor and AWTGLCanvas Index: Sys.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Sys.java,v retrieving revision 1.76 retrieving revision 1.77 diff -u -d -r1.76 -r1.77 --- Sys.java 16 Feb 2005 15:21:51 -0000 1.76 +++ Sys.java 21 Feb 2005 14:46:42 -0000 1.77 @@ -63,6 +63,8 @@ private final static SysImplementation implementation; static { + System.loadLibrary("awt"); + System.loadLibrary("jawt"); System.loadLibrary(LIBRARY_NAME); implementation = createImplementation(); String native_version = implementation.getNativeLibraryVersion(); |
|
From: Elias N. <eli...@us...> - 2005-02-21 14:47:20
|
Update of /cvsroot/java-game-lib/LWJGL/platform_build/win32_ms_cmdline In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25733/platform_build/win32_ms_cmdline Modified Files: build.bat Log Message: Win32 part of refactor and AWTGLCanvas Index: build.bat =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/platform_build/win32_ms_cmdline/build.bat,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- build.bat 16 Feb 2005 20:23:50 -0000 1.15 +++ build.bat 21 Feb 2005 14:46:41 -0000 1.16 @@ -10,7 +10,7 @@ rem set LINKEROPTS=/link /LIBPATH:"%JAVA_HOME%\lib" /LIBPATH:"%ALHOME%\libs" /LIBPATH:"%DXHOME%\Lib" /LIBPATH:"%PLTSDKHOME%\Lib" /LIBPATH:"%CHOME%\Lib" /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /MACHINE:X86 /NOLOGO /DLL /DELAYLOAD:jawt.dll rem set LIBS=dinput.lib dxguid.lib OpenGL32.Lib Version.lib user32.lib Gdi32.lib Advapi32.lib jawt.lib delayimp.lib set LINKEROPTS=/link /LIBPATH:"%JAVA_HOME%\lib" /LIBPATH:"%ALHOME%\libs" /LIBPATH:"%DXHOME%\Lib" /LIBPATH:"%PLTSDKHOME%\Lib" /LIBPATH:"%CHOME%\Lib" /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /MACHINE:X86 /NOLOGO /DLL -set LIBS=dinput.lib dxguid.lib OpenGL32.Lib Version.lib user32.lib Gdi32.lib Advapi32.lib jawt.lib +set LIBS=Kernel32.lib dinput.lib dxguid.lib OpenGL32.Lib Version.lib user32.lib Gdi32.lib Advapi32.lib jawt.lib for %%x in (..\..\src\native\win32\*.c) do cl %COPTIONS% %%x for %%x in (..\..\src\native\common\*.c) do cl %COPTIONS% %%x |
|
From: Elias N. <eli...@us...> - 2005-02-21 14:47:19
|
Update of /cvsroot/java-game-lib/LWJGL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25733 Modified Files: build.xml Log Message: Win32 part of refactor and AWTGLCanvas Index: build.xml =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/build.xml,v retrieving revision 1.66 retrieving revision 1.67 diff -u -d -r1.66 -r1.67 --- build.xml 20 Feb 2005 23:04:43 -0000 1.66 +++ build.xml 21 Feb 2005 14:46:40 -0000 1.67 @@ -566,8 +566,13 @@ <class name="org.lwjgl.opengl.LinuxCanvasImplementation" /> </javah> <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/win32" force="yes"> + <class name="org.lwjgl.opengl.Win32PbufferPeerInfo" /> <class name="org.lwjgl.opengl.Win32Display" /> <class name="org.lwjgl.NativeSysImplementation" /> + <class name="org.lwjgl.opengl.Win32AWTGLCanvasPeerInfo" /> + <class name="org.lwjgl.opengl.Win32PeerInfo" /> + <class name="org.lwjgl.opengl.Win32DisplayPeerInfo" /> + <class name="org.lwjgl.opengl.Win32ContextImplementation" /> </javah> <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/macosx" force="yes"> <class name="org.lwjgl.opengl.MacOSXDisplay" /> |