From f1cba2308b3f389bfd72fdc2b5a678497b474222 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 23 Nov 2008 16:59:58 +0000 Subject: proper EGL version attr setting git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1801 232f8b59-042b-4e1e-8c03-345bb8c30851 --- src/classes/com/sun/opengl/impl/egl/EGLContext.java | 16 +++++++++------- .../com/sun/opengl/impl/egl/EGLDrawableFactory.java | 7 +++++-- 2 files changed, 14 insertions(+), 9 deletions(-) (limited to 'src/classes/com/sun/opengl/impl/egl') diff --git a/src/classes/com/sun/opengl/impl/egl/EGLContext.java b/src/classes/com/sun/opengl/impl/egl/EGLContext.java index b211a8fe2..2be9537b2 100755 --- a/src/classes/com/sun/opengl/impl/egl/EGLContext.java +++ b/src/classes/com/sun/opengl/impl/egl/EGLContext.java @@ -198,14 +198,16 @@ public class EGLContext extends GLContextImpl { } } - int[] contextAttrs = null; - // FIXME: need to determine whether to specify the context - // attributes based on the EGL version - if (GLProfile.isGLES2()) { - contextAttrs = new int[] { - EGL.EGL_CONTEXT_CLIENT_VERSION, 2, + int[] contextAttrs = new int[] { + EGL.EGL_CONTEXT_CLIENT_VERSION, -1, EGL.EGL_NONE - }; + }; + if (GLProfile.isGLES2()) { + contextAttrs[1] = 2; + } else if (GLProfile.isGLES1()) { + contextAttrs[1] = 1; + } else { + throw new GLException("Error creating OpenGL context - invalid GLProfile"); } context = EGL.eglCreateContext(display, config, shareWith, contextAttrs, 0); if (context == 0) { diff --git a/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java b/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java index ed045939b..30665ce01 100755 --- a/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java +++ b/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java @@ -208,7 +208,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { public int[] glCapabilities2AttribList(GLCapabilities caps) { int[] attrs = new int[] { - EGL.EGL_RENDERABLE_TYPE, EGL.EGL_OPENGL_ES_BIT, + EGL.EGL_RENDERABLE_TYPE, -1, // FIXME: does this need to be configurable? EGL.EGL_SURFACE_TYPE, EGL.EGL_WINDOW_BIT, EGL.EGL_RED_SIZE, caps.getRedBits(), @@ -220,8 +220,11 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { EGL.EGL_NONE }; if (GLProfile.isGLES2()) { - // ES 2 attrs[1] = EGL.EGL_OPENGL_ES2_BIT; + } else if (GLProfile.isGLES1()) { + attrs[1] = EGL.EGL_OPENGL_ES_BIT; + } else { + throw new GLException("Error creating EGL drawable - invalid GLProfile"); } return attrs; -- cgit v1.2.3