summaryrefslogtreecommitdiffstats
path: root/progs/egl
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-06-04 11:40:25 -0600
committerBrian Paul <[email protected]>2008-06-04 11:40:25 -0600
commitbf527cc8d41c277e610d4d51d3b1394e1d417805 (patch)
tree361c4acb69b2527378831d588a812c9ce9bba38b /progs/egl
parentb9d35c7c44ddda1cc7fdd9a34a9cf4696b6baba3 (diff)
egl: fix X visual selection
Diffstat (limited to 'progs/egl')
-rw-r--r--progs/egl/xeglgears.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/progs/egl/xeglgears.c b/progs/egl/xeglgears.c
index d5fbc03410c..72ed0052832 100644
--- a/progs/egl/xeglgears.c
+++ b/progs/egl/xeglgears.c
@@ -357,7 +357,7 @@ make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
int num_visuals;
EGLContext ctx;
EGLConfig config;
- EGLint num_configs;
+ EGLint num_configs, vid;
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
@@ -373,12 +373,14 @@ make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
exit(1);
}
- /* choose X window visual similar to EGL config */
- visTemplate.screen = DefaultScreen(x_dpy);
- visTemplate.depth = 32; /* 24? */
- visInfo = XGetVisualInfo(x_dpy,
- (VisualDepthMask | VisualScreenMask),
- &visTemplate, &num_visuals);
+ if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
+ printf("Error: eglGetConfigAttrib() failed\n");
+ exit(1);
+ }
+
+ /* The X window visual must match the EGL config */
+ visTemplate.visualid = vid;
+ visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
if (!visInfo) {
printf("Error: couldn't get X visual\n");
exit(1);