diff options
author | Sven Gothel <[email protected]> | 2012-02-13 07:00:01 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-02-13 07:00:01 +0100 |
commit | 4011e70eed8c88aee0fcd051a50ab3f15bb94f68 (patch) | |
tree | e7fb1c33d4c0e75fc52dc3ec2d927f76c51de216 /src/jogl/classes/com/jogamp/opengl | |
parent | ddd375375025fb83aba90c80b9a089876dad5434 (diff) |
OpenGL ES/EGL Overhaul
- GLProfile properly detects native EGL/ES1/ES2 on the 'desktop' device factory.
This allows usage of Mesa's EGL/ES or Imageon's PVR emulation, etc.
- GLProfile drops getDefaultDesktopDevice() and getDefaultEGLDevice()
since both are aligned by getDefaultDevice().
- Fix GL_ARB_ES2_compatibility detection and utilize
resulting isGLES2Compatible() where possible.
This allows ES2 compatible desktop profiles to use core ES2 functionality
(glShaderBinary() .. etc) even with a GL2ES2 desktop implementation.
- EGLDrawable: If createSurface(..) fails (BAD_NATIVE_WINDOW) w/ surfaceHandle
it uses windowHandle if available and differs.
This allows the ANGLE impl. to work.
- Properly order of EGL/ES library lookup:
ES2: libGLESv2.so.2, libGLESv2.so, GLES20, GLESv2_CM
EGL: libEGL.so.1, libEGL.so, EGL
- *DynamicLookupHelper reference will be null if it's library is not complete
(all tool libs, all glue libs and a ProcAddressFunc lookup function - if named).
- Enhance GL version string (incl. ES2 compatible, hw/sw, ..)
- GLBase: Fix docs and remove redundancies
- Prepared (disabled) DesktopES2DynamicLibraryBundleInfo
to be used for a real EGL/ES2 implementation within the desktop GL lib (AMD).
Sadly it currenly crashed within eglGetDisplay(EGL_DEFAULT_DISPLAY),
hence it's disabled.
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl')
3 files changed, 50 insertions, 15 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/JoglVersion.java b/src/jogl/classes/com/jogamp/opengl/JoglVersion.java index 5172cccbd..bf7eb0770 100644 --- a/src/jogl/classes/com/jogamp/opengl/JoglVersion.java +++ b/src/jogl/classes/com/jogamp/opengl/JoglVersion.java @@ -34,6 +34,8 @@ import javax.media.opengl.*; import com.jogamp.common.os.Platform; import com.jogamp.common.util.VersionUtil; import com.jogamp.common.util.JogampVersion; + +import java.util.List; import java.util.jar.Manifest; import javax.media.nativewindow.AbstractGraphicsDevice; @@ -68,6 +70,46 @@ public class JoglVersion extends JogampVersion { return toString(gl, null).toString(); } + public static StringBuilder getAvailableCapabilitiesInfo(GLDrawableFactory factory, AbstractGraphicsDevice device, StringBuilder sb) { + if(null==sb) { + sb = new StringBuilder(); + } + boolean done = false; + if(null!=factory) { + try { + final List<GLCapabilitiesImmutable> availCaps = factory.getAvailableCapabilities(device); + for(int i=0; i<availCaps.size(); i++) { + sb.append("\t").append(availCaps.get(i)).append(Platform.getNewline()); + } + done = true; + } catch (GLException gle) { /* n/a */ } + } + if(!done) { + sb.append("\tnone").append(Platform.getNewline()); + } + sb.append(Platform.getNewline()); + return sb; + } + + public static StringBuilder getDefaultOpenGLInfo(StringBuilder sb) { + if(null==sb) { + sb = new StringBuilder(); + } + final AbstractGraphicsDevice device = GLProfile.getDefaultDevice(); + sb.append("Default Profiles ").append(Platform.getNewline()); + if(null!=device) { + GLProfile.glAvailabilityToString(device, sb, "\t", 1); + } else { + sb.append("none"); + } + sb.append(Platform.getNewline()).append(Platform.getNewline()); + sb.append("Desktop Capabilities: ").append(Platform.getNewline()); + getAvailableCapabilitiesInfo(GLDrawableFactory.getDesktopFactory(), device, sb); + sb.append("EGL Capabilities: ").append(Platform.getNewline()); + getAvailableCapabilitiesInfo(GLDrawableFactory.getEGLFactory(), device, sb); + return sb; + } + public static StringBuilder getGLInfo(GL gl, StringBuilder sb) { AbstractGraphicsDevice device = gl.getContext().getGLDrawable().getNativeSurface() .getGraphicsConfiguration().getScreen().getDevice(); @@ -78,8 +120,8 @@ public class JoglVersion extends JogampVersion { sb.append(VersionUtil.SEPERATOR).append(Platform.getNewline()); sb.append(device.getClass().getSimpleName()).append("[type ") - .append(device.getType()).append(", connection ").append(device.getConnection()).append("]: ") - .append(GLProfile.glAvailabilityToString(device)); + .append(device.getType()).append(", connection ").append(device.getConnection()).append("]: ").append(Platform.getNewline()); + GLProfile.glAvailabilityToString(device, sb, "\t", 1); sb.append(Platform.getNewline()); sb.append("Swap Interval ").append(gl.getSwapInterval()); sb.append(Platform.getNewline()); @@ -91,7 +133,7 @@ public class JoglVersion extends JogampVersion { sb.append(Platform.getNewline()); sb.append("GL_VENDOR ").append(gl.glGetString(GL.GL_VENDOR)); sb.append(Platform.getNewline()); - sb.append("GL_RENDERER ").append(gl.glGetString(GL.GL_RENDERER)); + sb.append("GL_RENDERER ").append(gl.glGetString(GL.GL_RENDERER)); sb.append(Platform.getNewline()); sb.append("GL_VERSION ").append(gl.glGetString(GL.GL_VERSION)); sb.append(Platform.getNewline()); @@ -99,7 +141,7 @@ public class JoglVersion extends JogampVersion { sb.append(Platform.getNewline()); sb.append(" ").append(ctx.getGLExtensionsString()); sb.append(Platform.getNewline()); - sb.append("GLX_EXTENSIONS "); + sb.append("GLX_EXTENSIONS"); sb.append(Platform.getNewline()); sb.append(" ").append(ctx.getPlatformExtensionsString()); sb.append(Platform.getNewline()); diff --git a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java index c982ce16d..91f79793c 100644 --- a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java +++ b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java @@ -27,8 +27,6 @@ */ package com.jogamp.opengl.swt; -import java.util.List; - import javax.media.nativewindow.AbstractGraphicsDevice; import javax.media.nativewindow.NativeSurface; import javax.media.nativewindow.ProxySurface; @@ -538,13 +536,9 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { // System.err.println(NativeWindowVersion.getInstance()); System.err.println(JoglVersion.getInstance()); - final GLDrawableFactory factory = GLDrawableFactory.getDesktopFactory(); - final List<GLCapabilitiesImmutable> availCaps = factory.getAvailableCapabilities(null); - for(int i=0; i<availCaps.size(); i++) { - System.err.println(availCaps.get(i)); - } - - final GLCapabilitiesImmutable caps = new GLCapabilities( GLProfile.getDefault(GLProfile.getDefaultDesktopDevice()) ); + System.err.println(JoglVersion.getDefaultOpenGLInfo(null).toString()); + + final GLCapabilitiesImmutable caps = new GLCapabilities( GLProfile.getDefault(GLProfile.getDefaultDevice()) ); final Display display = new Display(); final Shell shell = new Shell(display); shell.setSize(128,128); diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java index 747dd5c49..1f200bf3b 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java @@ -188,7 +188,7 @@ public class ShaderUtil { int[] param = new int[1]; shaderBinaryFormats = new HashSet<Integer>(); - if (gl.isGLES2()) { + if (gl.isGLES2Compatible()) { gl.glGetIntegerv(GL2ES2.GL_NUM_SHADER_BINARY_FORMATS, param, 0); int numFormats = param[0]; if(numFormats>0) { @@ -329,7 +329,6 @@ public class ShaderUtil { throw new GLException("createAndLoadShader: CreateShader failed, GL Error: 0x"+Integer.toHexString(err)); } - shaderBinary(gl, shader, binFormat, bin); err = gl.glGetError(); |