From: Carl Worth Date: Tue, 2 Jul 2013 20:07:40 +0000 (-0700) Subject: test: Add 4 tests using EGL and OpenGLESv2 X-Git-Url: https://git.cworth.org/git?p=fips;a=commitdiff_plain;h=0c8d32dabf4cec6957dfb4c071ecdb2fb4e4cd0e test: Add 4 tests using EGL and OpenGLESv2 These are similar variants to the four existing tests using EGL and OpenGL. To add these tests we add a new configure-time check to find the compilation flags for GLESv2. We also drop the set_2d_projection code which was using glLoadIdentity, glMatrixMode, and glOrtho functions which apparently don't exist in GLESv2. So common.s and all tests with custom wrappers are modified to drop these calls. As with the egl-opengl tests, all new tests except for the dlsym-based test pass. That's not too surprising since there are so many twisty paths in trying to get all the dlopen/dlsym stuff to work correctly. And hurrah for test suites finding bugs! --- diff --git a/configure b/configure index 77fedba..baa38a0 100755 --- a/configure +++ b/configure @@ -326,7 +326,17 @@ if pkg-config --exists egl; then egl_ldflags=$(pkg-config --libs egl) else printf "No.\n" - have_egl=No +fi + +printf " Checking for GLESv2... " +have_glesv2=No +if pkg-config --exists glesv2; then + printf "Yes.\n" + have_glesv2=Yes + glesv2_cflags=$(pkg-config --cflags glesv2) + glesv2_ldflags=$(pkg-config --libs glesv2) +else + printf "No.\n" fi printf "int main(void){return 0;}\n" > minimal.c @@ -528,10 +538,10 @@ HAVE_GLX = ${have_glx} GL_CFLAGS = ${gl_cflags} GL_LDFLAGS = ${gl_ldflags} -# Wheter X11 headers and library are available +# Whether X11 headers and library are available HAVE_X11 = ${have_x11} -# Flags needs to compile and link against libX11 +# Flags needed to compile and link against libX11 X11_CLFLAGS = ${x11_cflags} X11_LDFLAGS = ${x11_ldflags} @@ -542,6 +552,13 @@ HAVE_EGL = ${have_egl} EGL_CFLAGS = ${egl_cflags} EGL_LDFLAGS = ${egl_ldflags} +# Whether GLESv2 headers and library are available +HAVE_GLESV2 = ${have_glesv2} + +# Flags needed to compile and link against GLESv2 +GLESV2_CFLAGS = ${glesv2_cflags} +GLESV2_LDFLAGS = ${glesv2_ldflags} + # Flags needed to have linker link only to necessary libraries AS_NEEDED_LDFLAGS = ${as_needed_ldflags} EOF diff --git a/test/.gitignore b/test/.gitignore index 30ae156..be96a44 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -8,4 +8,8 @@ egl-opengl-link-call egl-opengl-link-gpa egl-opengl-dlopen-dlsym egl-opengl-dlopen-gpa +egl-glesv2-link-call +egl-glesv2-link-gpa +egl-glesv2-dlopen-dlsym +egl-glesv2-dlopen-gpa diff --git a/test/Makefile.local b/test/Makefile.local index 6274e4f..c131415 100644 --- a/test/Makefile.local +++ b/test/Makefile.local @@ -17,6 +17,10 @@ test_programs += $(dir)/egl-opengl-link-call test_programs += $(dir)/egl-opengl-link-gpa test_programs += $(dir)/egl-opengl-dlopen-dlsym test_programs += $(dir)/egl-opengl-dlopen-gpa +test_programs += $(dir)/egl-glesv2-link-call +test_programs += $(dir)/egl-glesv2-link-gpa +test_programs += $(dir)/egl-glesv2-dlopen-dlsym +test_programs += $(dir)/egl-glesv2-dlopen-gpa endif glx_link_call_srcs = \ @@ -109,6 +113,42 @@ egl_opengl_dlopen_gpa_modules = $(egl_opengl_dlopen_gpa_srcs:.c=.o) $(dir)/egl-opengl-dlopen-gpa: $(egl_opengl_dlopen_gpa_modules) $(call quiet,$(FIPS_LINKER) $(CFLAGS)) $^ -ldl $(X11_LDFLAGS) -o $@ +egl_glesv2_link_call_srcs = \ + $(dir)/egl-glesv2-link-call.c \ + $(dir)/util-x11.c + +egl_glesv2_link_call_modules = $(egl_glesv2_link_call_srcs:.c=.o) + +$(dir)/egl-glesv2-link-call: $(egl_glesv2_link_call_modules) + $(call quiet,$(FIPS_LINKER) $(CFLAGS)) $^ $(EGL_LDFLAGS) $(GLESV2_LDFLAGS) $(X11_LDFLAGS) -o $@ + +egl_glesv2_link_gpa_srcs = \ + $(dir)/egl-glesv2-link-gpa.c \ + $(dir)/util-x11.c + +egl_glesv2_link_gpa_modules = $(egl_glesv2_link_gpa_srcs:.c=.o) + +$(dir)/egl-glesv2-link-gpa: $(egl_glesv2_link_gpa_modules) + $(call quiet,$(FIPS_LINKER) $(CFLAGS)) $^ $(EGL_LDFLAGS) $(GLESV2_LDFLAGS) $(X11_LDFLAGS) -o $@ + +egl_glesv2_dlopen_dlsym_srcs = \ + $(dir)/egl-glesv2-dlopen-dlsym.c \ + $(dir)/util-x11.c + +egl_glesv2_dlopen_dlsym_modules = $(egl_glesv2_dlopen_dlsym_srcs:.c=.o) + +$(dir)/egl-glesv2-dlopen-dlsym: $(egl_glesv2_dlopen_dlsym_modules) + $(call quiet,$(FIPS_LINKER) $(CFLAGS)) $^ -ldl $(X11_LDFLAGS) -o $@ + +egl_glesv2_dlopen_gpa_srcs = \ + $(dir)/egl-glesv2-dlopen-gpa.c \ + $(dir)/util-x11.c + +egl_glesv2_dlopen_gpa_modules = $(egl_glesv2_dlopen_gpa_srcs:.c=.o) + +$(dir)/egl-glesv2-dlopen-gpa: $(egl_glesv2_dlopen_gpa_modules) + $(call quiet,$(FIPS_LINKER) $(CFLAGS)) $^ -ldl $(X11_LDFLAGS) -o $@ + test: all $(test_programs) @${dir}/fips-test @@ -123,7 +163,11 @@ SRCS := $(SRCS) \ $(egl_opengl_link_call_srcs) \ $(egl_opengl_link_gpa_srcs) \ $(egl_opengl_dlopen_dlsym_srcs) \ - $(egl_opengl_dlopen_gpa_srcs) + $(egl_opengl_dlopen_gpa_srcs) \ + $(egl_glesv2_link_call_srcs) \ + $(egl_glesv2_link_gpa_srcs) \ + $(egl_glesv2_dlopen_dlsym_srcs) \ + $(egl_glesv2_dlopen_gpa_srcs) CLEAN += $(test_programs) \ $(glx_link_call_modules) \ @@ -134,4 +178,8 @@ CLEAN += $(test_programs) \ $(egl_opengl_link_call_modules) \ $(egl_opengl_link_gpa_modules) \ $(egl_opengl_dlopen_dlsym_modules) \ - $(egl_opengl_dlopen_dlsym_modules) + $(egl_opengl_dlopen_dlsym_modules) \ + $(egl_glesv2_link_call_modules) \ + $(egl_glesv2_link_gpa_modules) \ + $(egl_glesv2_dlopen_dlsym_modules) \ + $(egl_glesv2_dlopen_dlsym_modules) diff --git a/test/common.c b/test/common.c index 1eecc18..dccc909 100644 --- a/test/common.c +++ b/test/common.c @@ -89,15 +89,6 @@ #define _(func) concat(COMMON_GL_PREFIX, func) #define _E(func) concat(COMMON_EGL_PREFIX, func) -static void -set_2d_projection (int width, int height) -{ - _(glMatrixMode) (GL_PROJECTION); - _(glLoadIdentity) (); - _(glOrtho) (0, width, height, 0, 0, 1); - _(glMatrixMode) (GL_MODELVIEW); -} - static void paint_rgb_using_clear (double r, double g, double b) { @@ -125,9 +116,14 @@ common_create_egl_context (Display *dpy, EGLenum api, EGLDisplay *egl_dpy_ret, int num_configs; EGLint major, minor; EGLBoolean success; - int context_attr[] = { + int opengl_context_attr[] = { EGL_NONE }; + int glesv2_context_attr[] = { + EGL_CONTEXT_CLIENT_VERSION, 2, + EGL_NONE + }; + int *context_attr; EGLContext ctx; XVisualInfo *visual_info, visual_attr; int visualid, num_visuals; @@ -161,6 +157,10 @@ common_create_egl_context (Display *dpy, EGLenum api, EGLDisplay *egl_dpy_ret, _E(eglBindAPI) (api); + if (api == EGL_OPENGL_ES_API) + context_attr = glesv2_context_attr; + else + context_attr = opengl_context_attr; ctx = _E(eglCreateContext) (egl_dpy, config, NULL, context_attr); if (!ctx) { fprintf (stderr, "Error: Failed to create EGL context\n"); @@ -216,8 +216,6 @@ draw (COMMON_SWAP_DISPLAY dpy, COMMON_SWAP_WINDOW window, int width, int height) int i; _(glViewport) (0, 0, width, height); - set_2d_projection (width, height); - /* Simply count through some colors, frame by frame. */ #define RGB(frame) (((frame+1)/4) % 2), (((frame+1)/2) % 2), ((frame+1) % 2) diff --git a/test/egl-glesv2-dlopen-dlsym.c b/test/egl-glesv2-dlopen-dlsym.c new file mode 100644 index 0000000..2488d11 --- /dev/null +++ b/test/egl-glesv2-dlopen-dlsym.c @@ -0,0 +1,195 @@ +/* Copyright © 2013, Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +/* Perform some simple drawing via OpenGL as follows: + * + * 1. Using EGL to construct an OpenGLESv2 context + * 2. By using dlopen to dynamically load libGLESv2.so and libEGL.so + * 3. By using dlsym to lookup OpenGL functions + */ + +#define GL_GLEXT_PROTOTYPES +#include +#include + +#include +#include +#include + +#include "util-x11.h" + +EGLBoolean (*my_eglBindAPI)(EGLenum); +EGLBoolean (*my_eglChooseConfig)(EGLDisplay, EGLint const *, EGLConfig *, EGLint, EGLint *); +EGLContext (*my_eglCreateContext)(EGLDisplay, EGLConfig, EGLContext, EGLint const *); +EGLSurface (*my_eglCreateWindowSurface)(EGLDisplay, EGLConfig, NativeWindowType, EGLint const *); +EGLBoolean (*my_eglGetConfigAttrib)(EGLDisplay, EGLConfig, EGLint, EGLint *); +EGLDisplay (*my_eglGetDisplay)(NativeDisplayType); +EGLBoolean (*my_eglInitialize)(EGLDisplay, EGLint *, EGLint *); +EGLBoolean (*my_eglMakeCurrent)(EGLDisplay, EGLSurface, EGLSurface, EGLContext); +EGLBoolean (*my_eglSwapBuffers)(EGLDisplay, EGLSurface); +void (*my_glClear)(GLbitfield); +void (*my_glClearColor)(GLclampf, GLclampf, GLclampf, GLclampf); +void (*my_glViewport)(GLint, GLint, GLsizei, GLsizei); + +#define COMMON_USE_EGL +#define COMMON_GL_PREFIX my_ +#define COMMON_EGL_PREFIX my_ +#include "common.c" + +static void +resolve_symbols (void) +{ + void *glesv2_handle; + void *egl_handle; + char *error; + + glesv2_handle = dlopen ("libGLESv2.so", RTLD_LAZY); + if (glesv2_handle == NULL) { + fprintf (stderr, "Error: Failed to open libGL.so\n"); + exit (1); + } + + egl_handle = dlopen ("libEGL.so", RTLD_LAZY); + if (egl_handle == NULL) { + fprintf (stderr, "Error: Failed to open libEGL.so\n"); + exit (1); + } + + /* Clear errors. */ + dlerror(); + + my_eglBindAPI = dlsym (egl_handle, "eglBindAPI"); + error = dlerror (); + if (error) { + fprintf (stderr, "Failed to dlsym eglBindAPI: %s\n", error); + exit (1); + } + + my_eglChooseConfig = dlsym (egl_handle, "eglChooseConfig"); + error = dlerror (); + if (error) { + fprintf (stderr, "Failed to dlsym eglChooseConfig: %s\n", error); + exit (1); + } + + my_eglCreateContext = dlsym (egl_handle, "eglCreateContext"); + error = dlerror (); + if (error) { + fprintf (stderr, "Failed to dlsym eglCreateContext: %s\n", error); + exit (1); + } + + my_eglCreateWindowSurface = dlsym (egl_handle, "eglCreateWindowSurface"); + error = dlerror (); + if (error) { + fprintf (stderr, "Failed to dlsym eglCreateWindowSurface: %s\n", error); + exit (1); + } + + my_eglGetConfigAttrib = dlsym (egl_handle, "eglGetConfigAttrib"); + error = dlerror (); + if (error) { + fprintf (stderr, "Failed to dlsym eglGetConfigAttrib: %s\n", error); + exit (1); + } + + my_eglGetDisplay = dlsym (egl_handle, "eglGetDisplay"); + error = dlerror (); + if (error) { + fprintf (stderr, "Failed to dlsym eglGetDisplay: %s\n", error); + exit (1); + } + + my_eglInitialize = dlsym (egl_handle, "eglInitialize"); + error = dlerror (); + if (error) { + fprintf (stderr, "Failed to dlsym eglInitialize: %s\n", error); + exit (1); + } + + my_eglMakeCurrent = dlsym (egl_handle, "eglMakeCurrent"); + error = dlerror (); + if (error) { + fprintf (stderr, "Failed to dlsym eglMakeCurrent: %s\n", error); + exit (1); + } + + my_eglSwapBuffers = dlsym (egl_handle, "eglSwapBuffers"); + error = dlerror (); + if (error) { + fprintf (stderr, "Failed to dlsym eglSwapBuffers: %s\n", error); + exit (1); + } + + my_glClear = dlsym (glesv2_handle, "glClear"); + error = dlerror (); + if (error) { + fprintf (stderr, "Failed to dlsym glClear: %s\n", error); + exit (1); + } + + my_glClearColor = dlsym (glesv2_handle, "glClearColor"); + error = dlerror (); + if (error) { + fprintf (stderr, "Failed to dlsym glClearColor: %s\n", error); + exit (1); + } + + my_glViewport = dlsym (glesv2_handle, "glViewport"); + error = dlerror (); + if (error) { + fprintf (stderr, "Failed to dlsym glViewport: %s\n", error); + exit (1); + } +} + +int +main (void) +{ + Display *dpy; + Window window; + EGLDisplay egl_dpy; + EGLContext ctx; + EGLConfig config; + EGLSurface surface; + XVisualInfo *visual_info; + + resolve_symbols (); + + dpy = util_x11_init_display (); + + common_create_egl_context (dpy, EGL_OPENGL_ES_API, &egl_dpy, + &ctx, &config, &visual_info); + + window = util_x11_init_window (dpy, visual_info); + + surface = my_eglCreateWindowSurface (egl_dpy, config, window, NULL); + + common_make_current (egl_dpy, ctx, surface); + + common_handle_events (dpy, egl_dpy, surface); + + util_x11_fini_window (dpy, window); + + util_x11_fini_display (dpy); + + return 0; +} diff --git a/test/egl-glesv2-dlopen-gpa.c b/test/egl-glesv2-dlopen-gpa.c new file mode 100644 index 0000000..52e9f0e --- /dev/null +++ b/test/egl-glesv2-dlopen-gpa.c @@ -0,0 +1,209 @@ +/* Copyright © 2013, Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +/* Perform some simple drawing via OpenGL as follows: + * + * 1. Using EGL to construct an OpenGLESv2 context + * 2. By using dlopen to dynamically load libGLESv2.so + * 3. By using eglGetProcAddress to lookup OpenGL functions + */ + +#define GL_GLEXT_PROTOTYPES +#include +#include + +#include +#include +#include + +#include "util-x11.h" + +EGLBoolean (*my_eglBindAPI)(EGLenum); +EGLBoolean (*my_eglChooseConfig)(EGLDisplay, EGLint const *, EGLConfig *, EGLint, EGLint *); +EGLContext (*my_eglCreateContext)(EGLDisplay, EGLConfig, EGLContext, EGLint const *); +EGLSurface (*my_eglCreateWindowSurface)(EGLDisplay, EGLConfig, NativeWindowType, EGLint const *); +EGLBoolean (*my_eglGetConfigAttrib)(EGLDisplay, EGLConfig, EGLint, EGLint *); +EGLDisplay (*my_eglGetDisplay)(NativeDisplayType); +void * (*my_eglGetProcAddress)(char const *); +EGLBoolean (*my_eglInitialize)(EGLDisplay, EGLint *, EGLint *); +EGLBoolean (*my_eglMakeCurrent)(EGLDisplay, EGLSurface, EGLSurface, EGLContext); +EGLBoolean (*my_eglSwapBuffers)(EGLDisplay, EGLSurface); + +/* The OpenGL header files give typedefs for the types of all + * functions provided by etensisons. Here, though, we're using + * glxGetProcAddress to lookup core functions, so we provide our own + * typedefs. */ +typedef void (*FIPS_GLCLEAR_FN)(GLbitfield); +FIPS_GLCLEAR_FN my_glClear; + +typedef void (*FIPS_GLCLEARCOLOR_FN)(GLclampf, GLclampf, GLclampf, GLclampf); +FIPS_GLCLEARCOLOR_FN my_glClearColor; + +typedef void (*FIPS_GLVIEWPORT_FN)(GLint, GLint, GLsizei, GLsizei); +FIPS_GLVIEWPORT_FN my_glViewport; + +#define COMMON_USE_EGL +#define COMMON_GL_PREFIX my_ +#define COMMON_EGL_PREFIX my_ +#include "common.c" + +static void +resolve_symbols (void) +{ + void *egl_handle, *glesv2_handle; + char *error; + + egl_handle = dlopen ("libEGL.so", RTLD_LAZY); + if (egl_handle == NULL) { + fprintf (stderr, "Error: Failed to open libEGL.so\n"); + exit (1); + } + + glesv2_handle = dlopen ("libGLESv2.so", RTLD_LAZY); + if (glesv2_handle == NULL) { + fprintf (stderr, "Error: Failed to open libGLESv2.so\n"); + exit (1); + } + + /* Clear errors. */ + dlerror(); + + my_eglBindAPI = dlsym (egl_handle, "eglBindAPI"); + error = dlerror (); + if (error) { + fprintf (stderr, "Failed to dlsym eglBindAPI: %s\n", error); + exit (1); + } + + my_eglChooseConfig = dlsym (egl_handle, "eglChooseConfig"); + error = dlerror (); + if (error) { + fprintf (stderr, "Failed to dlsym eglChooseConfig: %s\n", error); + exit (1); + } + + my_eglCreateContext = dlsym (egl_handle, "eglCreateContext"); + error = dlerror (); + if (error) { + fprintf (stderr, "Failed to dlsym eglCreateContext: %s\n", error); + exit (1); + } + + my_eglCreateWindowSurface = dlsym (egl_handle, "eglCreateWindowSurface"); + error = dlerror (); + if (error) { + fprintf (stderr, "Failed to dlsym eglCreateWindowSurface: %s\n", error); + exit (1); + } + + my_eglGetConfigAttrib = dlsym (egl_handle, "eglGetConfigAttrib"); + error = dlerror (); + if (error) { + fprintf (stderr, "Failed to dlsym eglGetConfigAttrib: %s\n", error); + exit (1); + } + + my_eglGetDisplay = dlsym (egl_handle, "eglGetDisplay"); + error = dlerror (); + if (error) { + fprintf (stderr, "Failed to dlsym eglGetDisplay: %s\n", error); + exit (1); + } + + my_eglGetProcAddress = dlsym (egl_handle, "eglGetProcAddress"); + error = dlerror (); + if (error) { + fprintf (stderr, "Failed to dlsym eglGetProcAddress: %s\n", error); + exit (1); + } + + my_eglInitialize = dlsym (egl_handle, "eglInitialize"); + error = dlerror (); + if (error) { + fprintf (stderr, "Failed to dlsym eglInitialize: %s\n", error); + exit (1); + } + + my_eglMakeCurrent = dlsym (egl_handle, "eglMakeCurrent"); + error = dlerror (); + if (error) { + fprintf (stderr, "Failed to dlsym eglMakeCurrent: %s\n", error); + exit (1); + } + + my_eglSwapBuffers = dlsym (egl_handle, "eglSwapBuffers"); + error = dlerror (); + if (error) { + fprintf (stderr, "Failed to dlsym eglSwapBuffers: %s\n", error); + exit (1); + } + + my_glClear = (FIPS_GLCLEAR_FN) my_eglGetProcAddress ("glClear"); + if (my_glClear == NULL) { + fprintf (stderr, "Failed to eglGetProcAddress glClear\n"); + exit (1); + } + + my_glClearColor = (FIPS_GLCLEARCOLOR_FN) my_eglGetProcAddress ("glClearColor"); + if (my_glClearColor == NULL) { + fprintf (stderr, "Failed to eglGetProcAddress glClearColor\n"); + exit (1); + } + + my_glViewport = (FIPS_GLVIEWPORT_FN) my_eglGetProcAddress ("glViewport"); + if (my_glViewport == NULL) { + fprintf (stderr, "Failed to eglGetProcAddress glViewport\n"); + exit (1); + } +} + +int +main (void) +{ + Display *dpy; + Window window; + EGLDisplay egl_dpy; + EGLContext ctx; + EGLConfig config; + EGLSurface surface; + XVisualInfo *visual_info; + + resolve_symbols (); + + dpy = util_x11_init_display (); + + common_create_egl_context (dpy, EGL_OPENGL_ES_API, &egl_dpy, + &ctx, &config, &visual_info); + + window = util_x11_init_window (dpy, visual_info); + + surface = my_eglCreateWindowSurface (egl_dpy, config, window, NULL); + + common_make_current (egl_dpy, ctx, surface); + + common_handle_events (dpy, egl_dpy, surface); + + util_x11_fini_window (dpy, window); + + util_x11_fini_display (dpy); + + return 0; +} diff --git a/test/egl-glesv2-link-call.c b/test/egl-glesv2-link-call.c new file mode 100644 index 0000000..7faa3e2 --- /dev/null +++ b/test/egl-glesv2-link-call.c @@ -0,0 +1,68 @@ +/* Copyright © 2013, Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +/* Perform some simple drawing via OpenGL as follows: + * + * 1. Using EGL to construct an OpenGLESv2 context + * 2. By directly linking with libEGL.so and libGLESv2.so + * 3. By directly calling OpenGL functions + */ + +#include +#include + +#include "util-x11.h" + +#define COMMON_USE_EGL +#define COMMON_GL_PREFIX +#define COMMON_EGL_PREFIX +#include "common.c" + +int +main (void) +{ + Display *dpy; + Window window; + EGLDisplay egl_dpy; + EGLContext ctx; + EGLConfig config; + EGLSurface surface; + XVisualInfo *visual_info; + + dpy = util_x11_init_display (); + + common_create_egl_context (dpy, EGL_OPENGL_ES_API, &egl_dpy, + &ctx, &config, &visual_info); + + window = util_x11_init_window (dpy, visual_info); + + surface = eglCreateWindowSurface (egl_dpy, config, window, NULL); + + common_make_current (egl_dpy, ctx, surface); + + common_handle_events (dpy, egl_dpy, surface); + + util_x11_fini_window (dpy, window); + + util_x11_fini_display (dpy); + + return 0; +} diff --git a/test/egl-glesv2-link-gpa.c b/test/egl-glesv2-link-gpa.c new file mode 100644 index 0000000..a09ad8e --- /dev/null +++ b/test/egl-glesv2-link-gpa.c @@ -0,0 +1,109 @@ +/* Copyright © 2013, Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +/* Perform some simple drawing via OpenGL as follows: + * + * 1. Using EGL to construct an OpenGLESv2 context + * 2. By directly linking with libEGL.so and libGLESv2.so + * 3. By using eglGetProcAddress to lookup OpenGL functions + */ + +#define GL_GLEXT_PROTOTYPES +#include +#include + +#include +#include + +#include "util-x11.h" + +/* The OpenGL header files give typedefs for the types of all + * functions provided by etensisons. Here, though, we're using + * glxGetProcAddress to lookup core functions, so we provide our own + * typedefs. */ +typedef void (*FIPS_GLCLEAR_FN)(GLbitfield); +FIPS_GLCLEAR_FN my_glClear; + +typedef void (*FIPS_GLCLEARCOLOR_FN)(GLclampf, GLclampf, GLclampf, GLclampf); +FIPS_GLCLEARCOLOR_FN my_glClearColor; + +typedef void (*FIPS_GLVIEWPORT_FN)(GLint, GLint, GLsizei, GLsizei); +FIPS_GLVIEWPORT_FN my_glViewport; + +#define COMMON_USE_EGL +#define COMMON_GL_PREFIX my_ +#define COMMON_EGL_PREFIX +#include "common.c" + +static void +resolve_symbols (void) +{ + my_glClear = (FIPS_GLCLEAR_FN) eglGetProcAddress ("glClear"); + if (my_glClear == NULL) { + fprintf (stderr, "Failed to eglGetProcAddress glClear\n"); + exit (1); + } + + my_glClearColor = (FIPS_GLCLEARCOLOR_FN) eglGetProcAddress ("glClearColor"); + if (my_glClearColor == NULL) { + fprintf (stderr, "Failed to eglGetProcAddress glClearColor\n"); + exit (1); + } + + my_glViewport = (FIPS_GLVIEWPORT_FN) eglGetProcAddress ("glViewport"); + if (my_glViewport == NULL) { + fprintf (stderr, "Failed to eglGetProcAddress glViewport\n"); + exit (1); + } +} + +int +main (void) +{ + Display *dpy; + Window window; + EGLDisplay egl_dpy; + EGLContext ctx; + EGLConfig config; + EGLSurface surface; + XVisualInfo *visual_info; + + resolve_symbols (); + + dpy = util_x11_init_display (); + + common_create_egl_context (dpy, EGL_OPENGL_ES_API, &egl_dpy, + &ctx, &config, &visual_info); + + window = util_x11_init_window (dpy, visual_info); + + surface = eglCreateWindowSurface (egl_dpy, config, window, NULL); + + common_make_current (egl_dpy, ctx, surface); + + common_handle_events (dpy, egl_dpy, surface); + + util_x11_fini_window (dpy, window); + + util_x11_fini_display (dpy); + + return 0; +} diff --git a/test/egl-opengl-dlopen-dlsym.c b/test/egl-opengl-dlopen-dlsym.c index 803d10d..f27178e 100644 --- a/test/egl-opengl-dlopen-dlsym.c +++ b/test/egl-opengl-dlopen-dlsym.c @@ -47,9 +47,6 @@ EGLBoolean (*my_eglMakeCurrent)(EGLDisplay, EGLSurface, EGLSurface, EGLContext); EGLBoolean (*my_eglSwapBuffers)(EGLDisplay, EGLSurface); void (*my_glClear)(GLbitfield); void (*my_glClearColor)(GLclampf, GLclampf, GLclampf, GLclampf); -void (*my_glLoadIdentity)(void); -void (*my_glMatrixMode)(GLenum); -void (*my_glOrtho)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble); void (*my_glViewport)(GLint, GLint, GLsizei, GLsizei); #define COMMON_USE_EGL @@ -156,27 +153,6 @@ resolve_symbols (void) exit (1); } - my_glLoadIdentity = dlsym (gl_handle, "glLoadIdentity"); - error = dlerror (); - if (error) { - fprintf (stderr, "Failed to dlsym glLoadIdentity: %s\n", error); - exit (1); - } - - my_glMatrixMode = dlsym (gl_handle, "glMatrixMode"); - error = dlerror (); - if (error) { - fprintf (stderr, "Failed to dlsym glMatrixMode: %s\n", error); - exit (1); - } - - my_glOrtho = dlsym (gl_handle, "glOrtho"); - error = dlerror (); - if (error) { - fprintf (stderr, "Failed to dlsym glOrtho: %s\n", error); - exit (1); - } - my_glViewport = dlsym (gl_handle, "glViewport"); error = dlerror (); if (error) { diff --git a/test/egl-opengl-dlopen-gpa.c b/test/egl-opengl-dlopen-gpa.c index 7923dcb..32cce04 100644 --- a/test/egl-opengl-dlopen-gpa.c +++ b/test/egl-opengl-dlopen-gpa.c @@ -57,15 +57,6 @@ FIPS_GLCLEAR_FN my_glClear; typedef void (*FIPS_GLCLEARCOLOR_FN)(GLclampf, GLclampf, GLclampf, GLclampf); FIPS_GLCLEARCOLOR_FN my_glClearColor; -typedef void (*FIPS_GLLOADIDENTITY_FN)(void); -FIPS_GLLOADIDENTITY_FN my_glLoadIdentity; - -typedef void (*FIPS_GLMATRIXMODE_FN)(GLenum); -FIPS_GLMATRIXMODE_FN my_glMatrixMode; - -typedef void (*FIPS_GLORTHO_FN)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble); -FIPS_GLORTHO_FN my_glOrtho; - typedef void (*FIPS_GLVIEWPORT_FN)(GLint, GLint, GLsizei, GLsizei); FIPS_GLVIEWPORT_FN my_glViewport; @@ -177,24 +168,6 @@ resolve_symbols (void) exit (1); } - my_glLoadIdentity = (FIPS_GLLOADIDENTITY_FN) my_eglGetProcAddress ("glLoadIdentity"); - if (my_glLoadIdentity == NULL) { - fprintf (stderr, "Failed to eglGetProcAddress glLoadIdentity\n"); - exit (1); - } - - my_glMatrixMode = (FIPS_GLMATRIXMODE_FN) my_eglGetProcAddress ("glMatrixMode"); - if (my_glMatrixMode == NULL) { - fprintf (stderr, "Failed to eglGetProcAddress glMatrixMode\n"); - exit (1); - } - - my_glOrtho = (FIPS_GLORTHO_FN) my_eglGetProcAddress ("glOrtho"); - if (my_glOrtho == NULL) { - fprintf (stderr, "Failed to eglGetProcAddress glOrtho\n"); - exit (1); - } - my_glViewport = (FIPS_GLVIEWPORT_FN) my_eglGetProcAddress ("glViewport"); if (my_glViewport == NULL) { fprintf (stderr, "Failed to eglGetProcAddress glViewport\n"); diff --git a/test/egl-opengl-link-gpa.c b/test/egl-opengl-link-gpa.c index 7106e96..3fb7853 100644 --- a/test/egl-opengl-link-gpa.c +++ b/test/egl-opengl-link-gpa.c @@ -45,15 +45,6 @@ FIPS_GLCLEAR_FN my_glClear; typedef void (*FIPS_GLCLEARCOLOR_FN)(GLclampf, GLclampf, GLclampf, GLclampf); FIPS_GLCLEARCOLOR_FN my_glClearColor; -typedef void (*FIPS_GLLOADIDENTITY_FN)(void); -FIPS_GLLOADIDENTITY_FN my_glLoadIdentity; - -typedef void (*FIPS_GLMATRIXMODE_FN)(GLenum); -FIPS_GLMATRIXMODE_FN my_glMatrixMode; - -typedef void (*FIPS_GLORTHO_FN)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble); -FIPS_GLORTHO_FN my_glOrtho; - typedef void (*FIPS_GLVIEWPORT_FN)(GLint, GLint, GLsizei, GLsizei); FIPS_GLVIEWPORT_FN my_glViewport; @@ -77,24 +68,6 @@ resolve_symbols (void) exit (1); } - my_glLoadIdentity = (FIPS_GLLOADIDENTITY_FN) eglGetProcAddress ("glLoadIdentity"); - if (my_glLoadIdentity == NULL) { - fprintf (stderr, "Failed to eglGetProcAddress glLoadIdentity\n"); - exit (1); - } - - my_glMatrixMode = (FIPS_GLMATRIXMODE_FN) eglGetProcAddress ("glMatrixMode"); - if (my_glMatrixMode == NULL) { - fprintf (stderr, "Failed to eglGetProcAddress glMatrixMode\n"); - exit (1); - } - - my_glOrtho = (FIPS_GLORTHO_FN) eglGetProcAddress ("glOrtho"); - if (my_glOrtho == NULL) { - fprintf (stderr, "Failed to eglGetProcAddress glOrtho\n"); - exit (1); - } - my_glViewport = (FIPS_GLVIEWPORT_FN) eglGetProcAddress ("glViewport"); if (my_glViewport == NULL) { fprintf (stderr, "Failed to eglGetProcAddress glViewport\n"); diff --git a/test/fips-test b/test/fips-test index 331b87a..ec18138 100755 --- a/test/fips-test +++ b/test/fips-test @@ -44,10 +44,10 @@ test glx-dlopen-gpa printf "Testing GLX dlopen(libGL) glXGetProcAddressARB ... " test glx-dlopen-gpaa -printf "Testing EGL/OpenGL link to libEGL direct calls ... " +printf "Testing EGL/OpenGL link to libGL direct calls ... " test egl-opengl-link-call -printf "Testing EGL/OpenGL link to libEGL eglGetProcAddress ... " +printf "Testing EGL/OpenGL link to libGL eglGetProcAddress ... " test egl-opengl-link-gpa printf "Testing EGL/OpenGL dlopen(libGL) dlsym ... " @@ -56,6 +56,18 @@ test egl-opengl-dlopen-dlsym printf "Testing EGL/OpenGL dlopen(libGL) eglGetProcAddress ... " test egl-opengl-dlopen-gpa +printf "Testing EGL/GLESv2 link libGLESv2 direct calls ... " +test egl-glesv2-link-call + +printf "Testing EGL/GLESv2 link libGLESv2 eglGetProcAddress ... " +test egl-glesv2-link-gpa + +printf "Testing EGL/GLESv2 dlopen(GLESv2) dlsym ... " +test egl-glesv2-dlopen-dlsym + +printf "Testing EGL/GLESv2 dlopen(GLESv2) eglGetProcAddress ... " +test egl-glesv2-dlopen-gpa + echo "" if [ $errors -gt 0 ]; then diff --git a/test/glx-dlopen-dlsym.c b/test/glx-dlopen-dlsym.c index 6252c61..dd61523 100644 --- a/test/glx-dlopen-dlsym.c +++ b/test/glx-dlopen-dlsym.c @@ -38,9 +38,6 @@ void (*my_glClear) (GLbitfield); void (*my_glClearColor) (GLclampf, GLclampf, GLclampf, GLclampf); -void (*my_glLoadIdentity) (void); -void (*my_glMatrixMode) (GLenum); -void (*my_glOrtho) (GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble); void (*my_glViewport) (GLint, GLint, GLsizei, GLsizei); XVisualInfo * (*my_glXChooseVisual) (Display *, int, int *); GLXContext (*my_glXCreateContext) (Display *, XVisualInfo *, GLXContext, Bool); @@ -80,27 +77,6 @@ resolve_symbols (void) exit (1); } - my_glLoadIdentity = dlsym (gl_handle, "glLoadIdentity"); - error = dlerror (); - if (error) { - fprintf (stderr, "Failed to dlsym glLoadIdentity: %s\n", error); - exit (1); - } - - my_glMatrixMode = dlsym (gl_handle, "glMatrixMode"); - error = dlerror (); - if (error) { - fprintf (stderr, "Failed to dlsym glMatrixMode: %s\n", error); - exit (1); - } - - my_glOrtho = dlsym (gl_handle, "glOrtho"); - error = dlerror (); - if (error) { - fprintf (stderr, "Failed to dlsym glOrtho: %s\n", error); - exit (1); - } - my_glViewport = dlsym (gl_handle, "glViewport"); error = dlerror (); if (error) { diff --git a/test/glx-dlopen-gpa.c b/test/glx-dlopen-gpa.c index 514f671..9028023 100644 --- a/test/glx-dlopen-gpa.c +++ b/test/glx-dlopen-gpa.c @@ -39,9 +39,6 @@ void* (*my_glXGetProcAddress) (char *); void (*my_glClear) (GLbitfield); void (*my_glClearColor) (GLclampf, GLclampf, GLclampf, GLclampf); -void (*my_glLoadIdentity) (void); -void (*my_glMatrixMode) (GLenum); -void (*my_glOrtho) (GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble); void (*my_glViewport) (GLint, GLint, GLsizei, GLsizei); XVisualInfo * (*my_glXChooseVisual) (Display *, int, int *); GLXContext (*my_glXCreateContext) (Display *, XVisualInfo *, GLXContext, Bool); @@ -86,24 +83,6 @@ resolve_symbols (void) exit (1); } - my_glLoadIdentity = my_glXGetProcAddress ("glLoadIdentity"); - if (my_glLoadIdentity == NULL) { - fprintf (stderr, "Failed to glXGetProcAddress glLoadIdentity\n"); - exit (1); - } - - my_glMatrixMode = my_glXGetProcAddress ("glMatrixMode"); - if (my_glMatrixMode == NULL) { - fprintf (stderr, "Failed to glXGetProcAddress glMatrixMode\n"); - exit (1); - } - - my_glOrtho = my_glXGetProcAddress ("glOrtho"); - if (my_glOrtho == NULL) { - fprintf (stderr, "Failed to glXGetProcAddress glOrtho\n"); - exit (1); - } - my_glViewport = my_glXGetProcAddress ("glViewport"); if (my_glViewport == NULL) { fprintf (stderr, "Failed to glXGetProcAddress glViewport\n"); diff --git a/test/glx-dlopen-gpaa.c b/test/glx-dlopen-gpaa.c index 61129a1..cd4595b 100644 --- a/test/glx-dlopen-gpaa.c +++ b/test/glx-dlopen-gpaa.c @@ -39,9 +39,6 @@ void* (*my_glXGetProcAddressARB) (char *); void (*my_glClear) (GLbitfield); void (*my_glClearColor) (GLclampf, GLclampf, GLclampf, GLclampf); -void (*my_glLoadIdentity) (void); -void (*my_glMatrixMode) (GLenum); -void (*my_glOrtho) (GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble); void (*my_glViewport) (GLint, GLint, GLsizei, GLsizei); XVisualInfo * (*my_glXChooseVisual) (Display *, int, int *); GLXContext (*my_glXCreateContext) (Display *, XVisualInfo *, GLXContext, Bool); @@ -86,24 +83,6 @@ resolve_symbols (void) exit (1); } - my_glLoadIdentity = my_glXGetProcAddressARB ("glLoadIdentity"); - if (my_glLoadIdentity == NULL) { - fprintf (stderr, "Failed to glXGetProcAddressARB glLoadIdentity\n"); - exit (1); - } - - my_glMatrixMode = my_glXGetProcAddressARB ("glMatrixMode"); - if (my_glMatrixMode == NULL) { - fprintf (stderr, "Failed to glXGetProcAddressARB glMatrixMode\n"); - exit (1); - } - - my_glOrtho = my_glXGetProcAddressARB ("glOrtho"); - if (my_glOrtho == NULL) { - fprintf (stderr, "Failed to glXGetProcAddressARB glOrtho\n"); - exit (1); - } - my_glViewport = my_glXGetProcAddressARB ("glViewport"); if (my_glViewport == NULL) { fprintf (stderr, "Failed to glXGetProcAddressARB glViewport\n"); diff --git a/test/glx-link-gpa.c b/test/glx-link-gpa.c index 83e00a3..3b19b1e 100644 --- a/test/glx-link-gpa.c +++ b/test/glx-link-gpa.c @@ -45,15 +45,6 @@ FIPS_GLCLEAR_FN my_glClear; typedef void (*FIPS_GLCLEARCOLOR_FN)(GLclampf, GLclampf, GLclampf, GLclampf); FIPS_GLCLEARCOLOR_FN my_glClearColor; -typedef void (*FIPS_GLLOADIDENTITY_FN)(void); -FIPS_GLLOADIDENTITY_FN my_glLoadIdentity; - -typedef void (*FIPS_GLMATRIXMODE_FN)(GLenum); -FIPS_GLMATRIXMODE_FN my_glMatrixMode; - -typedef void (*FIPS_GLORTHO_FN)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble); -FIPS_GLORTHO_FN my_glOrtho; - typedef void (*FIPS_GLVIEWPORT_FN)(GLint, GLint, GLsizei, GLsizei); FIPS_GLVIEWPORT_FN my_glViewport; @@ -90,24 +81,6 @@ resolve_symbols (void) exit (1); } - my_glLoadIdentity = (FIPS_GLLOADIDENTITY_FN) glXGetProcAddress ((GLubyte*) "glLoadIdentity"); - if (my_glLoadIdentity == NULL) { - fprintf (stderr, "Failed to glXGetProcAddress glLoadIdentity\n"); - exit (1); - } - - my_glMatrixMode = (FIPS_GLMATRIXMODE_FN) glXGetProcAddress ((GLubyte*) "glMatrixMode"); - if (my_glMatrixMode == NULL) { - fprintf (stderr, "Failed to glXGetProcAddress glMatrixMode\n"); - exit (1); - } - - my_glOrtho = (FIPS_GLORTHO_FN) glXGetProcAddress ((GLubyte*) "glOrtho"); - if (my_glOrtho == NULL) { - fprintf (stderr, "Failed to glXGetProcAddress glOrtho\n"); - exit (1); - } - my_glViewport = (FIPS_GLVIEWPORT_FN) glXGetProcAddress ((GLubyte*) "glViewport"); if (my_glViewport == NULL) { fprintf (stderr, "Failed to glXGetProcAddress glViewport\n"); diff --git a/test/glx-link-gpaa.c b/test/glx-link-gpaa.c index 91e5e87..266c564 100644 --- a/test/glx-link-gpaa.c +++ b/test/glx-link-gpaa.c @@ -45,15 +45,6 @@ FIPS_GLCLEAR_FN my_glClear; typedef void (*FIPS_GLCLEARCOLOR_FN)(GLclampf, GLclampf, GLclampf, GLclampf); FIPS_GLCLEARCOLOR_FN my_glClearColor; -typedef void (*FIPS_GLLOADIDENTITY_FN)(void); -FIPS_GLLOADIDENTITY_FN my_glLoadIdentity; - -typedef void (*FIPS_GLMATRIXMODE_FN)(GLenum); -FIPS_GLMATRIXMODE_FN my_glMatrixMode; - -typedef void (*FIPS_GLORTHO_FN)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble); -FIPS_GLORTHO_FN my_glOrtho; - typedef void (*FIPS_GLVIEWPORT_FN)(GLint, GLint, GLsizei, GLsizei); FIPS_GLVIEWPORT_FN my_glViewport; @@ -90,24 +81,6 @@ resolve_symbols (void) exit (1); } - my_glLoadIdentity = (FIPS_GLLOADIDENTITY_FN) glXGetProcAddressARB ((GLubyte*) "glLoadIdentity"); - if (my_glLoadIdentity == NULL) { - fprintf (stderr, "Failed to glXGetProcAddressARB glLoadIdentity\n"); - exit (1); - } - - my_glMatrixMode = (FIPS_GLMATRIXMODE_FN) glXGetProcAddressARB ((GLubyte*) "glMatrixMode"); - if (my_glMatrixMode == NULL) { - fprintf (stderr, "Failed to glXGetProcAddressARB glMatrixMode\n"); - exit (1); - } - - my_glOrtho = (FIPS_GLORTHO_FN) glXGetProcAddressARB ((GLubyte*) "glOrtho"); - if (my_glOrtho == NULL) { - fprintf (stderr, "Failed to glXGetProcAddressARB glOrtho\n"); - exit (1); - } - my_glViewport = (FIPS_GLVIEWPORT_FN) glXGetProcAddressARB ((GLubyte*) "glViewport"); if (my_glViewport == NULL) { fprintf (stderr, "Failed to glXGetProcAddressARB glViewport\n");