summaryrefslogtreecommitdiffstats
path: root/progs/egl
diff options
context:
space:
mode:
Diffstat (limited to 'progs/egl')
-rw-r--r--progs/egl/demo1.c1
-rw-r--r--progs/egl/demo2.c14
-rw-r--r--progs/egl/demo3.c15
-rw-r--r--progs/egl/eglgears.c1
-rw-r--r--progs/egl/egltri.c1
-rw-r--r--progs/egl/xegl_tri.c4
-rw-r--r--progs/egl/xeglbindtex.c12
-rw-r--r--progs/egl/xeglthreads.c4
8 files changed, 36 insertions, 16 deletions
diff --git a/progs/egl/demo1.c b/progs/egl/demo1.c
index 34a516e72fc..d892734ee55 100644
--- a/progs/egl/demo1.c
+++ b/progs/egl/demo1.c
@@ -114,6 +114,7 @@ main(int argc, char *argv[])
PrintConfigs(d, configs, numConfigs);
+ eglBindAPI(EGL_OPENGL_API);
ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
if (ctx == EGL_NO_CONTEXT) {
printf("failed to create context\n");
diff --git a/progs/egl/demo2.c b/progs/egl/demo2.c
index 3994656721f..b9e92f62ac2 100644
--- a/progs/egl/demo2.c
+++ b/progs/egl/demo2.c
@@ -111,11 +111,7 @@ main(int argc, char *argv[])
EGL_HEIGHT, 500,
EGL_NONE
};
- const EGLint screenAttribs[] = {
- EGL_WIDTH, 1024,
- EGL_HEIGHT, 768,
- EGL_NONE
- };
+ EGLint screenAttribs[32];
EGLModeMESA mode;
EGLScreenMESA screen;
EGLint count;
@@ -149,6 +145,7 @@ main(int argc, char *argv[])
eglGetScreensMESA(d, &screen, 1, &count);
eglGetModesMESA(d, screen, &mode, 1, &count);
+ eglBindAPI(EGL_OPENGL_API);
ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
if (ctx == EGL_NO_CONTEXT) {
printf("failed to create context\n");
@@ -169,6 +166,13 @@ main(int argc, char *argv[])
b = eglMakeCurrent(d, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ i = 0;
+ screenAttribs[i++] = EGL_WIDTH;
+ eglGetModeAttribMESA(d, mode, EGL_WIDTH, &screenAttribs[i++]);
+ screenAttribs[i++] = EGL_HEIGHT;
+ eglGetModeAttribMESA(d, mode, EGL_HEIGHT, &screenAttribs[i++]);
+ screenAttribs[i] = EGL_NONE;
+
screen_surf = eglCreateScreenSurfaceMESA(d, configs[0], screenAttribs);
if (screen_surf == EGL_NO_SURFACE) {
printf("failed to create screen surface\n");
diff --git a/progs/egl/demo3.c b/progs/egl/demo3.c
index 0665fd0516e..64b9ee652cd 100644
--- a/progs/egl/demo3.c
+++ b/progs/egl/demo3.c
@@ -564,11 +564,8 @@ main(int argc, char *argv[])
EGLint numConfigs, count;
EGLBoolean b;
const GLubyte *bitmap;
- const EGLint screenAttribs[] = {
- EGL_WIDTH, 1024,
- EGL_HEIGHT, 768,
- EGL_NONE
- };
+ EGLint screenAttribs[32];
+ EGLint i;
EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
assert(d);
@@ -590,12 +587,20 @@ main(int argc, char *argv[])
eglGetScreensMESA(d, &screen, 1, &count);
eglGetModesMESA(d, screen, &mode, 1, &count);
+ eglBindAPI(EGL_OPENGL_API);
ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
if (ctx == EGL_NO_CONTEXT) {
printf("failed to create context\n");
return 0;
}
+ i = 0;
+ screenAttribs[i++] = EGL_WIDTH;
+ eglGetModeAttribMESA(d, mode, EGL_WIDTH, &screenAttribs[i++]);
+ screenAttribs[i++] = EGL_HEIGHT;
+ eglGetModeAttribMESA(d, mode, EGL_HEIGHT, &screenAttribs[i++]);
+ screenAttribs[i] = EGL_NONE;
+
screen_surf = eglCreateScreenSurfaceMESA(d, configs[0], screenAttribs);
if (screen_surf == EGL_NO_SURFACE) {
printf("failed to create screen surface\n");
diff --git a/progs/egl/eglgears.c b/progs/egl/eglgears.c
index 2d9b8cac7f7..63490953aee 100644
--- a/progs/egl/eglgears.c
+++ b/progs/egl/eglgears.c
@@ -426,6 +426,7 @@ main(int argc, char *argv[])
}
printf("eglgears: Using screen mode/size %d: %d x %d\n", chosenMode, width, height);
+ eglBindAPI(EGL_OPENGL_API);
ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
if (ctx == EGL_NO_CONTEXT) {
printf("eglgears: failed to create context\n");
diff --git a/progs/egl/egltri.c b/progs/egl/egltri.c
index 9bbc3cddaf1..006e06eb03e 100644
--- a/progs/egl/egltri.c
+++ b/progs/egl/egltri.c
@@ -208,6 +208,7 @@ int main(int argc, char *argv[])
}
printf("egltri: Using screen mode/size %d: %d x %d\n", chosenMode, width, height);
+ eglBindAPI(EGL_OPENGL_API);
ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
if (ctx == EGL_NO_CONTEXT) {
printf("egltri: failed to create context\n");
diff --git a/progs/egl/xegl_tri.c b/progs/egl/xegl_tri.c
index 65f352ddfa9..1f1a005a210 100644
--- a/progs/egl/xegl_tri.c
+++ b/progs/egl/xegl_tri.c
@@ -120,6 +120,7 @@ make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_DEPTH_SIZE, 1,
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
EGL_NONE
};
@@ -138,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 fdd9fe2b87b..de0ede92ca4 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[] = {
@@ -65,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);
}
@@ -77,8 +79,6 @@ make_pbuffer(int width, int height)
printf("failed to allocate pbuffer\n");
exit(1);
}
-
- glGenTextures(1, &tex_pbuf);
}
static void
@@ -112,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);
}
}
@@ -126,6 +128,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
};
@@ -142,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 508dbc09432..5787faecb90 100644
--- a/progs/egl/xeglthreads.c
+++ b/progs/egl/xeglthreads.c
@@ -467,6 +467,7 @@ create_window(struct winthread *wt, EGLContext shareCtx)
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_DEPTH_SIZE, 1,
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
EGL_NONE };
EGLConfig config;
EGLint num_configs;
@@ -484,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");
}