aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun/opengl/impl/egl
diff options
context:
space:
mode:
Diffstat (limited to 'src/classes/com/sun/opengl/impl/egl')
-rwxr-xr-xsrc/classes/com/sun/opengl/impl/egl/EGLContext.java15
-rwxr-xr-xsrc/classes/com/sun/opengl/impl/egl/EGLDrawable.java2
-rwxr-xr-xsrc/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java24
3 files changed, 23 insertions, 18 deletions
diff --git a/src/classes/com/sun/opengl/impl/egl/EGLContext.java b/src/classes/com/sun/opengl/impl/egl/EGLContext.java
index f55b611ca..25ac2c726 100755
--- a/src/classes/com/sun/opengl/impl/egl/EGLContext.java
+++ b/src/classes/com/sun/opengl/impl/egl/EGLContext.java
@@ -123,11 +123,16 @@ public class EGLContext extends GLContextImpl {
}
EGLDrawableFactory factory = (EGLDrawableFactory) GLDrawableFactory.getFactory();
- int clientVersion = (EGLDrawableFactory.PROFILE_GLES2.equals(factory.getProfile()) ? 2 : 1);
- int[] contextAttrs = new int[] {
- EGL.EGL_CONTEXT_CLIENT_VERSION, clientVersion,
- EGL.EGL_NONE
- };
+ boolean isGLES2 = EGLDrawableFactory.PROFILE_GLES2.equals(factory.getProfile());
+ int[] contextAttrs = null;
+ // FIXME: need to determine whether to specify the context
+ // attributes based on the EGL version
+ if (isGLES2) {
+ contextAttrs = new int[] {
+ EGL.EGL_CONTEXT_CLIENT_VERSION, 2,
+ EGL.EGL_NONE
+ };
+ }
context = EGL.eglCreateContext(display, config, shareWith, contextAttrs, 0);
if (context == 0) {
throw new GLException("Error creating OpenGL context");
diff --git a/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java b/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java
index c9cc19913..49dea75ce 100755
--- a/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java
+++ b/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java
@@ -92,7 +92,7 @@ public class EGLDrawable implements GLDrawable {
if (realized) {
// Create the window surface
surface = EGL.eglCreateWindowSurface(display, config, nativeWindow, null);
- if (surface == 0) {
+ if (surface == EGL.EGL_NO_SURFACE) {
throw new GLException("Creation of window surface (eglCreateWindowSurface) failed");
}
}
diff --git a/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java b/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java
index bbef9a54f..be594ce46 100755
--- a/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java
+++ b/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java
@@ -190,18 +190,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
}
public int[] glCapabilities2AttribList(GLCapabilities caps) {
- int renderBit;
-
- if (PROFILE_GLES1.equals(getProfile())) {
- renderBit = EGL.EGL_OPENGL_ES_BIT;
- } else if (PROFILE_GLES2.equals(getProfile())) {
- renderBit = EGL.EGL_OPENGL_ES2_BIT;
- } else {
- throw new GLException("Unknown profile \"" + getProfile() + "\" (expected OpenGL ES 1 or OpenGL ES 2)");
- }
-
- return new int[] {
- EGL.EGL_RENDERABLE_TYPE, renderBit,
+ int[] attrs = new int[] {
EGL.EGL_DEPTH_SIZE, caps.getDepthBits(),
// FIXME: does this need to be configurable?
EGL.EGL_SURFACE_TYPE, EGL.EGL_WINDOW_BIT,
@@ -210,8 +199,19 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
EGL.EGL_BLUE_SIZE, caps.getBlueBits(),
EGL.EGL_ALPHA_SIZE, caps.getAlphaBits(),
EGL.EGL_STENCIL_SIZE, (caps.getStencilBits() > 0 ? caps.getStencilBits() : EGL.EGL_DONT_CARE),
+ EGL.EGL_NONE, EGL.EGL_NONE,
EGL.EGL_NONE
};
+
+ // FIXME: we need to query the EGL version to determine
+ // whether we are allowed to specify the renderable type
+
+ if (PROFILE_GLES2.equals(getProfile())) {
+ attrs[attrs.length - 3] = EGL.EGL_RENDERABLE_TYPE;
+ attrs[attrs.length - 2] = EGL.EGL_OPENGL_ES2_BIT;
+ }
+
+ return attrs;
}
/*