1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-30 05:58:52 -05:00

Begun preparations for Win32 EGL support.

This commit is contained in:
Camilla Berglund 2012-11-27 12:58:59 +01:00
parent 0f0f7f7294
commit b934cdf573
7 changed files with 103 additions and 55 deletions

View File

@ -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)

View File

@ -1,6 +1,6 @@
//========================================================================
// GLFW - An OpenGL library
// Platform: X11/EGL
// Platform: EGL
// API version: 3.0
// WWW: http://www.glfw.org/
//------------------------------------------------------------------------

View File

@ -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 <EGL/egl.h>
@ -93,4 +93,4 @@ typedef struct _GLFWlibraryEGL
} _GLFWlibraryEGL;
#endif // _x11_egl_platform_h_
#endif // _egl_platform_h_

View File

@ -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);

83
src/wgl_platform.h Normal file
View File

@ -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 <elmindreda@elmindreda.org>
//
// 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_

View File

@ -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 <windows.h>
#include <mmsystem.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"
//========================================================================
// 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_