aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/sun/opengl/impl/egl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/com/sun/opengl/impl/egl')
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/egl/EGLContext.java47
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java6
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java8
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfigurationFactory.java40
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferDrawable.java6
5 files changed, 66 insertions, 41 deletions
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLContext.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLContext.java
index cc4dafa4c..a8c2521a3 100755
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLContext.java
+++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLContext.java
@@ -43,7 +43,6 @@ import java.nio.*;
import java.util.*;
public abstract class EGLContext extends GLContextImpl {
- protected EGLDrawable drawable;
private long eglContext;
private boolean eglQueryStringInitialized;
private boolean eglQueryStringAvailable;
@@ -52,9 +51,14 @@ public abstract class EGLContext extends GLContextImpl {
// EGL extension functions.
private EGLExtProcAddressTable eglExtProcAddressTable;
- public EGLContext(EGLDrawable drawable, GLContext shareWith) {
- super(drawable.getGLProfile(), shareWith);
- this.drawable = drawable;
+ public EGLContext(GLDrawableImpl drawable, GLDrawableImpl drawableRead,
+ GLContext shareWith) {
+ super(drawable, drawableRead, shareWith);
+ }
+
+ public EGLContext(GLDrawableImpl drawable,
+ GLContext shareWith) {
+ this(drawable, null, shareWith);
}
public Object getPlatformGLExtensions() {
@@ -76,10 +80,6 @@ public abstract class EGLContext extends GLContextImpl {
return eglExtProcAddressTable;
}
- public GLDrawable getGLDrawable() {
- return drawable;
- }
-
protected String mapToRealGLFunctionName(String glFunctionName) {
return glFunctionName;
}
@@ -93,7 +93,7 @@ public abstract class EGLContext extends GLContextImpl {
}
protected int makeCurrentImpl() throws GLException {
- if(EGL.EGL_NO_DISPLAY==drawable.getDisplay() ) {
+ if(EGL.EGL_NO_DISPLAY==((EGLDrawable)drawable).getDisplay() ) {
System.err.println("drawable not properly initialized");
return CONTEXT_NOT_CURRENT;
}
@@ -107,9 +107,9 @@ public abstract class EGLContext extends GLContextImpl {
created = true;
}
if (EGL.eglGetCurrentContext() != eglContext) {
- if (!EGL.eglMakeCurrent(drawable.getDisplay(),
- drawable.getSurface(),
- drawable.getSurface(),
+ if (!EGL.eglMakeCurrent(((EGLDrawable)drawable).getDisplay(),
+ ((EGLDrawable)drawable).getSurface(),
+ ((EGLDrawable)drawableRead).getSurface(),
eglContext)) {
throw new GLException("Error making context 0x" +
Long.toHexString(eglContext) + " current: error code " + EGL.eglGetError());
@@ -126,7 +126,7 @@ public abstract class EGLContext extends GLContextImpl {
protected void releaseImpl() throws GLException {
getDrawableImpl().getFactoryImpl().lockToolkit();
try {
- if (!EGL.eglMakeCurrent(drawable.getDisplay(),
+ if (!EGL.eglMakeCurrent(((EGLDrawable)drawable).getDisplay(),
EGL.EGL_NO_SURFACE,
EGL.EGL_NO_SURFACE,
EGL.EGL_NO_CONTEXT)) {
@@ -142,7 +142,7 @@ public abstract class EGLContext extends GLContextImpl {
getDrawableImpl().getFactoryImpl().lockToolkit();
try {
if (eglContext != 0) {
- if (!EGL.eglDestroyContext(drawable.getDisplay(), eglContext)) {
+ if (!EGL.eglDestroyContext(((EGLDrawable)drawable).getDisplay(), eglContext)) {
throw new GLException("Error destroying OpenGL context 0x" +
Long.toHexString(eglContext) + ": error code " + EGL.eglGetError());
}
@@ -155,8 +155,8 @@ public abstract class EGLContext extends GLContextImpl {
}
protected void create() throws GLException {
- long eglDisplay = drawable.getDisplay();
- EGLGraphicsConfiguration config = drawable.getGraphicsConfiguration();
+ long eglDisplay = ((EGLDrawable)drawable).getDisplay();
+ EGLGraphicsConfiguration config = ((EGLDrawable)drawable).getGraphicsConfiguration();
GLProfile glProfile = drawable.getGLProfile();
_EGLConfig eglConfig = config.getNativeConfig();
long shareWith = EGL.EGL_NO_CONTEXT;
@@ -207,12 +207,12 @@ public abstract class EGLContext extends GLContextImpl {
if (DEBUG) {
System.err.println(getThreadName() + ": !!! Created OpenGL context 0x" +
Long.toHexString(eglContext) + " for " + this +
- ", surface 0x" + Long.toHexString(drawable.getSurface()) +
+ ", surface 0x" + Long.toHexString(((EGLDrawable)drawable).getSurface()) +
", sharing with 0x" + Long.toHexString(shareWith));
}
- if (!EGL.eglMakeCurrent(drawable.getDisplay(),
- drawable.getSurface(),
- drawable.getSurface(),
+ if (!EGL.eglMakeCurrent(((EGLDrawable)drawable).getDisplay(),
+ ((EGLDrawable)drawable).getSurface(),
+ ((EGLDrawable)drawableRead).getSurface(),
eglContext)) {
throw new GLException("Error making context 0x" +
Long.toHexString(eglContext) + " current: error code " + EGL.eglGetError());
@@ -228,6 +228,9 @@ public abstract class EGLContext extends GLContextImpl {
if (DEBUG) {
System.err.println(getThreadName() + ": !!! Initializing EGL extension address table");
}
+ eglQueryStringInitialized = false;
+ eglQueryStringAvailable = false;
+
if (eglExtProcAddressTable == null) {
// FIXME: cache ProcAddressTables by capability bits so we can
// share them among contexts with the same capabilities
@@ -247,7 +250,7 @@ public abstract class EGLContext extends GLContextImpl {
GLDrawableFactoryImpl factory = getDrawableImpl().getFactoryImpl();
factory.lockToolkit();
try {
- String ret = EGL.eglQueryString(drawable.getDisplay(),
+ String ret = EGL.eglQueryString(((EGLDrawable)drawable).getDisplay(),
EGL.EGL_EXTENSIONS);
if (DEBUG) {
System.err.println("!!! EGL extensions: " + ret);
@@ -262,7 +265,7 @@ public abstract class EGLContext extends GLContextImpl {
}
protected void setSwapIntervalImpl(int interval) {
- if (EGL.eglSwapInterval(drawable.getDisplay(), interval)) {
+ if (EGL.eglSwapInterval(((EGLDrawable)drawable).getDisplay(), interval)) {
currentSwapInterval = interval ;
}
}
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 1c3f8ead0..757a2bcf9 100755
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java
+++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java
@@ -72,16 +72,20 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
GLCapabilitiesChooser chooser,
int width,
int height) {
+ capabilities.setOnscreen(false);
+ capabilities.setPBuffer(false);
throw new GLException("Not yet implemented");
}
public boolean canCreateGLPbuffer() {
return true;
}
- public GLDrawableImpl createGLPbufferDrawable(final GLCapabilities capabilities,
+ public GLDrawableImpl createGLPbufferDrawable(GLCapabilities capabilities,
final GLCapabilitiesChooser chooser,
final int initialWidth,
final int initialHeight) {
+ capabilities.setOnscreen(false);
+ capabilities.setPBuffer(true);
return new EGLPbufferDrawable(this, capabilities, chooser,
initialWidth, initialHeight);
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java
index 574c3c8cf..7d9ab5b9d 100644
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java
+++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java
@@ -73,7 +73,7 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple
}
GLProfile glp = capsRequested.getGLProfile();
_EGLConfig _cfg = EGLConfigId2EGLConfig(glp, dpy, cfgID);
- GLCapabilities caps = EGLConfig2Capabilities(glp, dpy, _cfg);
+ GLCapabilities caps = EGLConfig2Capabilities(glp, dpy, _cfg, capsRequested.isOnscreen(), capsRequested.isPBuffer());
return new EGLGraphicsConfiguration(absScreen, caps, capsRequested, new DefaultGLCapabilitiesChooser(), _cfg, cfgID);
}
@@ -116,7 +116,8 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple
return configs[0];
}
- public static GLCapabilities EGLConfig2Capabilities(GLProfile glp, long display, _EGLConfig _config) {
+ public static GLCapabilities EGLConfig2Capabilities(GLProfile glp, long display, _EGLConfig _config,
+ boolean onscreen, boolean pbuffer) {
GLCapabilities caps = new GLCapabilities(glp);
int[] val = new int[1];
@@ -161,6 +162,9 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple
caps.setTransparentAlphaValue(val[0]==EGL.EGL_DONT_CARE?-1:val[0]);
} */
}
+ caps.setOnscreen(onscreen);
+ caps.setDoubleBuffered(onscreen);
+ caps.setPBuffer(pbuffer);
return caps;
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfigurationFactory.java
index d05f10e5b..2b91edfec 100644
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfigurationFactory.java
@@ -97,12 +97,18 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
throw new GLException("Invalid EGL display: "+absDevice);
}
- EGLGraphicsConfiguration res = eglChooseConfig(eglDisplay, capabilities, capabilities, chooser, absScreen, eglSurfaceType);
+ GLCapabilities caps2 = (GLCapabilities) capabilities.clone();
+ if(!caps2.isOnscreen()) {
+ // OFFSCREEN !DOUBLE_BUFFER
+ caps2.setDoubleBuffered(false);
+ }
+
+ EGLGraphicsConfiguration res = eglChooseConfig(eglDisplay, caps2, capabilities, chooser, absScreen, eglSurfaceType);
if(null!=res) {
return res;
}
if(DEBUG) {
- System.err.println("eglChooseConfig failed with given capabilities surfaceType 0x"+Integer.toHexString(eglSurfaceType)+", "+capabilities);
+ System.err.println("eglChooseConfig failed with given capabilities surfaceType 0x"+Integer.toHexString(eglSurfaceType)+", "+caps2);
}
if (chooser == null) {
@@ -118,13 +124,14 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
if (numConfigs[0] == 0) {
throw new GLException("Graphics configuration fetch (eglGetConfigs) - no EGLConfig found");
}
- GLCapabilities[] caps = eglConfigs2GLCaps(glp, eglDisplay, configs, numConfigs[0]);
+ GLCapabilities[] caps = eglConfigs2GLCaps(glp, eglDisplay, configs, numConfigs[0],
+ caps2.isOnscreen(), caps2.isPBuffer());
if(DEBUG) {
printCaps("eglGetConfigs", caps, System.err);
}
int chosen = -1;
try {
- chosen = chooser.chooseCapabilities(capabilities, caps, -1);
+ chosen = chooser.chooseCapabilities(caps2, caps, -1);
} catch (NativeWindowException e) { throw new GLException(e); }
if(chosen<0) {
throw new GLException("Graphics configuration chooser failed");
@@ -142,11 +149,11 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
// Last try .. add a fixed embedded profile [ATI, Nokia, ..]
GLCapabilities fixedCaps = new GLCapabilities(glp);
+ /**
fixedCaps.setRedBits(5);
fixedCaps.setGreenBits(6);
fixedCaps.setBlueBits(5);
fixedCaps.setDepthBits(16);
- /**
fixedCaps.setSampleBuffers(true);
fixedCaps.setNumSamples(4); */
if(DEBUG) {
@@ -171,21 +178,22 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
}
protected static EGLGraphicsConfiguration eglChooseConfig(long eglDisplay,
- GLCapabilities capsChoosen0, GLCapabilities capsRequested, GLCapabilitiesChooser chooser,
+ GLCapabilities capsChosen0, GLCapabilities capsRequested, GLCapabilitiesChooser chooser,
AbstractGraphicsScreen absScreen, int eglSurfaceType) {
- GLProfile glp = capsChoosen0.getGLProfile();
- int[] attrs = EGLGraphicsConfiguration.GLCapabilities2AttribList(capsChoosen0, eglSurfaceType);
+ GLProfile glp = capsChosen0.getGLProfile();
+ int[] attrs = EGLGraphicsConfiguration.GLCapabilities2AttribList(capsChosen0, eglSurfaceType);
_EGLConfig[] configs = new _EGLConfig[10];
int[] numConfigs = new int[1];
if (!EGL.eglChooseConfig(eglDisplay,
attrs, 0,
configs, configs.length,
numConfigs, 0)) {
- throw new GLException("Graphics configuration selection (eglChooseConfig) failed for surfaceType 0x"+Integer.toHexString(eglSurfaceType)+", "+capsChoosen0);
+ throw new GLException("Graphics configuration selection (eglChooseConfig) failed for surfaceType 0x"+Integer.toHexString(eglSurfaceType)+", "+capsChosen0);
}
if (numConfigs[0] > 0) {
if(DEBUG) {
- GLCapabilities[] caps = eglConfigs2GLCaps(glp, eglDisplay, configs, numConfigs[0]);
+ GLCapabilities[] caps = eglConfigs2GLCaps(glp, eglDisplay, configs, numConfigs[0],
+ capsChosen0.isOnscreen(), capsChosen0.isPBuffer());
printCaps("eglChooseConfig", caps, System.err);
}
int[] val = new int[1];
@@ -193,13 +201,14 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
if(!EGL.eglGetConfigAttrib(eglDisplay, configs[0], EGL.EGL_CONFIG_ID, val, 0)) {
if(DEBUG) {
// FIXME: this happens on a ATI PC Emulation ..
- System.err.println("EGL couldn't retrieve ConfigID for already chosen eglConfig "+capsChoosen0+", error 0x"+Integer.toHexString(EGL.eglGetError()));
+ System.err.println("EGL couldn't retrieve ConfigID for already chosen eglConfig "+capsChosen0+", error 0x"+Integer.toHexString(EGL.eglGetError()));
}
val[0]=0;
}
- GLCapabilities capsChoosen1 = EGLGraphicsConfiguration.EGLConfig2Capabilities(glp, eglDisplay, configs[0]);
+ GLCapabilities capsChoosen1 = EGLGraphicsConfiguration.EGLConfig2Capabilities(glp, eglDisplay, configs[0],
+ capsChosen0.isOnscreen(), capsChosen0.isPBuffer());
if(DEBUG) {
- System.err.println("eglChooseConfig found: surfaceType 0x"+Integer.toHexString(eglSurfaceType)+", "+capsChoosen0+" -> "+capsChoosen1);
+ System.err.println("eglChooseConfig found: surfaceType 0x"+Integer.toHexString(eglSurfaceType)+", "+capsChosen0+" -> "+capsChoosen1);
}
return new EGLGraphicsConfiguration(absScreen, capsChoosen1, capsRequested, chooser, configs[0], val[0]);
@@ -207,11 +216,12 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
return null;
}
- protected static GLCapabilities[] eglConfigs2GLCaps(GLProfile glp, long eglDisplay, _EGLConfig[] configs, int num)
+ protected static GLCapabilities[] eglConfigs2GLCaps(GLProfile glp, long eglDisplay, _EGLConfig[] configs, int num,
+ boolean onscreen, boolean pbuffer)
{
GLCapabilities[] caps = new GLCapabilities[num];
for(int i=0; i<num; i++) {
- caps[i] = EGLGraphicsConfiguration.EGLConfig2Capabilities(glp, eglDisplay, configs[i]);
+ caps[i] = EGLGraphicsConfiguration.EGLConfig2Capabilities(glp, eglDisplay, configs[i], onscreen, pbuffer);
}
return caps;
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferDrawable.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferDrawable.java
index a792762a4..448112ae0 100644
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferDrawable.java
+++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferDrawable.java
@@ -118,6 +118,10 @@ public class EGLPbufferDrawable extends EGLDrawable {
return new EGLPbufferContext(this, shareWith);
}
- protected void swapBuffersImpl() { }
+ protected void swapBuffersImpl() {
+ if(DEBUG) {
+ System.err.println("unhandled swapBuffersImpl() called for: "+this);
+ }
+ }
}