X-Git-Url: https://git.ralfj.de/gltest.git/blobdiff_plain/141fa68c418105e1e60788f676cd7f6dcf9cbeb1..dac0dad539be501c94cb8646d979e6e7787e1992:/glxbackend.cpp diff --git a/glxbackend.cpp b/glxbackend.cpp index 9f8ed3e..3ebc878 100644 --- a/glxbackend.cpp +++ b/glxbackend.cpp @@ -17,6 +17,7 @@ */ #include "glxbackend.h" +#include "glutil.h" #include #include @@ -24,15 +25,18 @@ #include #include -/* attributes for a double buffered visual in RGBA format with at least -* 4 bits per color */ +#if !defined(CON_GL1) +#error "Valid GL contexts for GLX are: GL1" +#endif + +// attributes for a double buffered visual in RGBA format with at least 4 bits per color static int attrList[] = -{ +{ GLX_RGBA, GLX_DOUBLEBUFFER, - GLX_RED_SIZE, 4, - GLX_GREEN_SIZE, 4, + GLX_RED_SIZE, 4, + GLX_GREEN_SIZE, 4, GLX_BLUE_SIZE, 4, - None + None }; VisualID GLXBackend::initialize(Display *display) @@ -42,7 +46,7 @@ VisualID GLXBackend::initialize(Display *display) // debugging: show version information int glxMajor, glxMinor; glXQueryVersion(display, &glxMajor, &glxMinor); - printf("Using GLX version %d.%d\n", glxMajor, glxMinor); + printf("Using GLX version: %d.%d\n", glxMajor, glxMinor); // check for swap control functions const char *extensions = glXQueryExtensionsString(display, DefaultScreen(display)); if (std::string(extensions).find("GLX_MESA_swap_control") != std::string::npos) { @@ -73,6 +77,9 @@ void GLXBackend::createContext(Window window) context = glXCreateContext(display, vi, 0, GL_TRUE); glXMakeCurrent(display, window, context); assert(glXIsDirect(display, context)); + printf("Using GL version: %s\n", glGetString(GL_VERSION)); + // initialise GL utilities + resolveFunctionPointers((T_glGetProcAddress)glXGetProcAddress); } GLXBackend::~GLXBackend()