]> git.cworth.org Git - fips/blobdiff - test/glx-dlopen-dlsym.c
test: Add 4 tests using EGL and OpenGLESv2
[fips] / test / glx-dlopen-dlsym.c
index a2a6f5dcfd5eb2ac030646e0d42238faf8b2b4f8..dd615237ffbdcb29c95ee5dd6de806ecb8bce6c9 100644 (file)
 #include <stdlib.h>
 #include <dlfcn.h>
 
-#include "util.h"
+#include "util-x11.h"
 
 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);
@@ -48,8 +45,8 @@ void (*my_glXDestroyContext) (Display *, GLXContext);
 Bool (*my_glXMakeCurrent) (Display *, GLXDrawable, GLXContext);
 void (*my_glXSwapBuffers) (Display *, GLXDrawable);
 
-#define HANDLE_EVENTS_GL_PREFIX my_
-#include "handle-events.c"
+#define COMMON_GL_PREFIX my_
+#include "common.c"
 
 static void
 resolve_symbols (void)
@@ -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) {
@@ -149,14 +125,24 @@ main (void)
 {
         Display *dpy;
         Window window;
-
-       util_init_display_window (&dpy, &window);
+       GLXContext ctx;
+       XVisualInfo *visual_info;
 
        resolve_symbols ();
 
-        handle_events (dpy, window);
+       dpy = util_x11_init_display ();
+
+       common_create_glx_context (dpy, &ctx, &visual_info);
+
+       window = util_x11_init_window (dpy, visual_info);
+
+       common_make_current (dpy, ctx, window);
+
+        common_handle_events (dpy, dpy, window);
+
+       util_x11_fini_window (dpy, window);
 
-       util_fini_display_window (dpy, window);
+       util_x11_fini_display (dpy);
 
         return 0;
 }