aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-03-10 04:51:28 +0100
committerSven Gothel <[email protected]>2012-03-10 04:51:28 +0100
commitf0f696c4253691503a0d66636ea779e0731bda84 (patch)
tree74007b3923b06e040528429f7503715af74bc1a4 /src/jogl/classes/jogamp/opengl
parent42a08f9c8a6b86a104d9feba6e29397933b020c5 (diff)
GL/GLContext: Properly define swapInterval incl. default value for EGL (1) and desktop (undefined).
*GLContext.setSwapIntervalImpl: Simple return success, set state in GLContext.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLContext.java13
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java11
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java7
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java9
5 files changed, 19 insertions, 23 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index 8c9ac589a..49b90008b 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -1083,6 +1083,8 @@ public abstract class GLContextImpl extends GLContext {
// Set GL Version (complete w/ version string)
//
setContextVersion(major, minor, ctxProfileBits, true);
+
+ setDefaultSwapInterval();
}
protected final void removeCachedVersion(int major, int minor, int ctxProfileBits) {
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
index dc47799c1..f5f9f62c4 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
@@ -274,18 +274,19 @@ public abstract class EGLContext extends GLContextImpl {
return sb;
}
- protected void setSwapIntervalImpl(int interval) {
+ @Override
+ protected boolean setSwapIntervalImpl(int interval) {
// FIXME !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// eglSwapInterval(..) issued:
// Android 4.0.3 / Pandaboard ES / PowerVR SGX 540: crashes
// FIXME !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- if( ! ( Platform.OSType.ANDROID == Platform.getOSType() && getGLRendererString(true).contains("powervr") ) ) {
- if (EGL.eglSwapInterval(((EGLDrawable)drawable).getDisplay(), interval)) {
- currentSwapInterval = interval ;
+ if( Platform.OSType.ANDROID == Platform.getOSType() && getGLRendererString(true).contains("powervr") ) {
+ if(DEBUG) {
+ System.err.println("Ignored: eglSwapInterval("+interval+") - cause: OS "+Platform.getOSType() + " / Renderer " + getGLRendererString(false));
}
- } else if(DEBUG) {
- System.err.println("Ignored: eglSwapInterval("+interval+") - cause: OS "+Platform.getOSType() + " / Renderer " + getGLRendererString(false));
+ return false;
}
+ return EGL.eglSwapInterval(((EGLDrawable)drawable).getDisplay(), interval);
}
public abstract void bindPbufferToTexture();
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
index 4ef49e337..63d58f447 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
@@ -279,14 +279,9 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
}
- protected void setSwapIntervalImpl(int interval) {
- if( ! isCreated() ) {
- throw new GLException("OpenGL context not created");
- }
- if(!impl.setSwapInterval(interval)) {
- throw new GLException("Error set swap-interval: "+this);
- }
- currentSwapInterval = interval ;
+ @Override
+ protected boolean setSwapIntervalImpl(int interval) {
+ return impl.setSwapInterval(interval);
}
public ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) {
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
index 06dc07c1e..a6ef9bd1c 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
@@ -435,7 +435,7 @@ public class WindowsWGLContext extends GLContextImpl {
}
@Override
- protected void setSwapIntervalImpl(int interval) {
+ protected boolean setSwapIntervalImpl(int interval) {
WGLExt wglExt = getWGLExt();
if(0==hasSwapIntervalSGI) {
try {
@@ -444,11 +444,10 @@ public class WindowsWGLContext extends GLContextImpl {
}
if (hasSwapIntervalSGI>0) {
try {
- if ( wglExt.wglSwapIntervalEXT(interval) ) {
- currentSwapInterval = interval ;
- }
+ return wglExt.wglSwapIntervalEXT(interval);
} catch (Throwable t) { hasSwapIntervalSGI=-1; }
}
+ return false;
}
private final int initSwapGroupImpl(WGLExt wglExt) {
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
index 79361ac0c..1dc1441e1 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
@@ -509,10 +509,10 @@ public abstract class X11GLXContext extends GLContextImpl {
}
@Override
- protected void setSwapIntervalImpl(int interval) {
+ protected boolean setSwapIntervalImpl(int interval) {
X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeSurface().getGraphicsConfiguration();
GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities();
- if(!glCaps.isOnscreen()) return;
+ if(!glCaps.isOnscreen()) { return false; }
GLXExt glXExt = getGLXExt();
if(0==hasSwapIntervalSGI) {
@@ -522,11 +522,10 @@ public abstract class X11GLXContext extends GLContextImpl {
}
if (hasSwapIntervalSGI>0) {
try {
- if( 0 == glXExt.glXSwapIntervalSGI(interval) ) {
- currentSwapInterval = interval;
- }
+ return 0 == glXExt.glXSwapIntervalSGI(interval);
} catch (Throwable t) { hasSwapIntervalSGI=-1; }
}
+ return false;
}
private final int initSwapGroupImpl(GLXExt glXExt) {