diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLContextImpl.java | 58 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/egl/EGLContext.java | 13 |
2 files changed, 47 insertions, 24 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 5cbe3a44d..8c9ac589a 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -82,6 +82,9 @@ public abstract class GLContextImpl extends GLContext { // OpenGL functions. private ProcAddressTable glProcAddressTable; + private String glRenderer; + private String glRendererLowerCase; + // Tracks creation and initialization of buffer objects to avoid // repeated glGet calls upon glMapBuffer operations private GLBufferSizeTracker bufferSizeTracker; // Singleton - Set by GLContextShareSet @@ -151,6 +154,9 @@ public abstract class GLContextImpl extends GLContext { contextFQN = null; additionalCtxCreationFlags = 0; + glRenderer = ""; + glRendererLowerCase = glRenderer; + super.resetStates(); } @@ -950,6 +956,30 @@ public abstract class GLContextImpl extends GLContext { table.reset(getDrawableImpl().getGLDynamicLookupHelper() ); } + private final void initGLRendererStrings() { + final GLDynamicLookupHelper glDynLookupHelper = getDrawableImpl().getGLDynamicLookupHelper(); + final long _glGetString = glDynLookupHelper.dynamicLookupFunction("glGetString"); + if(0 == _glGetString) { + // FIXME + System.err.println("Warning: Entry point to 'glGetString' is NULL."); + Thread.dumpStack(); + } else { + final String _glRenderer = glGetStringInt(GL.GL_RENDERER, _glGetString); + if(null == _glRenderer) { + // FIXME + System.err.println("Warning: GL_RENDERER is NULL."); + Thread.dumpStack(); + } else { + glRenderer = _glRenderer; + glRendererLowerCase = glRenderer.toLowerCase(); + } + } + } + + protected final String getGLRendererString(boolean lowerCase) { + return lowerCase ? glRendererLowerCase : glRenderer; + } + /** * Sets the OpenGL implementation class and * the cache of which GL functions are available for calling through this @@ -980,6 +1010,8 @@ public abstract class GLContextImpl extends GLContext { } updateGLXProcAddressTable(); + initGLRendererStrings(); + if(!isCurrentContextHardwareRasterizer()) { ctxProfileBits |= GLContext.CTX_IMPL_ACCEL_SOFT; } @@ -1086,28 +1118,10 @@ public abstract class GLContextImpl extends GLContext { if(!drawable.getChosenGLCapabilities().getHardwareAccelerated()) { isHardwareRasterizer = false; } else { - // On some platforms (eg. X11), a software GL impl. does not properly declare itself properly. - // FIXME: We have to evaluate whether this heuristic approach is acceptable. - final GLDynamicLookupHelper glDynLookupHelper = getDrawableImpl().getGLDynamicLookupHelper(); - final long _glGetString = glDynLookupHelper.dynamicLookupFunction("glGetString"); - if(0 == _glGetString) { - // FIXME - System.err.println("Warning: Entry point to 'glGetString' is NULL."); - Thread.dumpStack(); - } else { - String glRenderer = glGetStringInt(GL.GL_RENDERER, _glGetString); - if(null == glRenderer) { - // FIXME - System.err.println("Warning: GL_RENDERER is NULL."); - Thread.dumpStack(); - } else { - glRenderer = glRenderer.toLowerCase(); - isHardwareRasterizer = ! ( glRenderer.contains("software") /* Mesa3D */ || - glRenderer.contains("mesa x11") /* Mesa3D*/ || - glRenderer.contains("softpipe") /* Gallium */ - ); - } - } + isHardwareRasterizer = ! ( glRendererLowerCase.contains("software") /* Mesa3D */ || + glRendererLowerCase.contains("mesa x11") /* Mesa3D*/ || + glRendererLowerCase.contains("softpipe") /* Gallium */ + ); } return isHardwareRasterizer; } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java index dcef1cd3d..dc47799c1 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java @@ -50,6 +50,7 @@ import jogamp.opengl.GLContextImpl; import jogamp.opengl.GLDrawableImpl; import com.jogamp.common.nio.Buffers; +import com.jogamp.common.os.Platform; import com.jogamp.gluegen.runtime.ProcAddressTable; import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver; @@ -274,8 +275,16 @@ public abstract class EGLContext extends GLContextImpl { } protected void setSwapIntervalImpl(int interval) { - if (EGL.eglSwapInterval(((EGLDrawable)drawable).getDisplay(), interval)) { - currentSwapInterval = 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 ; + } + } else if(DEBUG) { + System.err.println("Ignored: eglSwapInterval("+interval+") - cause: OS "+Platform.getOSType() + " / Renderer " + getGLRendererString(false)); } } |