diff options
author | Sven Gothel <[email protected]> | 2009-10-05 02:54:59 -0700 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-10-05 02:54:59 -0700 |
commit | 76bf2e5a7f23def0a3bf2b688791b593ecb283ab (patch) | |
tree | 84b7b2a25cc38450dc83a78d1f1ed165195a599e /src/newt/classes | |
parent | 59257476777104ff3f117d87a8205161cb800abf (diff) |
GLDrawableFactory Cleanup (-> On- Offscreen and PBuffer)
- Base all PBuffer/Offscreen GLDrawable creators on
a prev. created 'NativeWindow + SurfaceChangeable' instance.
Simplifies implementation path.
This also removes the almost cyclic referencing of
GLWindow -> OffscreenWindow
GLWindow -> Drawable -> NullWindow -> OffscreenWindow
Now it is just
GLWindow -> OffscreenWindow
GLWindow -> Drawable -> OffscreenWindow
- createGLDrawable() shall be used for all types now,
especially if you want to pass the offscreen NativeWindow
and benefit from the surfaceChangedListener etc ..
- Add public createOffscreenDrawable(..)
- EGLDrawable:
- Query surface only if not 0
- [re]create surface only if needed,
using 'ownEGL*' flag for destruction only.
Diffstat (limited to 'src/newt/classes')
-rw-r--r-- | src/newt/classes/com/sun/javafx/newt/OffscreenWindow.java | 24 | ||||
-rwxr-xr-x | src/newt/classes/com/sun/javafx/newt/Window.java | 2 |
2 files changed, 22 insertions, 4 deletions
diff --git a/src/newt/classes/com/sun/javafx/newt/OffscreenWindow.java b/src/newt/classes/com/sun/javafx/newt/OffscreenWindow.java index 4b35f2562..c8e3c7c9e 100644 --- a/src/newt/classes/com/sun/javafx/newt/OffscreenWindow.java +++ b/src/newt/classes/com/sun/javafx/newt/OffscreenWindow.java @@ -35,12 +35,14 @@ package com.sun.javafx.newt; import javax.media.nativewindow.*; -public class OffscreenWindow extends Window { +public class OffscreenWindow extends Window implements SurfaceChangeable { + + long surfaceHandle = 0; public OffscreenWindow() { } - static long nextWindowHandle = 1; + static long nextWindowHandle = 0x100; // start here - a marker protected void createNative(long parentWindowHandle, Capabilities caps) { if(0!=parentWindowHandle) { @@ -50,7 +52,7 @@ public class OffscreenWindow extends Window { throw new NativeWindowException("Capabilities is onscreen"); } AbstractGraphicsScreen aScreen = screen.getGraphicsScreen(); - config = new DefaultGraphicsConfiguration(aScreen, caps, caps); + config = GraphicsConfigurationFactory.getFactory(aScreen.getDevice()).chooseGraphicsConfiguration(caps, null, aScreen); if (config == null) { throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this); } @@ -64,6 +66,22 @@ public class OffscreenWindow extends Window { // nop } + public void disposeSurfaceHandle() { + surfaceHandle = 0; + } + + public synchronized void destroy() { + disposeSurfaceHandle(); + } + + public void setSurfaceHandle(long handle) { + surfaceHandle = handle ; + } + + public long getSurfaceHandle() { + return surfaceHandle; + } + public void setVisible(boolean visible) { if(!visible) { this.visible = visible; diff --git a/src/newt/classes/com/sun/javafx/newt/Window.java b/src/newt/classes/com/sun/javafx/newt/Window.java index 3b0c3b970..85b8723f9 100755 --- a/src/newt/classes/com/sun/javafx/newt/Window.java +++ b/src/newt/classes/com/sun/javafx/newt/Window.java @@ -172,7 +172,7 @@ public abstract class Window implements NativeWindow public String toString() { StringBuffer sb = new StringBuffer(); - sb.append("NEWT-Window[config "+config+ + sb.append(getClass().getName()+"[config "+config+ ", windowHandle 0x"+Long.toHexString(getWindowHandle())+ ", surfaceHandle 0x"+Long.toHexString(getSurfaceHandle())+ ", pos "+getX()+"/"+getY()+", size "+getWidth()+"x"+getHeight()+ |