From 429c521b15112fdcc70dca602b432fae45ca3a22 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Tue, 4 Aug 2009 13:43:35 -0700 Subject: opengl tests --- opengl/tests/textures/textures.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'opengl/tests/textures') diff --git a/opengl/tests/textures/textures.c b/opengl/tests/textures/textures.c index 214291b..d877e74 100644 --- a/opengl/tests/textures/textures.c +++ b/opengl/tests/textures/textures.c @@ -31,7 +31,7 @@ int main(int argc, char** argv) EGL_NONE }; - EGLint numConfigs = -1; + EGLint numConfigs = -1, n=0; EGLint majorVersion; EGLint minorVersion; EGLConfig config; @@ -43,7 +43,36 @@ int main(int argc, char** argv) dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); eglInitialize(dpy, &majorVersion, &minorVersion); - eglChooseConfig(dpy, s_configAttribs, &config, 1, &numConfigs); + + // Get all the "potential match" configs... + eglGetConfigs(dpy, NULL, 0, &numConfigs); + EGLConfig* const configs = malloc(sizeof(EGLConfig)*numConfigs); + eglChooseConfig(dpy, s_configAttribs, configs, numConfigs, &n); + config = configs[0]; + if (n > 1) { + // if there is more than one candidate, go through the list + // and pick one that matches our framebuffer format + int fbSzA = 0; // should not hardcode + int fbSzR = 5; // should not hardcode + int fbSzG = 6; // should not hardcode + int fbSzB = 5; // should not hardcode + int i; + for (i=0 ; i