Demos (master): egl/opengl: Use eglChooseConfig in peglgears.

Chia-I Wu olv at kemper.freedesktop.org
Fri Jan 14 06:20:45 UTC 2011


Module: Demos
Branch: master
Commit: f61baefe2e9858b68fccd838dce644ab6ecc1e1e
URL:    http://cgit.freedesktop.org/mesa/demos/commit/?id=f61baefe2e9858b68fccd838dce644ab6ecc1e1e

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Fri Jan 14 14:17:59 2011 +0800

egl/opengl: Use eglChooseConfig in peglgears.

eglGetConfig might not return a config that supports pbuffer.

---

 src/egl/opengl/peglgears.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/src/egl/opengl/peglgears.c b/src/egl/opengl/peglgears.c
index 212d1ac..30b6578 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);
 




More information about the mesa-commit mailing list