aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java11
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java23
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/GLDrawableImpl.java54
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/GLPbufferImpl.java9
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java21
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java17
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenDrawable.java6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/egl/EGLPbufferDrawable.java9
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java5
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java3
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java17
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java3
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java11
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOffscreenCGLDrawable.java3
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java11
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java41
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java19
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java11
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java11
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java13
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java22
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOnscreenWGLDrawable.java11
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java25
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java3
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java9
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java19
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java9
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java13
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11DummyGLXDrawable.java10
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXContext.java11
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXDrawable.java22
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java23
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawable.java7
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java19
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java3
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java19
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java23
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXDrawable.java25
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/Animator.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java25
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java9
41 files changed, 322 insertions, 285 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java
index c19871560..219d9f4dd 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -204,7 +205,7 @@ public abstract class GLContextImpl extends GLContext {
if (contextHandle != 0) {
int lockRes = drawable.lockSurface();
- if (NativeWindow.LOCK_SURFACE_NOT_READY == lockRes) {
+ if (NativeSurface.LOCK_SURFACE_NOT_READY == lockRes) {
// this would be odd ..
throw new GLException("Surface not ready to lock: "+drawable);
}
@@ -231,7 +232,7 @@ public abstract class GLContextImpl extends GLContext {
}
int lockRes = drawable.lockSurface();
- if (NativeWindow.LOCK_SURFACE_NOT_READY == lockRes) {
+ if (NativeSurface.LOCK_SURFACE_NOT_READY == lockRes) {
// this would be odd ..
throw new GLException("Surface not ready to lock");
}
@@ -351,11 +352,11 @@ public abstract class GLContextImpl extends GLContext {
boolean exceptionOccurred = false;
int lockRes = drawable.lockSurface();
try {
- if (NativeWindow.LOCK_SURFACE_NOT_READY == lockRes) {
+ if (NativeSurface.LOCK_SURFACE_NOT_READY == lockRes) {
return CONTEXT_NOT_CURRENT;
}
try {
- if (NativeWindow.LOCK_SURFACE_CHANGED == lockRes) {
+ if (NativeSurface.LOCK_SURFACE_CHANGED == lockRes) {
drawable.updateHandle();
}
if (0 == drawable.getHandle()) {
@@ -452,7 +453,7 @@ public abstract class GLContextImpl extends GLContext {
protected final long createContextARB(long share, boolean direct,
int major[], int minor[], int ctp[])
{
- AbstractGraphicsConfiguration config = drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
GLCapabilities glCaps = (GLCapabilities) config.getChosenCapabilities();
GLProfile glp = glCaps.getGLProfile();
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java
index cd1422652..6cf326949 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -60,9 +61,9 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
public abstract GLDynamicLookupHelper getGLDynamicLookupHelper(int profile);
//---------------------------------------------------------------------------
- // Dispatching GLDrawable construction in respect to the NativeWindow Capabilities
+ // Dispatching GLDrawable construction in respect to the NativeSurface Capabilities
//
- public GLDrawable createGLDrawable(NativeWindow target) {
+ public GLDrawable createGLDrawable(NativeSurface target) {
if (target == null) {
throw new IllegalArgumentException("Null target");
}
@@ -76,7 +77,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
result = createOnscreenDrawable(target);
} else {
if( ! ( target instanceof SurfaceChangeable ) ) {
- throw new IllegalArgumentException("Passed NativeWindow must implement SurfaceChangeable for offscreen: "+target);
+ throw new IllegalArgumentException("Passed NativeSurface must implement SurfaceChangeable for offscreen: "+target);
}
if(caps.isPBuffer()) {
if(DEBUG) {
@@ -102,7 +103,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
// Onscreen GLDrawable construction
//
- protected abstract GLDrawableImpl createOnscreenDrawable(NativeWindow target);
+ protected abstract GLDrawableImpl createOnscreenDrawable(NativeSurface target);
//---------------------------------------------------------------------------
//
@@ -110,9 +111,9 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
//
/** Target must implement SurfaceChangeable */
- protected abstract GLDrawableImpl createGLPbufferDrawableImpl(NativeWindow target);
+ protected abstract GLDrawableImpl createGLPbufferDrawableImpl(NativeSurface target);
- protected GLDrawableImpl createGLPbufferDrawable(NativeWindow target) {
+ protected GLDrawableImpl createGLPbufferDrawable(NativeSurface target) {
if (!canCreateGLPbuffer(target.getGraphicsConfiguration().getNativeGraphicsConfiguration().getScreen().getDevice())) {
throw new GLException("Pbuffer support not available with current graphics card");
}
@@ -130,7 +131,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
capabilities.setDoubleBuffered(false); // FIXME DBLBUFOFFSCRN
capabilities.setOnscreen(false);
capabilities.setPBuffer(true);
- return createGLPbufferDrawable( createOffscreenWindow(capabilities, chooser, height, height) );
+ return createGLPbufferDrawable( createOffscreenSurface(capabilities, chooser, height, height) );
}
public GLPbuffer createGLPbuffer(GLCapabilities capabilities,
@@ -148,7 +149,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
// Offscreen GLDrawable construction
//
- protected abstract GLDrawableImpl createOffscreenDrawable(NativeWindow target) ;
+ protected abstract GLDrawableImpl createOffscreenDrawable(NativeSurface target) ;
public GLDrawable createOffscreenDrawable(GLCapabilities capabilities,
GLCapabilitiesChooser chooser,
@@ -161,14 +162,14 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
capabilities.setDoubleBuffered(false); // FIXME DBLBUFOFFSCRN
capabilities.setOnscreen(false);
capabilities.setPBuffer(false);
- return createOffscreenDrawable( createOffscreenWindow(capabilities, chooser, width, height) );
+ return createOffscreenDrawable( createOffscreenSurface(capabilities, chooser, width, height) );
}
/**
- * creates an offscreen NativeWindow, which must implement SurfaceChangeable as well,
+ * creates an offscreen NativeSurface, which must implement SurfaceChangeable as well,
* so the windowing system related implementation is able to set the surface handle.
*/
- protected abstract NativeWindow createOffscreenWindow(GLCapabilities capabilities, GLCapabilitiesChooser chooser,
+ protected abstract NativeSurface createOffscreenSurface(GLCapabilities capabilities, GLCapabilitiesChooser chooser,
int width, int height);
protected abstract GLDrawableImpl getSharedDrawable();
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableImpl.java
index 1270a4545..19e637cab 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableImpl.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -46,12 +47,12 @@ public abstract class GLDrawableImpl implements GLDrawable {
protected static final boolean DEBUG = Debug.debug("GLDrawable");
protected GLDrawableImpl(GLDrawableFactory factory,
- NativeWindow comp,
+ NativeSurface comp,
boolean realized) {
this.factory = factory;
- this.component = comp;
+ this.surface = comp;
this.realized = realized;
- this.requestedCapabilities = (GLCapabilities)component.getGraphicsConfiguration().getNativeGraphicsConfiguration().getRequestedCapabilities(); // a copy ..
+ this.requestedCapabilities = (GLCapabilities)surface.getGraphicsConfiguration().getNativeGraphicsConfiguration().getRequestedCapabilities(); // a copy ..
}
/**
@@ -70,16 +71,16 @@ public abstract class GLDrawableImpl implements GLDrawable {
}
public final void swapBuffers() throws GLException {
- GLCapabilities caps = (GLCapabilities)component.getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
+ GLCapabilities caps = (GLCapabilities)surface.getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
if ( caps.getDoubleBuffered() ) {
- if(!component.surfaceSwap()) {
+ if(!surface.surfaceSwap()) {
int lockRes = lockSurface(); // it's recursive, so it's ok within [makeCurrent .. release]
- if (NativeWindow.LOCK_SURFACE_NOT_READY == lockRes) {
+ if (NativeSurface.LOCK_SURFACE_NOT_READY == lockRes) {
return;
}
try {
- AbstractGraphicsDevice aDevice = getNativeWindow().getGraphicsConfiguration().getScreen().getDevice();
- if (NativeWindow.LOCK_SURFACE_CHANGED == lockRes) {
+ AbstractGraphicsDevice aDevice = getNativeSurface().getGraphicsConfiguration().getScreen().getDevice();
+ if (NativeSurface.LOCK_SURFACE_CHANGED == lockRes) {
updateHandle();
}
swapBuffersImpl();
@@ -93,7 +94,7 @@ public abstract class GLDrawableImpl implements GLDrawable {
ctx.getGL().glFinish();
}
}
- component.surfaceUpdated(this, component, System.currentTimeMillis());
+ surface.surfaceUpdated(this, surface, System.currentTimeMillis());
}
protected abstract void swapBuffersImpl();
@@ -106,22 +107,22 @@ public abstract class GLDrawableImpl implements GLDrawable {
}
public GLCapabilities getChosenGLCapabilities() {
- return (GLCapabilities)component.getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities(); // a copy
+ return (GLCapabilities)surface.getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities(); // a copy
}
public GLCapabilities getRequestedGLCapabilities() {
return requestedCapabilities;
}
- public NativeWindow getNativeWindow() {
- return component;
+ public NativeSurface getNativeSurface() {
+ return surface;
}
protected void destroyHandle() {}
protected void updateHandle() {}
public long getHandle() {
- return component.getSurfaceHandle();
+ return surface.getSurfaceHandle();
}
public GLDrawableFactory getFactory() {
@@ -134,11 +135,11 @@ public abstract class GLDrawableImpl implements GLDrawable {
System.err.println("setRealized: "+getClass().getName()+" "+this.realized+" -> "+realized);
}
this.realized = realized;
- if(realized && NativeWindow.LOCK_SURFACE_NOT_READY == lockSurface()) {
+ if(realized && NativeSurface.LOCK_SURFACE_NOT_READY == lockSurface()) {
throw new GLException("X11GLXDrawable.setRealized(true): lockSurface - surface not ready");
}
try {
- AbstractGraphicsDevice aDevice = getNativeWindow().getGraphicsConfiguration().getScreen().getDevice();
+ AbstractGraphicsDevice aDevice = getNativeSurface().getGraphicsConfiguration().getScreen().getDevice();
if(!realized) {
destroyHandle();
}
@@ -161,39 +162,38 @@ public abstract class GLDrawableImpl implements GLDrawable {
}
public int getWidth() {
- return component.getWidth();
+ return surface.getWidth();
}
-
- /** Returns the current height of this GLDrawable. */
+
public int getHeight() {
- return component.getHeight();
+ return surface.getHeight();
}
public int lockSurface() throws GLException {
- return component.lockSurface();
+ return surface.lockSurface();
}
public void unlockSurface() {
- component.unlockSurface();
+ surface.unlockSurface();
}
public boolean isSurfaceLocked() {
- return component.isSurfaceLocked();
+ return surface.isSurfaceLocked();
}
public String toString() {
return getClass().getName()+"[Realized "+isRealized()+
",\n\tFactory "+getFactory()+
",\n\thandle "+toHexString(getHandle())+
- ",\n\tWindow "+getNativeWindow()+"]";
+ ",\n\tWindow "+getNativeSurface()+"]";
}
protected GLDrawableFactory factory;
- protected NativeWindow component;
+ protected NativeSurface surface;
protected GLCapabilities requestedCapabilities;
- // Indicates whether the component (if an onscreen context) has been
- // realized. Plausibly, before the component is realized the JAWT
+ // Indicates whether the surface (if an onscreen context) has been
+ // realized. Plausibly, before the surface is realized the JAWT
// should return an error or NULL object from some of its
// operations; this appears to be the case on Win32 but is not true
// at least with Sun's current X11 implementation (1.4.x), which
@@ -201,7 +201,7 @@ public abstract class GLDrawableImpl implements GLDrawable {
// fetched from a locked DrawingSurface during the validation as a
// result of calling show() on the main thread. To work around this
// we prevent any JAWT or OpenGL operations from being done until
- // addNotify() is called on the component.
+ // addNotify() is called on the surface.
protected boolean realized;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLPbufferImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLPbufferImpl.java
index dcfb2e3f5..9f113f337 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/GLPbufferImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLPbufferImpl.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -64,7 +65,7 @@ public class GLPbufferImpl implements GLPbuffer {
public GLPbufferImpl(GLDrawableImpl pbufferDrawable,
GLContext parentContext) {
GLCapabilities caps = (GLCapabilities)
- pbufferDrawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
+ pbufferDrawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
if(caps.isOnscreen()) {
if(caps.isPBuffer()) {
throw new IllegalArgumentException("Error: Given drawable is Onscreen and Pbuffer: "+pbufferDrawable);
@@ -96,8 +97,8 @@ public class GLPbufferImpl implements GLPbuffer {
throw new GLException("Not yet implemented");
}
- public NativeWindow getNativeWindow() {
- return pbufferDrawable.getNativeWindow();
+ public NativeSurface getNativeSurface() {
+ return pbufferDrawable.getNativeSurface();
}
public long getHandle() {
@@ -219,7 +220,7 @@ public class GLPbufferImpl implements GLPbuffer {
public int lockSurface() throws GLException {
recurLock.lock();
- return NativeWindow.LOCK_SUCCESS;
+ return NativeSurface.LOCK_SUCCESS;
}
public void unlockSurface() {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java
index 7eeb19141..f9fcdb29c 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -50,7 +51,7 @@ public abstract class EGLDrawable extends GLDrawableImpl {
protected long eglSurface;
protected EGLDrawable(EGLDrawableFactory factory,
- NativeWindow component) throws GLException {
+ NativeSurface component) throws GLException {
super(factory, component, false);
eglSurface=EGL.EGL_NO_SURFACE;
eglDisplay=0;
@@ -86,19 +87,19 @@ public abstract class EGLDrawable extends GLDrawableImpl {
System.err.println("createSurface using eglDisplay 0x"+Long.toHexString(eglDisplay)+", "+eglConfig);
}
- eglSurface = createSurface(eglDisplay, eglConfig.getNativeConfig(), component.getSurfaceHandle());
+ eglSurface = createSurface(eglDisplay, eglConfig.getNativeConfig(), surface.getSurfaceHandle());
if (EGL.EGL_NO_SURFACE==eglSurface) {
throw new GLException("Creation of window surface failed: "+eglConfig+", error 0x"+Integer.toHexString(EGL.eglGetError()));
}
if(DEBUG) {
- System.err.println("setSurface using component: handle 0x"+Long.toHexString(component.getSurfaceHandle())+" -> 0x"+Long.toHexString(eglSurface));
+ System.err.println("setSurface using component: handle 0x"+Long.toHexString(surface.getSurfaceHandle())+" -> 0x"+Long.toHexString(eglSurface));
}
}
protected void setRealizedImpl() {
if (realized) {
- AbstractGraphicsConfiguration aConfig = component.getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ AbstractGraphicsConfiguration aConfig = surface.getGraphicsConfiguration().getNativeGraphicsConfiguration();
AbstractGraphicsDevice aDevice = aConfig.getScreen().getDevice();
if(aDevice instanceof EGLGraphicsDevice) {
if(DEBUG) {
@@ -116,10 +117,10 @@ public abstract class EGLDrawable extends GLDrawableImpl {
}
int[] tmp = new int[1];
- if ( 0 != component.getSurfaceHandle() &&
- EGL.eglQuerySurface(eglDisplay, component.getSurfaceHandle(), EGL.EGL_CONFIG_ID, tmp, 0) ) {
- // component holds static EGLSurface
- eglSurface = component.getSurfaceHandle();
+ if ( 0 != surface.getSurfaceHandle() &&
+ EGL.eglQuerySurface(eglDisplay, surface.getSurfaceHandle(), EGL.EGL_CONFIG_ID, tmp, 0) ) {
+ // surface holds static EGLSurface
+ eglSurface = surface.getSurfaceHandle();
if(DEBUG) {
System.err.println("setSurface re-using component's EGLSurface: handle 0x"+Long.toHexString(eglSurface));
}
@@ -145,7 +146,7 @@ public abstract class EGLDrawable extends GLDrawableImpl {
long nDisplay=0;
if( NativeWindowFactory.TYPE_WINDOWS.equals(NativeWindowFactory.getNativeWindowType(false)) ) {
- nDisplay = component.getSurfaceHandle(); // don't even ask ..
+ nDisplay = surface.getSurfaceHandle(); // don't even ask ..
} else {
nDisplay = aDevice.getHandle(); // 0 == EGL.EGL_DEFAULT_DISPLAY
}
@@ -219,7 +220,7 @@ public abstract class EGLDrawable extends GLDrawableImpl {
public String toString() {
return getClass().getName()+"[realized "+isRealized()+
",\n\tfactory "+getFactory()+
- ",\n\twindow "+getNativeWindow()+
+ ",\n\tsurface "+getNativeSurface()+
",\n\teglSurface 0x"+Long.toHexString(eglSurface)+
",\n\teglConfig "+eglConfig+
",\n\trequested "+getRequestedGLCapabilities()+
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java
index 72498a7af..b1084dd8f 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -40,7 +41,7 @@ import javax.media.opengl.*;
import com.jogamp.common.JogampRuntimeException;
import com.jogamp.common.util.*;
import com.jogamp.opengl.impl.*;
-import com.jogamp.nativewindow.impl.NullWindow;
+import com.jogamp.nativewindow.impl.ProxySurface;
public class EGLDrawableFactory extends GLDrawableFactoryImpl {
@@ -114,14 +115,14 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
protected final GLDrawableImpl getSharedDrawable() { return null; }
protected final GLContextImpl getSharedContext() { return null; }
- public GLDrawableImpl createOnscreenDrawable(NativeWindow target) {
+ public GLDrawableImpl createOnscreenDrawable(NativeSurface target) {
if (target == null) {
throw new IllegalArgumentException("Null target");
}
return new EGLOnscreenDrawable(this, target);
}
- protected GLDrawableImpl createOffscreenDrawable(NativeWindow target) {
+ protected GLDrawableImpl createOffscreenDrawable(NativeSurface target) {
throw new GLException("Not yet implemented");
}
@@ -129,14 +130,14 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
return true;
}
- protected GLDrawableImpl createGLPbufferDrawableImpl(NativeWindow target) {
+ protected GLDrawableImpl createGLPbufferDrawableImpl(NativeSurface target) {
return new EGLPbufferDrawable(this, target);
}
- protected NativeWindow createOffscreenWindow(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) {
- NullWindow nw = new NullWindow(EGLGraphicsConfigurationFactory.createOffscreenGraphicsConfiguration(capabilities, chooser));
- nw.setSize(width, height);
- return nw;
+ protected NativeSurface createOffscreenSurface(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) {
+ ProxySurface ns = new ProxySurface(EGLGraphicsConfigurationFactory.createOffscreenGraphicsConfiguration(capabilities, chooser));
+ ns.setSize(width, height);
+ return ns;
}
public GLContext createExternalGLContext() {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenDrawable.java
index 551a21ed6..820ac04e9 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenDrawable.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -41,12 +42,9 @@ package com.jogamp.opengl.impl.egl;
import javax.media.opengl.*;
import javax.media.nativewindow.*;
-import javax.media.nativewindow.egl.*;
-import com.jogamp.opengl.impl.*;
-import com.jogamp.nativewindow.impl.NullWindow;
public class EGLOnscreenDrawable extends EGLDrawable {
- protected EGLOnscreenDrawable(EGLDrawableFactory factory, NativeWindow component) throws GLException {
+ protected EGLOnscreenDrawable(EGLDrawableFactory factory, NativeSurface component) throws GLException {
super(factory, component);
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLPbufferDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLPbufferDrawable.java
index 03b02b77e..5b7509c43 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLPbufferDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLPbufferDrawable.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -48,12 +49,12 @@ public class EGLPbufferDrawable extends EGLDrawable {
private int texFormat;
protected static final boolean useTexture = false; // No yet ..
- protected EGLPbufferDrawable(EGLDrawableFactory factory, NativeWindow target) {
+ protected EGLPbufferDrawable(EGLDrawableFactory factory, NativeSurface target) {
super(factory, target);
ownEGLDisplay = true;
// get choosen ones ..
- GLCapabilities caps = (GLCapabilities) getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
+ GLCapabilities caps = (GLCapabilities) getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
if(useTexture) {
this.texFormat = caps.getAlphaBits() > 0 ? EGL.EGL_TEXTURE_RGBA : EGL.EGL_TEXTURE_RGB ;
@@ -62,7 +63,7 @@ public class EGLPbufferDrawable extends EGLDrawable {
}
if (DEBUG) {
- System.out.println("Pbuffer config: " + getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration());
+ System.out.println("Pbuffer config: " + getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration());
}
setRealized(true);
@@ -74,7 +75,7 @@ public class EGLPbufferDrawable extends EGLDrawable {
}
protected long createSurface(long eglDpy, long eglNativeCfg, long surfaceHandle) {
- NativeWindow nw = getNativeWindow();
+ NativeSurface nw = getNativeSurface();
int[] attrs = EGLGraphicsConfiguration.CreatePBufferSurfaceAttribList(nw.getWidth(), nw.getHeight(), texFormat);
long surf = EGL.eglCreatePbufferSurface(eglDpy, eglNativeCfg, attrs, 0);
if (EGL.EGL_NO_SURFACE==surf) {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java
index 46b86a557..1bb07cf9c 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -114,7 +115,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
throw new GLException("GLContextShareSet returned a NULL OpenGL context");
}
}
- MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
GLCapabilities capabilitiesRequested = (GLCapabilities)config.getRequestedCapabilities();
GLProfile glProfile = capabilitiesRequested.getGLProfile();
if(glProfile.isGL3()) {
@@ -242,7 +243,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
protected void swapBuffers() {
- DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
GLCapabilities caps = (GLCapabilities)config.getChosenCapabilities();
if(caps.isOnscreen()) {
if(isNSContext) {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java
index 23fdcbf6d..1eeaa55e1 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -77,7 +78,7 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl {
public static final int NSOPENGL_MODE = 1;
public static final int CGL_MODE = 2;
- public MacOSXCGLDrawable(GLDrawableFactory factory, NativeWindow comp, boolean realized) {
+ public MacOSXCGLDrawable(GLDrawableFactory factory, NativeSurface comp, boolean realized) {
super(factory, comp, realized);
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java
index 9694e5607..396d6aefc 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -45,7 +46,7 @@ import javax.media.opengl.*;
import com.jogamp.common.JogampRuntimeException;
import com.jogamp.common.util.*;
import com.jogamp.opengl.impl.*;
-import com.jogamp.nativewindow.impl.NullWindow;
+import com.jogamp.nativewindow.impl.ProxySurface;
public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
private static final DesktopGLDynamicLookupHelper macOSXCGLDynamicLookupHelper;
@@ -87,14 +88,14 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
protected final GLDrawableImpl getSharedDrawable() { return null; }
protected final GLContextImpl getSharedContext() { return null; }
- public GLDrawableImpl createOnscreenDrawable(NativeWindow target) {
+ public GLDrawableImpl createOnscreenDrawable(NativeSurface target) {
if (target == null) {
throw new IllegalArgumentException("Null target");
}
return new MacOSXOnscreenCGLDrawable(this, target);
}
- protected GLDrawableImpl createOffscreenDrawable(NativeWindow target) {
+ protected GLDrawableImpl createOffscreenDrawable(NativeSurface target) {
return new MacOSXOffscreenCGLDrawable(this, target);
}
@@ -102,7 +103,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
return true;
}
- protected GLDrawableImpl createGLPbufferDrawableImpl(final NativeWindow target) {
+ protected GLDrawableImpl createGLPbufferDrawableImpl(final NativeSurface target) {
/**
* FIXME: Think about this ..
* should not be necessary ? ..
@@ -119,11 +120,11 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
return new MacOSXPbufferCGLDrawable(this, target);
}
- protected NativeWindow createOffscreenWindow(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) {
+ protected NativeSurface createOffscreenSurface(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) {
AbstractGraphicsScreen screen = DefaultGraphicsScreen.createDefault();
- NullWindow nw = new NullWindow(MacOSXCGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capabilities, chooser, screen, true));
- nw.setSize(width, height);
- return nw;
+ ProxySurface ns = new ProxySurface(MacOSXCGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capabilities, chooser, screen, true));
+ ns.setSize(width, height);
+ return ns;
}
public GLContext createExternalGLContext() {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java
index 889d1c333..d2be9d0de 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -148,7 +149,7 @@ public class MacOSXCGLGraphicsConfiguration extends DefaultGraphicsConfiguration
// On this platform the pixel format is associated with the
// context and not the drawable. However it's a reasonable
// approximation to just store the chosen pixel format up in the
- // NativeWindow's AbstractGraphicsConfiguration,
+ // NativeSurface's AbstractGraphicsConfiguration,
// since the public API doesn't provide for a different GLCapabilities per context.
// Note: These restrictions of the platform's API might be considered as a bug anyways.
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java
index e8518925a..973c67127 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -43,7 +44,7 @@ import javax.media.opengl.*;
import com.jogamp.opengl.impl.*;
import javax.media.nativewindow.*;
-import com.jogamp.nativewindow.impl.NullWindow;
+import com.jogamp.nativewindow.impl.ProxySurface;
public class MacOSXExternalCGLContext extends MacOSXCGLContext {
private boolean firstMakeCurrent = true;
@@ -99,9 +100,9 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext {
AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault();
MacOSXCGLGraphicsConfiguration cfg = new MacOSXCGLGraphicsConfiguration(aScreen, caps, caps, pixelFormat);
- NullWindow nw = new NullWindow(cfg);
- nw.setSurfaceHandle(currentDrawable);
- return new MacOSXExternalCGLContext(new Drawable(factory, nw), isNSContext, contextHandle);
+ ProxySurface ns = new ProxySurface(cfg);
+ ns.setSurfaceHandle(currentDrawable);
+ return new MacOSXExternalCGLContext(new Drawable(factory, ns), isNSContext, contextHandle);
}
protected boolean createImpl() throws GLException {
@@ -150,7 +151,7 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext {
static class Drawable extends MacOSXCGLDrawable {
MacOSXExternalCGLContext extCtx;
- Drawable(GLDrawableFactory factory, NativeWindow comp) {
+ Drawable(GLDrawableFactory factory, NativeSurface comp) {
super(factory, comp, true);
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOffscreenCGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOffscreenCGLDrawable.java
index adaa48f34..f87c89f2d 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOffscreenCGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOffscreenCGLDrawable.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -46,7 +47,7 @@ import com.jogamp.opengl.impl.*;
public class MacOSXOffscreenCGLDrawable extends MacOSXPbufferCGLDrawable {
public MacOSXOffscreenCGLDrawable(GLDrawableFactory factory,
- NativeWindow target) {
+ NativeSurface target) {
super(factory, target);
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java
index 6ee023867..798e39ef4 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -51,7 +52,7 @@ public class MacOSXOnscreenCGLDrawable extends MacOSXCGLDrawable {
private List/*<WeakReference<GLContext>>*/ createdContexts =
new ArrayList();
- protected MacOSXOnscreenCGLDrawable(GLDrawableFactory factory, NativeWindow component) {
+ protected MacOSXOnscreenCGLDrawable(GLDrawableFactory factory, NativeSurface component) {
super(factory, component, false);
}
@@ -70,14 +71,6 @@ public class MacOSXOnscreenCGLDrawable extends MacOSXCGLDrawable {
return context;
}
- public int getWidth() {
- return component.getWidth();
- }
-
- public int getHeight() {
- return component.getHeight();
- }
-
protected void swapBuffersImpl() {
for (Iterator iter = createdContexts.iterator(); iter.hasNext(); ) {
WeakReference ref = (WeakReference) iter.next();
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java
index 3964c9771..5cf8c6eb9 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java
@@ -1,3 +1,36 @@
+/*
+ * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution 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 Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
package com.jogamp.opengl.impl.macosx.cgl;
import com.jogamp.common.nio.PointerBuffer;
@@ -53,7 +86,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
if (newCreated) {
// Initialize render-to-texture support if requested
- DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
GLCapabilities capabilities = (GLCapabilities)config.getChosenCapabilities();
GL gl = getGL();
boolean rect = gl.isGL2GL3() && capabilities.getPbufferRenderToTextureRectangle();
@@ -102,7 +135,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
}
protected boolean createImpl() throws GLException {
- DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
GLCapabilities capabilities = (GLCapabilities)config.getChosenCapabilities();
if (capabilities.getPbufferFloatingPointBuffers() &&
!isTigerOrLater) {
@@ -190,7 +223,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
class NSOpenGLImpl implements Impl {
public boolean isNSContext() { return true; }
public long create() {
- DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
GLCapabilities capabilities = (GLCapabilities)config.getChosenCapabilities();
if (capabilities.getPbufferFloatingPointBuffers() &&
!isTigerOrLater) {
@@ -254,7 +287,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
int[] attrs = new int[256];
int i = 0;
attrs[i++] = CGL.kCGLPFAPBuffer;
- DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
GLCapabilities capabilities = (GLCapabilities)config.getChosenCapabilities();
if (capabilities.getPbufferFloatingPointBuffers())
attrs[i++] = CGL.kCGLPFAColorFloat;
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java
index 64d646cfb..bc470383f 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -53,15 +54,15 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
// NSOpenGLPbuffer (for normal mode)
// CGLPbufferObj (for CGL_MODE situation, i.e., when Java2D/JOGL bridge is active)
- // Note that we can not store this in the NativeWindow because the
+ // Note that we can not store this in the NativeSurface because the
// semantic is that contains an NSView
protected long pBuffer;
- public MacOSXPbufferCGLDrawable(GLDrawableFactory factory, NativeWindow target) {
+ public MacOSXPbufferCGLDrawable(GLDrawableFactory factory, NativeSurface target) {
super(factory, target, true);
if (DEBUG) {
- System.out.println("Pbuffer config: " + getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration());
+ System.out.println("Pbuffer config: " + getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration());
}
initOpenGLImpl();
@@ -86,10 +87,10 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
public void destroy() {
if (this.pBuffer != 0) {
- NativeWindow nw = getNativeWindow();
+ NativeSurface ns = getNativeSurface();
impl.destroy(pBuffer);
this.pBuffer = 0;
- ((SurfaceChangeable)nw).setSurfaceHandle(0);
+ ((SurfaceChangeable)ns).setSurfaceHandle(0);
if (DEBUG) {
System.err.println("Destroyed pbuffer: " + pBuffer);
}
@@ -107,8 +108,8 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
}
private void createPbuffer() {
- NativeWindow nw = getNativeWindow();
- DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) nw.getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ NativeSurface ns = getNativeSurface();
+ DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) ns.getGraphicsConfiguration().getNativeGraphicsConfiguration();
GLCapabilities capabilities = (GLCapabilities)config.getChosenCapabilities();
GLProfile glProfile = capabilities.getGLProfile();
int renderTarget;
@@ -117,7 +118,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
} else {
int w = getNextPowerOf2(getWidth());
int h = getNextPowerOf2(getHeight());
- ((SurfaceChangeable)nw).setSize(w, h);
+ ((SurfaceChangeable)ns).setSize(w, h);
renderTarget = GL.GL_TEXTURE_2D;
}
@@ -148,7 +149,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
throw new GLException("pbuffer creation error: CGL.createPBuffer() failed");
}
- ((SurfaceChangeable)nw).setSurfaceHandle(pBuffer);
+ ((SurfaceChangeable)ns).setSurfaceHandle(pBuffer);
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java
index 5e3d55b04..299adec50 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -41,22 +42,22 @@ package com.jogamp.opengl.impl.windows.wgl;
import javax.media.opengl.*;
import com.jogamp.opengl.impl.*;
-import com.jogamp.nativewindow.impl.NullWindow;
+import com.jogamp.nativewindow.impl.ProxySurface;
public class WindowsDummyWGLDrawable extends WindowsWGLDrawable {
private long hwnd, hdc;
public WindowsDummyWGLDrawable(GLDrawableFactory factory, GLProfile glp) {
- super(factory, new NullWindow(WindowsWGLGraphicsConfigurationFactory.createDefaultGraphicsConfiguration(glp, null, true, true)), true);
+ super(factory, new ProxySurface(WindowsWGLGraphicsConfigurationFactory.createDefaultGraphicsConfiguration(glp, null, true, true)), true);
// All entries to CreateDummyWindow must synchronize on one object
// to avoid accidentally registering the dummy window class twice
synchronized (WindowsDummyWGLDrawable.class) {
hwnd = GDI.CreateDummyWindow(0, 0, 1, 1);
}
hdc = GDI.GetDC(hwnd);
- NullWindow nw = (NullWindow) getNativeWindow();
- nw.setSurfaceHandle(hdc);
- WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration)nw.getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ ProxySurface ns = (ProxySurface) getNativeSurface();
+ ns.setSurfaceHandle(hdc);
+ WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration)ns.getGraphicsConfiguration().getNativeGraphicsConfiguration();
// Choose a (hopefully hardware-accelerated) OpenGL pixel format for this device context
GLCapabilities caps = (GLCapabilities) config.getChosenCapabilities();
caps.setDepthBits(16);
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java
index 1f1fb0d40..9917ea901 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -42,7 +43,7 @@ package com.jogamp.opengl.impl.windows.wgl;
import javax.media.opengl.*;
import javax.media.nativewindow.*;
import com.jogamp.opengl.impl.*;
-import com.jogamp.nativewindow.impl.NullWindow;
+import com.jogamp.nativewindow.impl.ProxySurface;
public class WindowsExternalWGLContext extends WindowsWGLContext {
private boolean firstMakeCurrent = true;
@@ -77,10 +78,10 @@ public class WindowsExternalWGLContext extends WindowsWGLContext {
AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault();
WindowsWGLGraphicsConfiguration cfg = WindowsWGLGraphicsConfiguration.create(hdc, pfdID, glp, aScreen, true, true);
- NullWindow nw = new NullWindow(cfg);
- nw.setSurfaceHandle(hdc);
+ ProxySurface ns = new ProxySurface(cfg);
+ ns.setSurfaceHandle(hdc);
- return new WindowsExternalWGLContext(new Drawable(factory, nw), ctx, cfg);
+ return new WindowsExternalWGLContext(new Drawable(factory, ns), ctx, cfg);
}
public int makeCurrent() throws GLException {
@@ -114,7 +115,7 @@ public class WindowsExternalWGLContext extends WindowsWGLContext {
// Need to provide the display connection to extension querying APIs
static class Drawable extends WindowsWGLDrawable {
- Drawable(GLDrawableFactory factory, NativeWindow comp) {
+ Drawable(GLDrawableFactory factory, NativeSurface comp) {
super(factory, comp, true);
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java
index 41e469224..19fe8f03c 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -42,11 +43,11 @@ package com.jogamp.opengl.impl.windows.wgl;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
import com.jogamp.opengl.impl.*;
-import com.jogamp.nativewindow.impl.NullWindow;
+import com.jogamp.nativewindow.impl.ProxySurface;
public class WindowsExternalWGLDrawable extends WindowsWGLDrawable {
- private WindowsExternalWGLDrawable(GLDrawableFactory factory, NativeWindow component) {
+ private WindowsExternalWGLDrawable(GLDrawableFactory factory, NativeSurface component) {
super(factory, component, true);
}
@@ -63,12 +64,12 @@ public class WindowsExternalWGLDrawable extends WindowsWGLDrawable {
AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault();
WindowsWGLGraphicsConfiguration cfg = WindowsWGLGraphicsConfiguration.create(hdc, pfdID, glp, aScreen, true, true);
- NullWindow nw = new NullWindow(cfg);
- nw.setSurfaceHandle(hdc);
+ ProxySurface ns = new ProxySurface(cfg);
+ ns.setSurfaceHandle(hdc);
- cfg.updateGraphicsConfiguration(factory, nw);
+ cfg.updateGraphicsConfiguration(factory, ns);
- return new WindowsExternalWGLDrawable(factory, nw);
+ return new WindowsExternalWGLDrawable(factory, ns);
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java
index 8079cd42a..ea02a4919 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -42,13 +43,12 @@ package com.jogamp.opengl.impl.windows.wgl;
import javax.media.opengl.*;
import javax.media.nativewindow.*;
import com.jogamp.opengl.impl.*;
-import com.jogamp.nativewindow.impl.NullWindow;
public class WindowsOffscreenWGLDrawable extends WindowsWGLDrawable {
private long origbitmap;
private long hbitmap;
- public WindowsOffscreenWGLDrawable(GLDrawableFactory factory, NativeWindow target) {
+ public WindowsOffscreenWGLDrawable(GLDrawableFactory factory, NativeSurface target) {
super(factory, target, true);
create();
}
@@ -66,8 +66,8 @@ public class WindowsOffscreenWGLDrawable extends WindowsWGLDrawable {
}
private void create() {
- NativeWindow nw = getNativeWindow();
- WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration)nw.getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ NativeSurface ns = getNativeSurface();
+ WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration)ns.getGraphicsConfiguration().getNativeGraphicsConfiguration();
GLCapabilities capabilities = (GLCapabilities)config.getRequestedCapabilities();
int width = getWidth();
int height = getHeight();
@@ -97,7 +97,7 @@ public class WindowsOffscreenWGLDrawable extends WindowsWGLDrawable {
System.out.println("LastError: " + GDI.GetLastError());
throw new GLException("Error creating device context for offscreen OpenGL context");
}
- ((SurfaceChangeable)nw).setSurfaceHandle(hdc);
+ ((SurfaceChangeable)ns).setSurfaceHandle(hdc);
hbitmap = GDI.CreateDIBSection(hdc, info, GDI.DIB_RGB_COLORS, null, 0, 0);
if (hbitmap == 0) {
@@ -114,19 +114,19 @@ public class WindowsOffscreenWGLDrawable extends WindowsWGLDrawable {
throw new GLException("Error selecting bitmap into new device context");
}
- config.updateGraphicsConfiguration(getFactory(), nw);
+ config.updateGraphicsConfiguration(getFactory(), ns);
}
public void destroy() {
- NativeWindow nw = getNativeWindow();
- if (nw.getSurfaceHandle() != 0) {
+ NativeSurface ns = getNativeSurface();
+ if (ns.getSurfaceHandle() != 0) {
// Must destroy bitmap and device context
- GDI.SelectObject(nw.getSurfaceHandle(), origbitmap);
+ GDI.SelectObject(ns.getSurfaceHandle(), origbitmap);
GDI.DeleteObject(hbitmap);
- GDI.DeleteDC(nw.getSurfaceHandle());
+ GDI.DeleteDC(ns.getSurfaceHandle());
origbitmap = 0;
hbitmap = 0;
- ((SurfaceChangeable)nw).setSurfaceHandle(0);
+ ((SurfaceChangeable)ns).setSurfaceHandle(0);
}
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOnscreenWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOnscreenWGLDrawable.java
index 401b8c3c6..b0d62a4e1 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOnscreenWGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOnscreenWGLDrawable.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -44,7 +45,7 @@ import javax.media.opengl.*;
import com.jogamp.opengl.impl.*;
public class WindowsOnscreenWGLDrawable extends WindowsWGLDrawable {
- protected WindowsOnscreenWGLDrawable(GLDrawableFactory factory, NativeWindow component) {
+ protected WindowsOnscreenWGLDrawable(GLDrawableFactory factory, NativeSurface component) {
super(factory, component, false);
}
@@ -52,12 +53,4 @@ public class WindowsOnscreenWGLDrawable extends WindowsWGLDrawable {
return new WindowsOnscreenWGLContext(this, shareWith);
}
- public int getWidth() {
- return component.getWidth();
- }
-
- public int getHeight() {
- return component.getHeight();
- }
-
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java
index c8c62914a..5708aa6bb 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -51,16 +52,16 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
private int floatMode;
- public WindowsPbufferWGLDrawable(GLDrawableFactory factory, NativeWindow target,
+ public WindowsPbufferWGLDrawable(GLDrawableFactory factory, NativeSurface target,
WindowsWGLDrawable dummyDrawable,
WGLExt wglExt) {
super(factory, target, true);
if (DEBUG) {
- System.out.println("Pbuffer config: " + getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration());
+ System.out.println("Pbuffer config: " + getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration());
}
- createPbuffer(dummyDrawable.getNativeWindow().getSurfaceHandle(), wglExt);
+ createPbuffer(dummyDrawable.getNativeSurface().getSurfaceHandle(), wglExt);
if (DEBUG) {
System.err.println("Created pbuffer " + this);
@@ -80,18 +81,18 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
}
public void destroy() {
- NativeWindow nw = getNativeWindow();
+ NativeSurface ns = getNativeSurface();
if(0!=buffer) {
WGLExt wglExt = cachedWGLExt;
- if (nw.getSurfaceHandle() != 0) {
+ if (ns.getSurfaceHandle() != 0) {
// Must release DC and pbuffer
// NOTE that since the context is not current, glGetError() can
// not be called here, so we skip the use of any composable
// pipelines (see WindowsOnscreenWGLContext.makeCurrentImpl)
- if (wglExt.wglReleasePbufferDCARB(buffer, nw.getSurfaceHandle()) == 0) {
+ if (wglExt.wglReleasePbufferDCARB(buffer, ns.getSurfaceHandle()) == 0) {
throw new GLException("Error releasing pbuffer device context: error code " + GDI.GetLastError());
}
- ((SurfaceChangeable)nw).setSurfaceHandle(0);
+ ((SurfaceChangeable)ns).setSurfaceHandle(0);
}
if (!wglExt.wglDestroyPbufferARB(buffer)) {
throw new GLException("Error destroying pbuffer: error code " + GDI.GetLastError());
@@ -102,7 +103,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
public long getPbufferHandle() {
// The actual to-be-used handle for makeCurrent etc,
- // is the derived DC, set in the NativeWindow surfaceHandle
+ // is the derived DC, set in the NativeSurface surfaceHandle
// returned by getHandle().
return buffer;
}
@@ -124,7 +125,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
int niattribs = 0;
int width, height;
- WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration) getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration) getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
GLCapabilities capabilities = (GLCapabilities)config.getRequestedCapabilities();
GLProfile glProfile = capabilities.getGLProfile();
@@ -265,10 +266,10 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
throw new GLException("pbuffer creation error: wglGetPbufferDC() failed");
}
- NativeWindow nw = getNativeWindow();
+ NativeSurface ns = getNativeSurface();
// Set up instance variables
buffer = tmpBuffer;
- ((SurfaceChangeable)nw).setSurfaceHandle(tmpHdc);
+ ((SurfaceChangeable)ns).setSurfaceHandle(tmpHdc);
cachedWGLExt = wglExt;
cachedParentHdc = parentHdc;
@@ -324,7 +325,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
width = tmp[0];
wglExt.wglQueryPbufferARB( buffer, WGLExt.WGL_PBUFFER_HEIGHT_ARB, tmp, 0 );
height = tmp[0];
- ((SurfaceChangeable)nw).setSize(width, height);
+ ((SurfaceChangeable)ns).setSize(width, height);
}
private static String wglGetLastError() {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java
index 33f1bc829..c80e46cc2 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -306,7 +307,7 @@ public class WindowsWGLContext extends GLContextImpl {
if (newCreated) {
WindowsWGLGraphicsConfiguration config =
- (WindowsWGLGraphicsConfiguration)drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ (WindowsWGLGraphicsConfiguration)drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
config.updateCapabilitiesByWGL(this);
}
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java
index b1bc9b5ce..9fef457db 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -55,7 +56,7 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl {
private long profilingSwapBuffersTime;
- public WindowsWGLDrawable(GLDrawableFactory factory, NativeWindow comp, boolean realized) {
+ public WindowsWGLDrawable(GLDrawableFactory factory, NativeSurface comp, boolean realized) {
super(factory, comp, realized);
}
@@ -64,9 +65,9 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl {
return; // nothing todo ..
}
- NativeWindow nativeWindow = getNativeWindow();
- WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration)nativeWindow.getGraphicsConfiguration().getNativeGraphicsConfiguration();
- config.updateGraphicsConfiguration(getFactory(), nativeWindow);
+ NativeSurface ns = getNativeSurface();
+ WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration)ns.getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ config.updateGraphicsConfiguration(getFactory(), ns);
if (DEBUG) {
System.err.println("!!! WindowsWGLDrawable.setRealized(true): "+config);
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java
index 85444b61c..08cee4dab 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -47,7 +48,7 @@ import javax.media.opengl.*;
import com.jogamp.common.JogampRuntimeException;
import com.jogamp.common.util.*;
import com.jogamp.opengl.impl.*;
-import com.jogamp.nativewindow.impl.NullWindow;
+import com.jogamp.nativewindow.impl.ProxySurface;
public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
private static final boolean VERBOSE = Debug.verbose();
@@ -134,14 +135,14 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
}
}
- public GLDrawableImpl createOnscreenDrawable(NativeWindow target) {
+ public GLDrawableImpl createOnscreenDrawable(NativeSurface target) {
if (target == null) {
throw new IllegalArgumentException("Null target");
}
return new WindowsOnscreenWGLDrawable(this, target);
}
- protected GLDrawableImpl createOffscreenDrawable(NativeWindow target) {
+ protected GLDrawableImpl createOffscreenDrawable(NativeSurface target) {
if (target == null) {
throw new IllegalArgumentException("Null target");
}
@@ -152,7 +153,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
return canCreateGLPbuffer;
}
- protected GLDrawableImpl createGLPbufferDrawableImpl(final NativeWindow target) {
+ protected GLDrawableImpl createGLPbufferDrawableImpl(final NativeSurface target) {
if (target == null) {
throw new IllegalArgumentException("Null target");
}
@@ -185,12 +186,12 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
return (GLDrawableImpl) returnList.get(0);
}
- protected NativeWindow createOffscreenWindow(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) {
+ protected NativeSurface createOffscreenSurface(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) {
AbstractGraphicsScreen screen = DefaultGraphicsScreen.createDefault();
- NullWindow nw = new NullWindow(WindowsWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(
- capabilities, chooser, screen) );
- nw.setSize(width, height);
- return nw;
+ ProxySurface ns = new ProxySurface(WindowsWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(
+ capabilities, chooser, screen) );
+ ns.setSize(width, height);
+ return ns;
}
public GLContext createExternalGLContext() {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java
index eb5719566..8744b7a37 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -86,8 +87,8 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
}
/** Update config - before having a valid context */
- protected void updateGraphicsConfiguration(GLDrawableFactory factory, NativeWindow nativeWindow) {
- WindowsWGLGraphicsConfigurationFactory.updateGraphicsConfiguration(chooser, factory, nativeWindow);
+ protected void updateGraphicsConfiguration(GLDrawableFactory factory, NativeSurface ns) {
+ WindowsWGLGraphicsConfigurationFactory.updateGraphicsConfiguration(chooser, factory, ns);
}
/** Update config - after having a valid and current context */
@@ -101,8 +102,8 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
WGLExt wglExt = (WGLExt) context.getPlatformGLExtensions();
GLDrawable drawable = context.getGLDrawable();
- NativeWindow nativeWindow = drawable.getNativeWindow();
- long hdc = nativeWindow.getSurfaceHandle();
+ NativeSurface ns = drawable.getNativeSurface();
+ long hdc = ns.getSurfaceHandle();
GLCapabilities[] caps = HDC2GLCapabilities(wglExt, hdc, getPixelFormatID(), glp, true, onscreen, usePBuffer);
if(null!=caps && null!=caps[0]) {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
index e76e63f23..fd5a174c8 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -87,10 +88,10 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
}
protected static void updateGraphicsConfiguration(CapabilitiesChooser chooser,
- GLDrawableFactory _factory, NativeWindow nativeWindow) {
+ GLDrawableFactory _factory, NativeSurface ns) {
WindowsWGLDrawableFactory factory = (WindowsWGLDrawableFactory) _factory;
- if (nativeWindow == null) {
- throw new IllegalArgumentException("NativeWindow is null");
+ if (ns == null) {
+ throw new IllegalArgumentException("NativeSurface is null");
}
if (chooser != null &&
@@ -99,17 +100,17 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
}
boolean choosenBywGLPixelFormat = false;
- WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration) nativeWindow.getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration) ns.getGraphicsConfiguration().getNativeGraphicsConfiguration();
GLCapabilities capabilities = (GLCapabilities) config.getRequestedCapabilities();
boolean onscreen = capabilities.isOnscreen();
boolean usePBuffer = capabilities.isPBuffer();
GLProfile glProfile = capabilities.getGLProfile();
- long hdc = nativeWindow.getSurfaceHandle();
+ long hdc = ns.getSurfaceHandle();
if (DEBUG) {
Exception ex = new Exception("WindowsWGLGraphicsConfigurationFactory got HDC "+toHexString(hdc));
ex.printStackTrace();
- System.err.println("WindowsWGLGraphicsConfigurationFactory got NW "+nativeWindow);
+ System.err.println("WindowsWGLGraphicsConfigurationFactory got NW "+ns);
}
PIXELFORMATDESCRIPTOR pfd = null;
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11DummyGLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11DummyGLXDrawable.java
index 475f413ba..690bc4b52 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11DummyGLXDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11DummyGLXDrawable.java
@@ -45,12 +45,12 @@ public class X11DummyGLXDrawable extends X11OnscreenGLXDrawable {
*/
public X11DummyGLXDrawable(X11GraphicsScreen screen, GLDrawableFactory factory, GLProfile glp) {
super(factory,
- new NullWindow(X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(
+ new ProxySurface(X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(
new GLCapabilities(glp), null, screen)));
this.realized = true;
- NullWindow nw = (NullWindow) getNativeWindow();
- X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)nw.getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ ProxySurface ns = (ProxySurface) getNativeSurface();
+ X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)ns.getGraphicsConfiguration().getNativeGraphicsConfiguration();
X11GraphicsDevice device = (X11GraphicsDevice) screen.getDevice();
long dpy = device.getHandle();
@@ -58,7 +58,7 @@ public class X11DummyGLXDrawable extends X11OnscreenGLXDrawable {
long visualID = config.getVisualID();
dummyWindow = X11Lib.CreateDummyWindow(dpy, scrn, visualID);
- nw.setSurfaceHandle( dummyWindow );
+ ns.setSurfaceHandle( dummyWindow );
updateHandle();
}
@@ -77,7 +77,7 @@ public class X11DummyGLXDrawable extends X11OnscreenGLXDrawable {
public void destroy() {
if(0!=dummyWindow) {
destroyHandle();
- X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
X11Lib.DestroyDummyWindow(config.getScreen().getDevice().getHandle(), dummyWindow);
}
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXContext.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXContext.java
index 550bde761..76f7f6591 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXContext.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -43,7 +44,7 @@ import javax.media.nativewindow.*;
import javax.media.nativewindow.x11.*;
import javax.media.opengl.*;
import com.jogamp.opengl.impl.*;
-import com.jogamp.nativewindow.impl.NullWindow;
+import com.jogamp.nativewindow.impl.ProxySurface;
public class X11ExternalGLXContext extends X11GLXContext {
private boolean firstMakeCurrent = true;
@@ -77,9 +78,9 @@ public class X11ExternalGLXContext extends X11GLXContext {
GLX.glXQueryContext(display, ctx, GLX.GLX_FBCONFIG_ID, val, 0);
X11GLXGraphicsConfiguration cfg = X11GLXGraphicsConfiguration.create(glp, x11Screen, val[0]);
- NullWindow nw = new NullWindow(cfg);
- nw.setSurfaceHandle(drawable);
- return new X11ExternalGLXContext(new Drawable(factory, nw), ctx);
+ ProxySurface ns = new ProxySurface(cfg);
+ ns.setSurfaceHandle(drawable);
+ return new X11ExternalGLXContext(new Drawable(factory, ns), ctx);
}
protected boolean createImpl() {
@@ -117,7 +118,7 @@ public class X11ExternalGLXContext extends X11GLXContext {
// Need to provide the display connection to extension querying APIs
static class Drawable extends X11GLXDrawable {
- Drawable(GLDrawableFactory factory, NativeWindow comp) {
+ Drawable(GLDrawableFactory factory, NativeSurface comp) {
super(factory, comp, true);
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXDrawable.java
index d930179df..b83703ef1 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXDrawable.java
@@ -42,13 +42,13 @@ package com.jogamp.opengl.impl.x11.glx;
import javax.media.nativewindow.*;
import javax.media.nativewindow.x11.*;
import javax.media.opengl.*;
-import com.jogamp.nativewindow.impl.NullWindow;
+import com.jogamp.nativewindow.impl.ProxySurface;
public class X11ExternalGLXDrawable extends X11GLXDrawable {
- private X11ExternalGLXDrawable(GLDrawableFactory factory, NativeWindow component) {
- super(factory, component, true);
+ private X11ExternalGLXDrawable(GLDrawableFactory factory, NativeSurface surface) {
+ super(factory, surface, true);
}
protected static X11ExternalGLXDrawable create(GLDrawableFactory factory, GLProfile glp) {
@@ -83,10 +83,10 @@ public class X11ExternalGLXDrawable extends X11GLXDrawable {
System.err.println("X11ExternalGLXDrawable: WARNING: forcing GLX_RGBA_TYPE for newly created contexts (current 0x"+Integer.toHexString(val[0])+")");
}
}
- NullWindow nw = new NullWindow(cfg);
- nw.setSurfaceHandle(drawable);
- nw.setSize(w, h);
- return new X11ExternalGLXDrawable(factory, nw);
+ ProxySurface ns = new ProxySurface(cfg);
+ ns.setSurfaceHandle(drawable);
+ ns.setSize(w, h);
+ return new X11ExternalGLXDrawable(factory, ns);
}
public GLContext createContext(GLContext shareWith) {
@@ -97,14 +97,6 @@ public class X11ExternalGLXDrawable extends X11GLXDrawable {
throw new GLException("Should not call this");
}
- public int getWidth() {
- return getNativeWindow().getWidth();
- }
-
- public int getHeight() {
- return getNativeWindow().getHeight();
- }
-
class Context extends X11GLXContext {
Context(X11GLXDrawable drawable, GLContext shareWith) {
super(drawable, shareWith);
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java
index 90650bde9..494860c5b 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -130,7 +131,7 @@ public abstract class X11GLXContext extends GLContextImpl {
}
protected void destroyContextARBImpl(long ctx) {
- X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
long display = config.getScreen().getDevice().getHandle();
glXMakeContextCurrent(display, 0, 0, 0);
@@ -139,7 +140,7 @@ public abstract class X11GLXContext extends GLContextImpl {
protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) {
X11GLXDrawableFactory factory = (X11GLXDrawableFactory)drawable.getFactoryImpl();
- X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
long display = config.getScreen().getDevice().getHandle();
GLXExt glXExt;
@@ -215,7 +216,7 @@ public abstract class X11GLXContext extends GLContextImpl {
protected boolean createContext(boolean direct) {
isDirect = false; // default
X11GLXDrawableFactory factory = (X11GLXDrawableFactory)drawable.getFactoryImpl();
- X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
long display = config.getScreen().getDevice().getHandle();
X11GLXContext other = (X11GLXContext) GLContextShareSet.getShareContext(this);
@@ -328,7 +329,7 @@ public abstract class X11GLXContext extends GLContextImpl {
}
protected void makeCurrentImpl(boolean newCreated) throws GLException {
- long dpy = drawable.getNativeWindow().getDisplayHandle();
+ long dpy = drawable.getNativeSurface().getDisplayHandle();
if (GLX.glXGetCurrentContext() != contextHandle) {
if (!glXMakeContextCurrent(dpy, drawable.getHandle(), drawableRead.getHandle(), contextHandle)) {
@@ -345,14 +346,14 @@ public abstract class X11GLXContext extends GLContextImpl {
}
protected void releaseImpl() throws GLException {
- long display = drawable.getNativeWindow().getDisplayHandle();
+ long display = drawable.getNativeSurface().getDisplayHandle();
if (!glXMakeContextCurrent(display, 0, 0, 0)) {
throw new GLException("Error freeing OpenGL context");
}
}
protected void destroyImpl() throws GLException {
- long display = drawable.getNativeWindow().getDisplayHandle();
+ long display = drawable.getNativeSurface().getDisplayHandle();
if (DEBUG) {
System.err.println("glXDestroyContext(dpy " +
toHexString(display)+
@@ -368,7 +369,7 @@ public abstract class X11GLXContext extends GLContextImpl {
protected void copyImpl(GLContext source, int mask) throws GLException {
long dst = getHandle();
long src = source.getHandle();
- long display = drawable.getNativeWindow().getDisplayHandle();
+ long display = drawable.getNativeSurface().getDisplayHandle();
if (0 == display) {
throw new GLException("Connection to X display not yet set up");
}
@@ -399,8 +400,8 @@ public abstract class X11GLXContext extends GLContextImpl {
glXQueryExtensionsStringInitialized = true;
}
if (glXQueryExtensionsStringAvailable) {
- NativeWindow nw = drawable.getNativeWindow();
- String ret = GLX.glXQueryExtensionsString(nw.getDisplayHandle(), nw.getScreenIndex());
+ NativeSurface ns = drawable.getNativeSurface();
+ String ret = GLX.glXQueryExtensionsString(ns.getDisplayHandle(), ns.getScreenIndex());
if (DEBUG) {
System.err.println("!!! GLX extensions: " + ret);
}
@@ -414,7 +415,7 @@ public abstract class X11GLXContext extends GLContextImpl {
if (glExtensionName.equals("GL_ARB_pbuffer") ||
glExtensionName.equals("GL_ARB_pixel_format")) {
return getGLDrawable().getFactory().canCreateGLPbuffer(
- drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration().getScreen().getDevice() );
+ drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration().getScreen().getDevice() );
}
return super.isExtensionAvailable(glExtensionName);
}
@@ -423,7 +424,7 @@ public abstract class X11GLXContext extends GLContextImpl {
private int hasSwapIntervalSGI = 0;
protected void setSwapIntervalImpl(int interval) {
- X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
GLCapabilities glCaps = (GLCapabilities) config.getChosenCapabilities();
if(!glCaps.isOnscreen()) return;
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawable.java
index 8547471fb..9c3737d3d 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawable.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -44,7 +45,7 @@ import javax.media.opengl.*;
import com.jogamp.opengl.impl.*;
public abstract class X11GLXDrawable extends GLDrawableImpl {
- protected X11GLXDrawable(GLDrawableFactory factory, NativeWindow comp, boolean realized) {
+ protected X11GLXDrawable(GLDrawableFactory factory, NativeSurface comp, boolean realized) {
super(factory, comp, realized);
}
@@ -54,7 +55,7 @@ public abstract class X11GLXDrawable extends GLDrawableImpl {
protected void setRealizedImpl() {
if(realized) {
- X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
config.updateGraphicsConfiguration();
if (DEBUG) {
@@ -64,7 +65,7 @@ public abstract class X11GLXDrawable extends GLDrawableImpl {
}
protected void swapBuffersImpl() {
- GLX.glXSwapBuffers(getNativeWindow().getDisplayHandle(), getHandle());
+ GLX.glXSwapBuffers(getNativeSurface().getDisplayHandle(), getHandle());
}
//---------------------------------------------------------------------------
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java
index 98be19263..2ae53fb9d 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -44,7 +45,7 @@ import javax.media.opengl.*;
import com.jogamp.opengl.impl.*;
import com.jogamp.common.JogampRuntimeException;
import com.jogamp.common.util.*;
-import com.jogamp.nativewindow.impl.NullWindow;
+import com.jogamp.nativewindow.impl.ProxySurface;
import com.jogamp.nativewindow.impl.x11.*;
public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
@@ -164,14 +165,14 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
X11Util.shutdown( false, DEBUG );
}
- public GLDrawableImpl createOnscreenDrawable(NativeWindow target) {
+ public GLDrawableImpl createOnscreenDrawable(NativeSurface target) {
if (target == null) {
throw new IllegalArgumentException("Null target");
}
return new X11OnscreenGLXDrawable(this, target);
}
- protected GLDrawableImpl createOffscreenDrawable(NativeWindow target) {
+ protected GLDrawableImpl createOffscreenDrawable(NativeSurface target) {
if (target == null) {
throw new IllegalArgumentException("Null target");
}
@@ -209,7 +210,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
return ( glxVersionMajor > majorReq ) || ( glxVersionMajor == majorReq && glxVersionMinor >= minorReq ) ;
}
- protected GLDrawableImpl createGLPbufferDrawableImpl(final NativeWindow target) {
+ protected GLDrawableImpl createGLPbufferDrawableImpl(final NativeSurface target) {
if (target == null) {
throw new IllegalArgumentException("Null target");
}
@@ -238,12 +239,12 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
- protected NativeWindow createOffscreenWindow(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) {
- NullWindow nw = new NullWindow(X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capabilities, chooser, sharedScreen));
- if(nw != null) {
- nw.setSize(width, height);
+ protected NativeSurface createOffscreenSurface(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) {
+ ProxySurface ns = new ProxySurface(X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capabilities, chooser, sharedScreen));
+ if(ns != null) {
+ ns.setSize(width, height);
}
- return nw;
+ return ns;
}
public GLContext createExternalGLContext() {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java
index 6f24d5a60..bde65f3bb 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -54,7 +55,7 @@ public class X11OffscreenGLXContext extends X11GLXContext {
}
public int getOffscreenContextReadBuffer() {
- GLCapabilities caps = (GLCapabilities)drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
+ GLCapabilities caps = (GLCapabilities)drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
if (caps.getDoubleBuffered()) {
return GL.GL_BACK;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java
index 230387c1c..3be34eb6a 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -46,7 +47,7 @@ import com.jogamp.nativewindow.impl.x11.*;
public class X11OffscreenGLXDrawable extends X11GLXDrawable {
private long pixmap;
- protected X11OffscreenGLXDrawable(GLDrawableFactory factory, NativeWindow target) {
+ protected X11OffscreenGLXDrawable(GLDrawableFactory factory, NativeSurface target) {
super(factory, target, true);
create();
}
@@ -64,8 +65,8 @@ public class X11OffscreenGLXDrawable extends X11GLXDrawable {
}
private void create() {
- NativeWindow nw = getNativeWindow();
- X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration) nw.getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ NativeSurface ns = getNativeSurface();
+ X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration) ns.getGraphicsConfiguration().getNativeGraphicsConfiguration();
XVisualInfo vis = config.getXVisualInfo();
int bitsPerPixel = vis.getDepth();
AbstractGraphicsScreen aScreen = config.getScreen();
@@ -74,7 +75,7 @@ public class X11OffscreenGLXDrawable extends X11GLXDrawable {
int screen = aScreen.getIndex();
pixmap = X11Lib.XCreatePixmap(dpy, X11Lib.RootWindow(dpy, screen),
- component.getWidth(), component.getHeight(), bitsPerPixel);
+ surface.getWidth(), surface.getHeight(), bitsPerPixel);
if (pixmap == 0) {
throw new GLException("XCreatePixmap failed");
}
@@ -84,7 +85,7 @@ public class X11OffscreenGLXDrawable extends X11GLXDrawable {
pixmap = 0;
throw new GLException("glXCreateGLXPixmap failed");
}
- ((SurfaceChangeable)nw).setSurfaceHandle(drawable);
+ ((SurfaceChangeable)ns).setSurfaceHandle(drawable);
if (DEBUG) {
System.err.println("Created pixmap " + toHexString(pixmap) +
", GLXPixmap " + toHexString(drawable) +
@@ -95,10 +96,10 @@ public class X11OffscreenGLXDrawable extends X11GLXDrawable {
public void destroy() {
if (pixmap == 0) return;
- NativeWindow nw = getNativeWindow();
- long display = nw.getDisplayHandle();
+ NativeSurface ns = getNativeSurface();
+ long display = ns.getDisplayHandle();
- long drawable = nw.getSurfaceHandle();
+ long drawable = ns.getSurfaceHandle();
if (DEBUG) {
System.err.println("Destroying pixmap " + toHexString(pixmap) +
", GLXPixmap " + toHexString(drawable) +
@@ -124,7 +125,7 @@ public class X11OffscreenGLXDrawable extends X11GLXDrawable {
X11Lib.XFreePixmap(display, pixmap);
drawable = 0;
pixmap = 0;
- ((SurfaceChangeable)nw).setSurfaceHandle(0);
+ ((SurfaceChangeable)ns).setSurfaceHandle(0);
display = 0;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java
index 3a8bbfecc..5243e8c46 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -48,7 +49,7 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable {
long glXWindow; // GLXWindow, a GLXDrawable representation
boolean useGLXWindow;
- protected X11OnscreenGLXDrawable(GLDrawableFactory factory, NativeWindow component) {
+ protected X11OnscreenGLXDrawable(GLDrawableFactory factory, NativeSurface component) {
super(factory, component, false);
glXWindow=0;
useGLXWindow=false;
@@ -58,12 +59,12 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable {
if(useGLXWindow) {
return glXWindow;
}
- return getNativeWindow().getSurfaceHandle();
+ return getNativeSurface().getSurfaceHandle();
}
protected void destroyHandle() {
if(0!=glXWindow) {
- GLX.glXDestroyWindow(getNativeWindow().getDisplayHandle(), glXWindow);
+ GLX.glXDestroyWindow(getNativeSurface().getDisplayHandle(), glXWindow);
glXWindow = 0;
useGLXWindow=false;
}
@@ -72,16 +73,16 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable {
/** must be locked already */
protected void updateHandle() {
if(USE_GLXWINDOW) {
- X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
if(config.getFBConfig()>=0) {
useGLXWindow=true;
- long dpy = getNativeWindow().getDisplayHandle();
+ long dpy = getNativeSurface().getDisplayHandle();
if(0!=glXWindow) {
GLX.glXDestroyWindow(dpy, glXWindow);
}
- glXWindow = GLX.glXCreateWindow(dpy, config.getFBConfig(), getNativeWindow().getSurfaceHandle(), null, 0);
+ glXWindow = GLX.glXCreateWindow(dpy, config.getFBConfig(), getNativeSurface().getSurfaceHandle(), null, 0);
if (DEBUG) {
- System.err.println("!!! X11OnscreenGLXDrawable.setRealized(true): glXWindow: "+toHexString(getNativeWindow().getSurfaceHandle())+" -> "+toHexString(glXWindow));
+ System.err.println("!!! X11OnscreenGLXDrawable.setRealized(true): glXWindow: "+toHexString(getNativeSurface().getSurfaceHandle())+" -> "+toHexString(glXWindow));
}
if(0==glXWindow) {
throw new GLException("X11OnscreenGLXDrawable.setRealized(true): GLX.glXCreateWindow() failed: "+this);
@@ -93,12 +94,4 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable {
public GLContext createContext(GLContext shareWith) {
return new X11OnscreenGLXContext(this, shareWith);
}
-
- public int getWidth() {
- return component.getWidth();
- }
-
- public int getHeight() {
- return component.getHeight();
- }
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXDrawable.java
index c00f9909e..ce9e6d75d 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXDrawable.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -43,14 +44,14 @@ import javax.media.opengl.*;
import javax.media.nativewindow.*;
public class X11PbufferGLXDrawable extends X11GLXDrawable {
- protected X11PbufferGLXDrawable(GLDrawableFactory factory, NativeWindow target) {
+ protected X11PbufferGLXDrawable(GLDrawableFactory factory, NativeSurface target) {
/* GLCapabilities caps,
GLCapabilitiesChooser chooser,
int width, int height */
super(factory, target, true);
if (DEBUG) {
- System.out.println("Pbuffer config: " + getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration());
+ System.out.println("Pbuffer config: " + getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration());
}
createPbuffer();
@@ -73,15 +74,15 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable {
}
public void destroy() {
- NativeWindow nw = getNativeWindow();
- if (nw.getSurfaceHandle() != 0) {
- GLX.glXDestroyPbuffer(nw.getDisplayHandle(), nw.getSurfaceHandle());
+ NativeSurface ns = getNativeSurface();
+ if (ns.getSurfaceHandle() != 0) {
+ GLX.glXDestroyPbuffer(ns.getDisplayHandle(), ns.getSurfaceHandle());
}
- ((SurfaceChangeable)nw).setSurfaceHandle(0);
+ ((SurfaceChangeable)ns).setSurfaceHandle(0);
}
private void createPbuffer() {
- X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration) getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration) getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
AbstractGraphicsScreen aScreen = config.getScreen();
AbstractGraphicsDevice aDevice = aScreen.getDevice();
long display = aDevice.getHandle();
@@ -91,7 +92,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable {
throw new GLException("Null display");
}
- NativeWindow nw = getNativeWindow();
+ NativeSurface ns = getNativeSurface();
GLCapabilities capabilities = (GLCapabilities)config.getChosenCapabilities();
@@ -108,9 +109,9 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable {
int[] iattributes = new int[5];
iattributes[niattribs++] = GLX.GLX_PBUFFER_WIDTH;
- iattributes[niattribs++] = nw.getWidth();
+ iattributes[niattribs++] = ns.getWidth();
iattributes[niattribs++] = GLX.GLX_PBUFFER_HEIGHT;
- iattributes[niattribs++] = nw.getHeight();
+ iattributes[niattribs++] = ns.getHeight();
iattributes[niattribs++] = 0;
long pbuffer = GLX.glXCreatePbuffer(display, config.getFBConfig(), iattributes, 0);
@@ -120,7 +121,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable {
}
// Set up instance variables
- ((SurfaceChangeable)nw).setSurfaceHandle(pbuffer);
+ ((SurfaceChangeable)ns).setSurfaceHandle(pbuffer);
// Determine the actual width and height we were able to create.
int[] tmp = new int[1];
@@ -128,7 +129,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable {
int width = tmp[0];
GLX.glXQueryDrawable(display, pbuffer, GLX.GLX_HEIGHT, tmp, 0);
int height = tmp[0];
- ((SurfaceChangeable)nw).setSize(width, height);
+ ((SurfaceChangeable)ns).setSize(width, height);
}
public int getFloatingPointMode() {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/Animator.java b/src/jogl/classes/com/jogamp/opengl/util/Animator.java
index 5d48405e2..2b8876a91 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/Animator.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/Animator.java
@@ -197,6 +197,7 @@ public class Animator extends AnimatorBase {
if (runnable == null) {
runnable = new MainLoop();
}
+ resetCounter();
int id;
String threadName = Thread.currentThread().getName()+"-"+baseName;
if(null==threadGroup) {
@@ -272,6 +273,7 @@ public class Animator extends AnimatorBase {
}
}
}
+ resetCounter();
}
protected final boolean getShouldPause() {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java
index 279fe33ef..a54f6be57 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java
@@ -49,9 +49,9 @@ public abstract class AnimatorBase implements GLAnimatorControl {
protected Thread thread;
protected boolean ignoreExceptions;
protected boolean printExceptions;
- protected long startTime = 0;
- protected long curTime = 0;
- protected int totalFrames = 0;
+ protected long startTime;
+ protected long curTime;
+ protected int totalFrames;
/** Creates a new, empty Animator. */
public AnimatorBase() {
@@ -69,6 +69,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
animatorCount++;
baseName = baseName.concat("-"+animatorCount);
}
+ resetCounter();
}
protected abstract String getBaseName(String prefix);
@@ -112,10 +113,6 @@ public abstract class AnimatorBase implements GLAnimatorControl {
return curTime - startTime;
}
- protected abstract boolean getShouldPause();
-
- protected abstract boolean getShouldStop();
-
public long getStartTime() {
return startTime;
}
@@ -124,6 +121,12 @@ public abstract class AnimatorBase implements GLAnimatorControl {
return totalFrames;
}
+ public synchronized void resetCounter() {
+ startTime = System.currentTimeMillis(); // overwrite startTime to real init one
+ curTime = startTime;
+ totalFrames = 0;
+ }
+
public final synchronized Thread getThread() {
return thread;
}
@@ -142,4 +145,12 @@ public abstract class AnimatorBase implements GLAnimatorControl {
public void setPrintExceptions(boolean printExceptions) {
this.printExceptions = printExceptions;
}
+
+ public String toString() {
+ return getClass().getName()+"[started "+isStarted()+", animating "+isAnimating()+", paused "+isPaused()+", frames "+getTotalFrames()+"]";
+ }
+
+ protected abstract boolean getShouldPause();
+
+ protected abstract boolean getShouldStop();
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java
index d098cf1a3..8542000c6 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java
@@ -88,11 +88,6 @@ public class FPSAnimator extends AnimatorBase {
this.scheduleAtFixedRate = scheduleAtFixedRate;
}
- public long getStartTime() { return startTime; }
- public long getCurrentTime() { return curTime; }
- public long getDuration() { return curTime-startTime; }
- public int getTotalFrames() { return totalFrames; }
-
public final synchronized boolean isStarted() {
return (timer != null);
}
@@ -116,9 +111,7 @@ public class FPSAnimator extends AnimatorBase {
}
};
- startTime = System.currentTimeMillis();
- curTime = startTime;
- totalFrames = 0;
+ resetCounter();
shouldRun = true;
if (scheduleAtFixedRate) {