summaryrefslogtreecommitdiffstats
path: root/opengl/tests/textures
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2009-08-04 13:43:35 -0700
committerMathias Agopian <mathias@google.com>2009-08-05 12:22:29 -0700
commit429c521b15112fdcc70dca602b432fae45ca3a22 (patch)
tree9531ef4de47d0ce5845d419774408c989a5dd620 /opengl/tests/textures
parent859c37548f4ed1d466b7edc6a01e579b6b55039f (diff)
downloadframeworks_base-429c521b15112fdcc70dca602b432fae45ca3a22.zip
frameworks_base-429c521b15112fdcc70dca602b432fae45ca3a22.tar.gz
frameworks_base-429c521b15112fdcc70dca602b432fae45ca3a22.tar.bz2
opengl tests
Diffstat (limited to 'opengl/tests/textures')
-rw-r--r--opengl/tests/textures/textures.c33
1 files changed, 31 insertions, 2 deletions
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<n ; i++) {
+ EGLint r,g,b,a;
+ eglGetConfigAttrib(dpy, configs[i], EGL_RED_SIZE, &r);
+ eglGetConfigAttrib(dpy, configs[i], EGL_GREEN_SIZE, &g);
+ eglGetConfigAttrib(dpy, configs[i], EGL_BLUE_SIZE, &b);
+ eglGetConfigAttrib(dpy, configs[i], EGL_ALPHA_SIZE, &a);
+ if (fbSzA == a && fbSzR == r && fbSzG == g && fbSzB == b) {
+ config = configs[i];
+ break;
+ }
+ }
+ }
+ free(configs);
+
+
+
surface = eglCreateWindowSurface(dpy, config,
android_createDisplaySurface(), NULL);
context = eglCreateContext(dpy, config, NULL, NULL);