diff options
-rwxr-xr-x | src/classes/com/sun/opengl/impl/egl/EGLContext.java | 16 | ||||
-rwxr-xr-x | src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java | 7 |
2 files changed, 14 insertions, 9 deletions
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; |