Added separate platform headers for EGL and GLX.

This commit is contained in:
Camilla Berglund
2012-07-19 23:01:51 +02:00
parent f004aa0f82
commit be12cbca15
6 changed files with 143 additions and 290 deletions
+5 -79
View File
@@ -1,6 +1,6 @@
//========================================================================
// GLFW - An OpenGL library
// Platform: X11/GLX
// Platform: X11
// API version: 3.0
// WWW: http://www.glfw.org/
//------------------------------------------------------------------------
@@ -38,14 +38,6 @@
#include <X11/keysym.h>
#include <X11/Xatom.h>
#define GLX_GLXEXT_LEGACY
#include <GL/glx.h>
// This path may need to be changed if you build GLFW using your own setup
// We ship and use our own copy of glxext.h since GLFW uses fairly new
// extensions and not all operating systems come with an up-to-date version
#include "../support/GL/glxext.h"
// With XFree86, we can use the XF86VidMode extension
#if defined(_GLFW_HAS_XF86VIDMODE)
#include <X11/extensions/xf86vmode.h>
@@ -55,37 +47,19 @@
#include <X11/extensions/Xrandr.h>
#endif
// Do we have support for dlopen/dlsym?
#if defined(_GLFW_HAS_DLOPEN)
#include <dlfcn.h>
#endif
// The Xkb extension provides improved keyboard support
#if defined(_GLFW_HAS_XKB)
#include <X11/XKBlib.h>
#endif
// We support four different ways for getting addresses for GL/GLX
// extension functions: glXGetProcAddress, glXGetProcAddressARB,
// glXGetProcAddressEXT, and dlsym
#if defined(_GLFW_HAS_GLXGETPROCADDRESSARB)
#define _glfw_glXGetProcAddress(x) glXGetProcAddressARB(x)
#elif defined(_GLFW_HAS_GLXGETPROCADDRESS)
#define _glfw_glXGetProcAddress(x) glXGetProcAddress(x)
#elif defined(_GLFW_HAS_GLXGETPROCADDRESSEXT)
#define _glfw_glXGetProcAddress(x) glXGetProcAddressEXT(x)
#elif defined(_GLFW_HAS_DLOPEN)
#define _glfw_glXGetProcAddress(x) dlsym(_glfwLibrary.GLX.libGL, x)
#define _GLFW_DLOPEN_LIBGL
#else
#error "No OpenGL entry point retrieval mechanism was enabled"
#if defined(_GLFW_X11_GLX)
#include "x11_glx_platform.h"
#elif defined(_GLFW_X11_EGL)
#include "x11_egl_platform.h"
#endif
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowX11 X11
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextGLX GLX
#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryX11 X11
#define _GLFW_PLATFORM_LIBRARY_OPENGL_STATE _GLFWlibraryGLX GLX
#define _GLFW_CTX GLX
// Clipboard format atom indices
#define _GLFW_CLIPBOARD_FORMAT_UTF8 0
@@ -98,10 +72,6 @@
#define _GLFW_CONVERSION_SUCCEEDED 1
#define _GLFW_CONVERSION_FAILED 2
#ifndef GLX_MESA_swap_control
typedef int (*PFNGLXSWAPINTERVALMESAPROC)(int);
#endif
//========================================================================
// GLFW platform specific types
@@ -113,17 +83,6 @@ typedef int (*PFNGLXSWAPINTERVALMESAPROC)(int);
typedef intptr_t GLFWintptr;
//------------------------------------------------------------------------
// Platform-specific OpenGL context structure
//------------------------------------------------------------------------
typedef struct _GLFWcontextGLX
{
GLXContext context; // OpenGL rendering context
XVisualInfo* visual; // Visual for selected GLXFBConfig
} _GLFWcontextGLX;
//------------------------------------------------------------------------
// Platform-specific window structure
//------------------------------------------------------------------------
@@ -236,39 +195,6 @@ typedef struct _GLFWlibraryX11
} _GLFWlibraryX11;
//------------------------------------------------------------------------
// Platform-specific library global data for GLX
//------------------------------------------------------------------------
typedef struct _GLFWlibraryGLX
{
// Server-side GLX version
int majorVersion, minorVersion;
// GLX extensions
PFNGLXSWAPINTERVALSGIPROC SwapIntervalSGI;
PFNGLXSWAPINTERVALEXTPROC SwapIntervalEXT;
PFNGLXSWAPINTERVALMESAPROC SwapIntervalMESA;
PFNGLXGETFBCONFIGATTRIBSGIXPROC GetFBConfigAttribSGIX;
PFNGLXCHOOSEFBCONFIGSGIXPROC ChooseFBConfigSGIX;
PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC CreateContextWithConfigSGIX;
PFNGLXGETVISUALFROMFBCONFIGSGIXPROC GetVisualFromFBConfigSGIX;
PFNGLXCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB;
GLboolean SGIX_fbconfig;
GLboolean SGI_swap_control;
GLboolean EXT_swap_control;
GLboolean MESA_swap_control;
GLboolean ARB_multisample;
GLboolean ARB_create_context;
GLboolean ARB_create_context_profile;
GLboolean ARB_create_context_robustness;
GLboolean EXT_create_context_es2_profile;
#if defined(_GLFW_DLOPEN_LIBGL)
void* libGL; // dlopen handle for libGL.so
#endif
} _GLFWlibraryGLX;
//------------------------------------------------------------------------
// Joystick information & state
//------------------------------------------------------------------------