aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java12
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java14
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java34
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java30
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java40
5 files changed, 63 insertions, 67 deletions
diff --git a/src/jogl/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java b/src/jogl/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java
index 4597a5078..a2d0e0150 100644
--- a/src/jogl/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java
+++ b/src/jogl/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java
@@ -73,12 +73,10 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
} else {
if(caps.isPBuffer() && canCreateGLPbuffer()) {
// PBUFFER
- result = createGLPbuffer(caps,
+ result = createGLPbufferDrawable(caps,
null /* GLCapabilitiesChooser */,
target.getWidth(),
- target.getHeight(),
- null /* shareContext */ ) ;
-
+ target.getHeight());
}
if(null==result) {
result = createOffscreenDrawable(caps,
@@ -93,6 +91,12 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
return result;
}
+ /** Creates a (typically hw-accelerated) Pbuffer GLDrawable. */
+ public abstract GLDrawableImpl createGLPbufferDrawable(GLCapabilities capabilities,
+ GLCapabilitiesChooser chooser,
+ int initialWidth,
+ int initialHeight);
+
/** Creates a (typically software-accelerated) offscreen GLDrawable
used to implement the fallback rendering path of the
GLJPanel. */
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java
index cf466ef2c..1c3f8ead0 100755
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java
+++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java
@@ -78,14 +78,22 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
public boolean canCreateGLPbuffer() {
return true;
}
+ public GLDrawableImpl createGLPbufferDrawable(final GLCapabilities capabilities,
+ final GLCapabilitiesChooser chooser,
+ final int initialWidth,
+ final int initialHeight) {
+ return new EGLPbufferDrawable(this, capabilities, chooser,
+ initialWidth, initialHeight);
+ }
+
public GLPbuffer createGLPbuffer(final GLCapabilities capabilities,
final GLCapabilitiesChooser chooser,
final int initialWidth,
final int initialHeight,
final GLContext shareWith) {
- EGLPbufferDrawable pbufferDrawable = new EGLPbufferDrawable(this, capabilities, chooser,
- initialWidth,
- initialHeight);
+ GLDrawableImpl pbufferDrawable = createGLPbufferDrawable(
+ capabilities,
+ chooser, initialWidth, initialHeight);
return new GLPbufferImpl(pbufferDrawable, shareWith);
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java
index 024b69629..2aefa7b5b 100644
--- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java
+++ b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java
@@ -81,25 +81,22 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl implements D
return true;
}
+ public GLDrawableImpl createGLPbufferDrawable(GLCapabilities capabilities,
+ final GLCapabilitiesChooser chooser,
+ final int initialWidth,
+ final int initialHeight) {
+ AbstractGraphicsScreen screen = DefaultGraphicsScreen.createDefault();
+ return new MacOSXPbufferCGLDrawable(this, screen, capabilities, chooser,
+ initialWidth, initialHeight);
+ }
+
public GLPbuffer createGLPbuffer(final GLCapabilities capabilities,
final GLCapabilitiesChooser chooser,
final int initialWidth,
final int initialHeight,
final GLContext shareWith) {
- final List returnList = new ArrayList();
- final GLDrawableFactory factory = this;
- Runnable r = new Runnable() {
- public void run() {
- AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault();
- MacOSXPbufferCGLDrawable pbufferDrawable = new MacOSXPbufferCGLDrawable(factory, aScreen, capabilities, chooser,
- initialWidth,
- initialHeight);
- GLPbufferImpl pbuffer = new GLPbufferImpl(pbufferDrawable, shareWith);
- returnList.add(pbuffer);
- }
- };
- maybeDoSingleThreadedWorkaround(r);
- return (GLPbuffer) returnList.get(0);
+ GLDrawableImpl drawable = createGLPbufferDrawable( capabilities, chooser, initialWidth, initialHeight);
+ return new GLPbufferImpl(drawable, shareWith);
}
public GLContext createExternalGLContext() {
@@ -124,15 +121,6 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl implements D
return CGL.getProcAddress(glFuncName);
}
- private void maybeDoSingleThreadedWorkaround(Runnable action) {
- if (Threading.isSingleThreaded() &&
- !Threading.isOpenGLThread()) {
- Threading.invokeOnOpenGLThread(action);
- } else {
- action.run();
- }
- }
-
public boolean canCreateContextOnJava2DSurface() {
return false;
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java
index 4e02dfe92..d91cc0126 100644
--- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java
+++ b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java
@@ -121,11 +121,10 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl implements
return canCreateGLPbuffer;
}
- public GLPbuffer createGLPbuffer(final GLCapabilities capabilities,
+ public GLDrawableImpl createGLPbufferDrawable(final GLCapabilities capabilities,
final GLCapabilitiesChooser chooser,
final int initialWidth,
- final int initialHeight,
- final GLContext shareWith) {
+ final int initialHeight) {
if (!canCreateGLPbuffer()) {
throw new GLException("Pbuffer support not available with current graphics card");
}
@@ -143,13 +142,12 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl implements
WGLExt dummyWGLExt = dummyContext.getWGLExt();
try {
AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault();
- WindowsPbufferWGLDrawable pbufferDrawable = new WindowsPbufferWGLDrawable(factory, aScreen, capabilities, chooser,
- initialWidth,
- initialHeight,
- dummyDrawable,
- dummyWGLExt);
- GLPbufferImpl pbuffer = new GLPbufferImpl(pbufferDrawable, shareWith);
- returnList.add(pbuffer);
+ GLDrawableImpl pbufferDrawable = new WindowsPbufferWGLDrawable(factory, aScreen, capabilities, chooser,
+ initialWidth,
+ initialHeight,
+ dummyDrawable,
+ dummyWGLExt);
+ returnList.add(pbufferDrawable);
dummyContext.release();
dummyContext.destroy();
dummyDrawable.destroy();
@@ -161,7 +159,17 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl implements
}
};
maybeDoSingleThreadedWorkaround(r);
- return (GLPbuffer) returnList.get(0);
+ return (GLDrawableImpl) returnList.get(0);
+ }
+
+ public GLPbuffer createGLPbuffer(final GLCapabilities capabilities,
+ final GLCapabilitiesChooser chooser,
+ final int initialWidth,
+ final int initialHeight,
+ final GLContext shareWith) {
+ GLDrawableImpl pbufferDrawable = createGLPbufferDrawable(
+ capabilities, chooser, initialWidth, initialHeight);
+ return new GLPbufferImpl(pbufferDrawable, shareWith);
}
public GLContext createExternalGLContext() {
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java
index 762ed5cac..456e04b77 100644
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java
+++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java
@@ -114,28 +114,25 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna
return canCreateGLPbuffer;
}
- public GLPbuffer createGLPbuffer(final GLCapabilities capabilities,
+ public GLDrawableImpl createGLPbufferDrawable(final GLCapabilities capabilities,
final GLCapabilitiesChooser chooser,
final int initialWidth,
- final int initialHeight,
- final GLContext shareWith) {
+ final int initialHeight) {
if (!canCreateGLPbuffer()) {
throw new GLException("Pbuffer support not available with current graphics card");
}
- final List returnList = new ArrayList();
- final GLDrawableFactory factory = this;
- Runnable r = new Runnable() {
- public void run() {
- AbstractGraphicsScreen screen = X11GraphicsScreen.createDefault();
- X11PbufferGLXDrawable pbufferDrawable = new X11PbufferGLXDrawable(factory, screen, capabilities, chooser,
- initialWidth,
- initialHeight);
- GLPbufferImpl pbuffer = new GLPbufferImpl(pbufferDrawable, shareWith);
- returnList.add(pbuffer);
- }
- };
- maybeDoSingleThreadedWorkaround(r);
- return (GLPbuffer) returnList.get(0);
+ AbstractGraphicsScreen screen = X11GraphicsScreen.createDefault();
+ return new X11PbufferGLXDrawable(this, screen, capabilities, chooser,
+ initialWidth, initialHeight);
+ }
+
+ public GLPbuffer createGLPbuffer(final GLCapabilities capabilities,
+ final GLCapabilitiesChooser chooser,
+ final int initialWidth,
+ final int initialHeight,
+ final GLContext shareWith) {
+ GLDrawableImpl drawable = createGLPbufferDrawable( capabilities, chooser, initialWidth, initialHeight);
+ return new GLPbufferImpl(drawable, shareWith);
}
public GLContext createExternalGLContext() {
@@ -164,15 +161,6 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna
return res;
}
- private void maybeDoSingleThreadedWorkaround(Runnable action) {
- if (Threading.isSingleThreaded() &&
- !Threading.isOpenGLThread()) {
- Threading.invokeOnOpenGLThread(action);
- } else {
- action.run();
- }
- }
-
public boolean canCreateContextOnJava2DSurface() {
return false;
}