summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2011-01-14 14:17:59 +0800
committerChia-I Wu <olvaffe@gmail.com>2011-01-14 14:20:05 +0800
commitf61baefe2e9858b68fccd838dce644ab6ecc1e1e (patch)
tree3f00e1da4a2ffd2c0e14f4fe86fc0983f6b66370
parent014a0c44bd7656446df1b1f8f485bc14b7fd68eb (diff)
egl/opengl: Use eglChooseConfig in peglgears.
eglGetConfig might not return a config that supports pbuffer.
-rw-r--r--src/egl/opengl/peglgears.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/egl/opengl/peglgears.c b/src/egl/opengl/peglgears.c
index 212d1acf..30b65781 100644
--- a/src/egl/opengl/peglgears.c
+++ b/src/egl/opengl/peglgears.c
@@ -371,6 +371,7 @@ main(int argc, char *argv[])
EGLint numConfigs, i;
EGLBoolean b;
EGLDisplay d;
+ EGLint configAttribs[10];
EGLint screenAttribs[10];
GLboolean printInfo = GL_FALSE;
EGLint width = 300, height = 300;
@@ -398,7 +399,19 @@ main(int argc, char *argv[])
printf("peglgears: EGL version = %d.%d\n", major, minor);
printf("peglgears: EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
- eglGetConfigs(d, configs, MAX_CONFIGS, &numConfigs);
+ i = 0;
+ configAttribs[i++] = EGL_RENDERABLE_TYPE;
+ configAttribs[i++] = EGL_OPENGL_BIT;
+ configAttribs[i++] = EGL_SURFACE_TYPE;
+ configAttribs[i++] = EGL_PBUFFER_BIT;
+ configAttribs[i++] = EGL_NONE;
+
+ numConfigs = 0;
+ if (!eglChooseConfig(d, configAttribs, configs, MAX_CONFIGS, &numConfigs) ||
+ !numConfigs) {
+ printf("peglgears: failed to choose a config\n");
+ return 0;
+ }
eglBindAPI(EGL_OPENGL_API);