From 033bd95802448bc82fd6f2ebc722ff1306b578ec Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 2 Jan 2010 21:51:46 +0800 Subject: progs: Add missing EGL_RENDERABLE_TYPE for EGL demos. The default value of EGL_RENDERABLE_TYPE is EGL_OPENGL_ES_BIT. The proper values should be specified if we are not using OpenGL ES. Signed-off-by: Chia-I Wu --- progs/egl/xeglbindtex.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'progs/egl/xeglbindtex.c') diff --git a/progs/egl/xeglbindtex.c b/progs/egl/xeglbindtex.c index fdd9fe2b87b..8103a6a1484 100644 --- a/progs/egl/xeglbindtex.c +++ b/progs/egl/xeglbindtex.c @@ -53,6 +53,7 @@ make_pbuffer(int width, int height) EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8, EGL_BIND_TO_TEXTURE_RGB, EGL_TRUE, + EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, EGL_NONE }; EGLint pbuf_attribs[] = { @@ -126,6 +127,7 @@ make_window(Display *x_dpy, const char *name, EGL_BLUE_SIZE, 8, EGL_ALPHA_SIZE, 8, EGL_DEPTH_SIZE, 8, + EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, EGL_NONE }; -- cgit v1.2.3 From 3bcb08f6c472b3a7cd752c740b3bbe72c90520fd Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 2 Jan 2010 21:56:13 +0800 Subject: progs: Check the number of configs returned by eglChooseConfig. A successful eglChooseConfig call does not imply there are valid configs. Signed-off-by: Chia-I Wu --- progs/egl/xegl_tri.c | 3 ++- progs/egl/xeglbindtex.c | 6 ++++-- progs/egl/xeglthreads.c | 3 ++- progs/openvg/demos/eglcommon.c | 4 ++-- progs/openvg/demos/lion.c | 4 ++-- progs/openvg/trivial/eglcommon.c | 4 ++-- 6 files changed, 14 insertions(+), 10 deletions(-) (limited to 'progs/egl/xeglbindtex.c') diff --git a/progs/egl/xegl_tri.c b/progs/egl/xegl_tri.c index 8c4d7f973c7..1f1a005a210 100644 --- a/progs/egl/xegl_tri.c +++ b/progs/egl/xegl_tri.c @@ -139,7 +139,8 @@ make_x_window(Display *x_dpy, EGLDisplay egl_dpy, scrnum = DefaultScreen( x_dpy ); root = RootWindow( x_dpy, scrnum ); - if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) { + if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs) || + !num_configs) { printf("Error: couldn't get an EGL visual config\n"); exit(1); } diff --git a/progs/egl/xeglbindtex.c b/progs/egl/xeglbindtex.c index 8103a6a1484..7e35534f8dd 100644 --- a/progs/egl/xeglbindtex.c +++ b/progs/egl/xeglbindtex.c @@ -66,7 +66,8 @@ make_pbuffer(int width, int height) EGLConfig config; EGLint num_configs; - if (!eglChooseConfig(dpy, config_attribs, &config, 1, &num_configs)) { + if (!eglChooseConfig(dpy, config_attribs, &config, 1, &num_configs) || + !num_configs) { printf("Error: couldn't get an EGL visual config for pbuffer\n"); exit(1); } @@ -144,7 +145,8 @@ make_window(Display *x_dpy, const char *name, scrnum = DefaultScreen( x_dpy ); root = RootWindow( x_dpy, scrnum ); - if (!eglChooseConfig(dpy, attribs, &config, 1, &num_configs)) { + if (!eglChooseConfig(dpy, attribs, &config, 1, &num_configs) || + !num_configs) { printf("Error: couldn't get an EGL visual config\n"); exit(1); } diff --git a/progs/egl/xeglthreads.c b/progs/egl/xeglthreads.c index 7d056ebc6f7..5787faecb90 100644 --- a/progs/egl/xeglthreads.c +++ b/progs/egl/xeglthreads.c @@ -485,7 +485,8 @@ create_window(struct winthread *wt, EGLContext shareCtx) scrnum = DefaultScreen(wt->Dpy); root = RootWindow(wt->Dpy, scrnum); - if (!eglChooseConfig(wt->Display, attribs, &config, 1, &num_configs)) { + if (!eglChooseConfig(wt->Display, attribs, &config, 1, &num_configs) || + !num_configs) { Error("Unable to choose an EGL config"); } diff --git a/progs/openvg/demos/eglcommon.c b/progs/openvg/demos/eglcommon.c index dcec1ac4a47..0316e596c69 100644 --- a/progs/openvg/demos/eglcommon.c +++ b/progs/openvg/demos/eglcommon.c @@ -61,13 +61,13 @@ make_x_window(Display *x_dpy, EGLDisplay egl_dpy, scrnum = DefaultScreen( x_dpy ); root = RootWindow( x_dpy, scrnum ); - if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) { + if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs) || + !num_configs) { printf("Error: couldn't get an EGL visual config\n"); exit(1); } assert(config); - assert(num_configs > 0); if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) { printf("Error: eglGetConfigAttrib() failed\n"); diff --git a/progs/openvg/demos/lion.c b/progs/openvg/demos/lion.c index 3645b22bc5b..adb269bfd86 100644 --- a/progs/openvg/demos/lion.c +++ b/progs/openvg/demos/lion.c @@ -86,13 +86,13 @@ make_x_window(Display *x_dpy, EGLDisplay egl_dpy, scrnum = DefaultScreen( x_dpy ); root = RootWindow( x_dpy, scrnum ); - if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) { + if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs) || + !num_configs) { printf("Error: couldn't get an EGL visual config\n"); exit(1); } assert(config); - assert(num_configs > 0); if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) { printf("Error: eglGetConfigAttrib() failed\n"); diff --git a/progs/openvg/trivial/eglcommon.c b/progs/openvg/trivial/eglcommon.c index dcec1ac4a47..0316e596c69 100644 --- a/progs/openvg/trivial/eglcommon.c +++ b/progs/openvg/trivial/eglcommon.c @@ -61,13 +61,13 @@ make_x_window(Display *x_dpy, EGLDisplay egl_dpy, scrnum = DefaultScreen( x_dpy ); root = RootWindow( x_dpy, scrnum ); - if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) { + if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs) || + !num_configs) { printf("Error: couldn't get an EGL visual config\n"); exit(1); } assert(config); - assert(num_configs > 0); if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) { printf("Error: eglGetConfigAttrib() failed\n"); -- cgit v1.2.3 From c657c80180255b859b9229a994d111115aaf198d Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 2 Jan 2010 21:57:16 +0800 Subject: progs/egl: glGenTextures is called too early in xeglbindtex. It should be called after eglMakeCurrent. Signed-off-by: Chia-I Wu --- progs/egl/xeglbindtex.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'progs/egl/xeglbindtex.c') diff --git a/progs/egl/xeglbindtex.c b/progs/egl/xeglbindtex.c index 7e35534f8dd..de0ede92ca4 100644 --- a/progs/egl/xeglbindtex.c +++ b/progs/egl/xeglbindtex.c @@ -79,8 +79,6 @@ make_pbuffer(int width, int height) printf("failed to allocate pbuffer\n"); exit(1); } - - glGenTextures(1, &tex_pbuf); } static void @@ -114,6 +112,8 @@ use_pbuffer(void) glTranslatef(0.0, 0.0, -5.0); glClearColor(0.2, 0.2, 0.2, 0.0); + + glGenTextures(1, &tex_pbuf); } } -- cgit v1.2.3