diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5e1fcc39..485f5c13 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -24,9 +24,9 @@ if (_GLFW_COCOA_NSGL) set_source_files_properties(${glfw_SOURCES} PROPERTIES LANGUAGE C) elseif (_GLFW_WIN32_WGL) set(glfw_HEADERS ${common_HEADERS} win32_platform.h) - set(glfw_SOURCES ${common_SOURCES} win32_clipboard.c win32_fullscreen.c - win32_gamma.c win32_init.c win32_joystick.c - win32_opengl.c win32_time.c win32_window.c) + set(glfw_SOURCES ${common_SOURCES} wgl_opengl.c win32_clipboard.c + win32_fullscreen.c win32_gamma.c win32_init.c + win32_joystick.c win32_time.c win32_window.c) if (GLFW_NATIVE_API) list(APPEND glfw_SOURCES win32_native.c) diff --git a/src/egl_opengl.c b/src/egl_opengl.c index b3247873..054e01f1 100644 --- a/src/egl_opengl.c +++ b/src/egl_opengl.c @@ -1,6 +1,6 @@ //======================================================================== // GLFW - An OpenGL library -// Platform: X11/EGL +// Platform: EGL // API version: 3.0 // WWW: http://www.glfw.org/ //------------------------------------------------------------------------ diff --git a/src/egl_platform.h b/src/egl_platform.h index 8fa4841e..fcc4420a 100644 --- a/src/egl_platform.h +++ b/src/egl_platform.h @@ -1,6 +1,6 @@ //======================================================================== // GLFW - An OpenGL library -// Platform: X11/EGL +// Platform: EGL // API version: 3.0 // WWW: http://www.glfw.org/ //------------------------------------------------------------------------ @@ -28,8 +28,8 @@ // //======================================================================== -#ifndef _x11_egl_platform_h_ -#define _x11_egl_platform_h_ +#ifndef _egl_platform_h_ +#define _egl_platform_h_ #include @@ -93,4 +93,4 @@ typedef struct _GLFWlibraryEGL } _GLFWlibraryEGL; -#endif // _x11_egl_platform_h_ +#endif // _egl_platform_h_ diff --git a/src/glx_platform.h b/src/glx_platform.h index 2882a197..a04d6f2e 100644 --- a/src/glx_platform.h +++ b/src/glx_platform.h @@ -62,7 +62,6 @@ #define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextGLX GLX #define _GLFW_PLATFORM_LIBRARY_OPENGL_STATE _GLFWlibraryGLX GLX -#define _GLFW_CTX GLX #ifndef GLX_MESA_swap_control typedef int (*PFNGLXSWAPINTERVALMESAPROC)(int); diff --git a/src/win32_opengl.c b/src/wgl_opengl.c similarity index 100% rename from src/win32_opengl.c rename to src/wgl_opengl.c diff --git a/src/wgl_platform.h b/src/wgl_platform.h new file mode 100644 index 00000000..1bbd8e23 --- /dev/null +++ b/src/wgl_platform.h @@ -0,0 +1,83 @@ +//======================================================================== +// GLFW - An OpenGL library +// Platform: WGL +// API version: 3.0 +// WWW: http://www.glfw.org/ +//------------------------------------------------------------------------ +// Copyright (c) 2002-2006 Marcus Geelnard +// Copyright (c) 2006-2010 Camilla Berglund +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would +// be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not +// be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source +// distribution. +// +//======================================================================== + +#ifndef _wgl_platform_h_ +#define _wgl_platform_h_ + +// This path may need to be changed if you build GLFW using your own setup +// We ship and use our own copy of wglext.h since GLFW uses fairly new +// extensions and not all operating systems come with an up-to-date version +#include "../support/GL/wglext.h" + + +#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextWGL WGL +#define _GLFW_PLATFORM_LIBRARY_OPENGL_STATE _GLFWlibraryWGL WGL + + +//======================================================================== +// GLFW platform specific types +//======================================================================== + +//------------------------------------------------------------------------ +// Platform-specific OpenGL context structure +//------------------------------------------------------------------------ +typedef struct _GLFWcontextWGL +{ + // Platform specific window resources + HDC DC; // Private GDI device context + HGLRC context; // Permanent rendering context + + // Platform specific extensions (context specific) + PFNWGLSWAPINTERVALEXTPROC SwapIntervalEXT; + PFNWGLGETPIXELFORMATATTRIBIVARBPROC GetPixelFormatAttribivARB; + PFNWGLGETEXTENSIONSSTRINGEXTPROC GetExtensionsStringEXT; + PFNWGLGETEXTENSIONSSTRINGARBPROC GetExtensionsStringARB; + PFNWGLCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB; + GLboolean EXT_swap_control; + GLboolean ARB_multisample; + GLboolean ARB_pixel_format; + GLboolean ARB_create_context; + GLboolean ARB_create_context_profile; + GLboolean EXT_create_context_es2_profile; + GLboolean ARB_create_context_robustness; +} _GLFWcontextWGL; + + +//------------------------------------------------------------------------ +// Platform-specific library global data for WGL +//------------------------------------------------------------------------ +typedef struct _GLFWlibraryWGL +{ + int dummy; + +} _GLFWlibraryWGL; + + +#endif // _wgl_platform_h_ diff --git a/src/win32_platform.h b/src/win32_platform.h index 217fc2cf..142a7eae 100644 --- a/src/win32_platform.h +++ b/src/win32_platform.h @@ -1,6 +1,6 @@ //======================================================================== // GLFW - An OpenGL library -// Platform: Win32/WGL +// Platform: Win32 // API version: 3.0 // WWW: http://www.glfw.org/ //------------------------------------------------------------------------ @@ -28,8 +28,8 @@ // //======================================================================== -#ifndef _platform_h_ -#define _platform_h_ +#ifndef _win32_platform_h_ +#define _win32_platform_h_ // We don't need all the fancy stuff @@ -63,11 +63,6 @@ #include #include -// This path may need to be changed if you build GLFW using your own setup -// We ship and use our own copy of wglext.h since GLFW uses fairly new -// extensions and not all operating systems come with an up-to-date version -#include "../support/GL/wglext.h" - //======================================================================== // Hack: Define things that some windows.h variants don't @@ -110,10 +105,16 @@ typedef DWORD (WINAPI * TIMEGETTIME_T) (void); #define _GLFW_WNDCLASSNAME L"GLFW30" +#if defined(_GLFW_WIN32_WGL) + #include "wgl_platform.h" +#elif defined(_GLFW_WIN32_EGL) + #define _GLFW_EGL_NATIVE_WINDOW window->Win32.handle + #define _GLFW_EGL_NATIVE_DISPLAY NULL + #include "egl_platform.h" +#endif + #define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowWin32 Win32 -#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextWGL WGL #define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryWin32 Win32 -#define _GLFW_PLATFORM_LIBRARY_OPENGL_STATE _GLFWlibraryWGL WGL //======================================================================== @@ -126,31 +127,6 @@ typedef DWORD (WINAPI * TIMEGETTIME_T) (void); typedef INT_PTR GLFWintptr; -//------------------------------------------------------------------------ -// Platform-specific OpenGL context structure -//------------------------------------------------------------------------ -typedef struct _GLFWcontextWGL -{ - // Platform specific window resources - HDC DC; // Private GDI device context - HGLRC context; // Permanent rendering context - - // Platform specific extensions (context specific) - PFNWGLSWAPINTERVALEXTPROC SwapIntervalEXT; - PFNWGLGETPIXELFORMATATTRIBIVARBPROC GetPixelFormatAttribivARB; - PFNWGLGETEXTENSIONSSTRINGEXTPROC GetExtensionsStringEXT; - PFNWGLGETEXTENSIONSSTRINGARBPROC GetExtensionsStringARB; - PFNWGLCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB; - GLboolean EXT_swap_control; - GLboolean ARB_multisample; - GLboolean ARB_pixel_format; - GLboolean ARB_create_context; - GLboolean ARB_create_context_profile; - GLboolean EXT_create_context_es2_profile; - GLboolean ARB_create_context_robustness; -} _GLFWcontextWGL; - - //------------------------------------------------------------------------ // Platform-specific window structure //------------------------------------------------------------------------ @@ -210,16 +186,6 @@ typedef struct _GLFWlibraryWin32 } _GLFWlibraryWin32; -//------------------------------------------------------------------------ -// Platform-specific library global data for WGL -//------------------------------------------------------------------------ -typedef struct _GLFWlibraryWGL -{ - int dummy; - -} _GLFWlibraryWGL; - - //======================================================================== // Prototypes for platform specific internal functions //======================================================================== @@ -244,4 +210,4 @@ void _glfwSetVideoMode(int* width, int* height, void _glfwRestoreVideoMode(void); -#endif // _platform_h_ +#endif // _win32_platform_h_