aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java68
1 files changed, 48 insertions, 20 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
index b51f290e9..ee984b74a 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
@@ -67,6 +67,7 @@ import javax.media.opengl.GLFBODrawable;
import javax.media.opengl.GLOffscreenAutoDrawable;
import javax.media.opengl.GLProfile;
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.nativewindow.MutableGraphicsConfiguration;
import com.jogamp.nativewindow.DelegatedUpstreamSurfaceHookWithSurfaceSize;
import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize;
@@ -128,16 +129,16 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
protected final boolean createSharedResourceImpl(final AbstractGraphicsDevice device) {
final SharedResourceRunner.Resource sr = getOrCreateSharedResource( device );
if(null!=sr) {
- return sr.isValid();
+ return sr.isAvailable();
}
return false;
}
@Override
- public final GLRendererQuirks getRendererQuirks(final AbstractGraphicsDevice device) {
+ public final GLRendererQuirks getRendererQuirks(final AbstractGraphicsDevice device, final GLProfile glp) {
final SharedResourceRunner.Resource sr = getOrCreateSharedResource( device );
if(null!=sr) {
- return sr.getRendererQuirks();
+ return sr.getRendererQuirks(glp);
}
return null;
}
@@ -195,7 +196,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
System.err.println("chosenCapsMod: "+chosenCapsMod);
System.err.println("OffscreenLayerSurface: **** "+ols);
System.err.println("Target: **** "+target);
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
if( ! ( target instanceof MutableSurface ) ) {
throw new IllegalArgumentException("Passed NativeSurface must implement SurfaceChangeable for offscreen layered surface: "+target);
@@ -271,9 +272,9 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
@Override
public final GLOffscreenAutoDrawable createOffscreenAutoDrawable(final AbstractGraphicsDevice deviceReq,
- final GLCapabilitiesImmutable capsRequested,
- final GLCapabilitiesChooser chooser,
- final int width, final int height) {
+ final GLCapabilitiesImmutable capsRequested,
+ final GLCapabilitiesChooser chooser,
+ final int width, final int height) {
final GLDrawable drawable = createOffscreenDrawable( deviceReq, capsRequested, chooser, width, height );
try {
drawable.setRealized(true);
@@ -306,24 +307,32 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
@Override
public final GLDrawable createOffscreenDrawable(final AbstractGraphicsDevice deviceReq,
- final GLCapabilitiesImmutable capsRequested,
- final GLCapabilitiesChooser chooser,
- final int width, final int height) {
+ final GLCapabilitiesImmutable capsRequested,
+ final GLCapabilitiesChooser chooser,
+ final int width, final int height) {
if(width<=0 || height<=0) {
throw new GLException("initial size must be positive (were (" + width + " x " + height + "))");
}
- final AbstractGraphicsDevice device = getOrCreateSharedDevice(deviceReq);
- if(null == device) {
+ final SharedResourceRunner.Resource sr = getOrCreateSharedResource( deviceReq );
+ if( null == sr ) {
throw new GLException("No shared device for requested: "+deviceReq);
}
-
+ final AbstractGraphicsDevice device = sr.getDevice();
final GLCapabilitiesImmutable capsChosen = GLGraphicsConfigurationUtil.fixOffscreenGLCapabilities(capsRequested, this, device);
if( capsChosen.isFBO() ) {
// Use minimum GLCapabilities for the dummy surface w/ same profile
- final ProxySurface dummySurface = createDummySurfaceImpl(device, true, new GLCapabilities(capsChosen.getGLProfile()), capsRequested, null, width, height);
- final GLDrawableImpl dummyDrawable = createOnscreenDrawableImpl(dummySurface);
- return new GLFBODrawableImpl.ResizeableImpl(this, dummyDrawable, dummySurface, capsChosen, 0);
+ final GLProfile glp = capsChosen.getGLProfile();
+ final GLCapabilitiesImmutable glCapsMin = new GLCapabilities(glp);
+ final GLRendererQuirks glrq = sr.getRendererQuirks(glp);
+ final ProxySurface surface;
+ if( null != glrq && !glrq.exist(GLRendererQuirks.NoSurfacelessCtx) ) {
+ surface = createSurfacelessImpl(device, true, glCapsMin, capsRequested, null, width, height);
+ } else {
+ surface = createDummySurfaceImpl(device, true, glCapsMin, capsRequested, null, width, height);
+ }
+ final GLDrawableImpl drawable = createOnscreenDrawableImpl(surface);
+ return new GLFBODrawableImpl.ResizeableImpl(this, drawable, surface, capsChosen, 0);
}
return createOffscreenDrawableImpl( createMutableSurfaceImpl(device, true, capsChosen, capsRequested, chooser,
new UpstreamSurfaceHookMutableSize(width, height) ) );
@@ -380,8 +389,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook);
/**
- * A dummy surface is not visible on screen and will not be used to render directly to,
- * it maybe on- or offscreen.
+ * A dummy surface is not visible on screen, it may be on- or offscreen.
* <p>
* It is used to allow the creation of a {@link GLDrawable} and {@link GLContext} to query information.
* It also allows creation of framebuffer objects which are used for rendering or using a shared GLContext w/o actually rendering to a usable framebuffer.
@@ -409,8 +417,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
}
/**
- * A dummy surface is not visible on screen and will not be used to render directly to,
- * it maybe on- or offscreen.
+ * A dummy surface is not visible on screen and may be on- or offscreen.
* <p>
* It is used to allow the creation of a {@link GLDrawable} and {@link GLContext} to query information.
* It also allows creation of framebuffer objects which are used for rendering or using a shared GLContext w/o actually rendering to a usable framebuffer.
@@ -430,6 +437,27 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
public abstract ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice device, boolean createNewDevice,
GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height);
+ /**
+ * A surfaceless {@link ProxySurface} is a non-existing surface and will not be used as a render target.
+ * <p>
+ * It is used to allow the creation of a {@link GLDrawable} and {@link GLContext} w/o default framebuffer to query information.
+ * It also allows creation of framebuffer objects which are used for rendering or using a shared GLContext w/o actually rendering to a usable framebuffer.
+ * </p>
+ * @param device a valid platform dependent target device.
+ * @param createNewDevice if <code>true</code> a new device instance is created using <code>device</code> details,
+ * otherwise <code>device</code> instance is used as-is.
+ * @param chosenCaps
+ * @param requestedCaps
+ * @param chooser the custom chooser, may be null for default
+ * @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()}, not the actual dummy surface width.
+ * The latter is platform specific and small
+ * @param height the initial height as returned by {@link NativeSurface#getSurfaceHeight()}, not the actual dummy surface height,
+ * The latter is platform specific and small
+ * @return the created {@link ProxySurface} instance w/o defined surface handle but platform specific {@link UpstreamSurfaceHook}.
+ */
+ public abstract ProxySurface createSurfacelessImpl(AbstractGraphicsDevice device, boolean createNewDevice,
+ GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height);
+
//---------------------------------------------------------------------------
//
// ProxySurface (Wrapped pre-existing native surface) construction