Equalizer  1.13.0
Parallel Rendering Framework
os.h
Go to the documentation of this file.
1 
2 /* Copyright (c) 2006-2014, Stefan Eilemann <eile@equalizergraphics.com>
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License version 2.1 as published
6  * by the Free Software Foundation.
7  *
8  * This library is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11  * details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this library; if not, write to the Free Software Foundation, Inc.,
15  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16  */
17 
18 #ifndef EQ_OS_H
19 #define EQ_OS_H
20 
21 #include <eq/api.h>
22 #include <eq/gl.h>
23 #include <lunchbox/os.h>
24 #include <lunchbox/types.h>
25 
26 #include <string>
27 
37 #ifdef GLX
38 # include <X11/Xlib.h>
39 # include <GL/glx.h>
40 # ifndef GLX_SAMPLE_BUFFERS
41 # define GLX_SAMPLE_BUFFERS 100000
42 # endif
43 # ifndef GLX_SAMPLES
44 # define GLX_SAMPLES 100001
45 # endif
46 #endif
47 
48 #ifdef _WIN32
49 #ifndef _WIN32_WINNT
50 # define _WIN32_WINNT 0x501 // XP
51 #endif
52 #endif
53 
54 #ifdef AGL
55 # ifdef __LP64__ // AGL is not supported in 64 bit
56 # undef AGL
57 # else
58 # define Cursor CGLCursor // avoid name clash with X11 'Cursor'
59 # include <ApplicationServices/ApplicationServices.h>
60 # include <AGL/agl.h>
61 # include <Carbon/Carbon.h>
62 # define EQ_AGL_MENUBARHEIGHT 22
63 # ifdef check // undo global namespace pollution (AssertMacros.h)
64 # undef check
65 # endif
66 # endif
67 #endif
68 
69 #ifdef WGL
70 # include <wingdi.h>
71 
72 # ifndef WGL_NV_gpu_affinity
73 # define WGL_NV_gpu_affinity 1
74 DECLARE_HANDLE(HGPUNV);
75 typedef struct _GPU_DEVICE {
76  DWORD cb;
77  CHAR DeviceName[32];
78  CHAR DeviceString[128];
79  DWORD Flags;
80  RECT rcVirtualScreen;
81 } GPU_DEVICE, *PGPU_DEVICE;
82 
83 # ifdef WGL_WGLEXT_PROTOTYPES
84 extern BOOL WINAPI wglEnumGpusNV (UINT iIndex, HGPUNV *hGpu);
85 extern BOOL WINAPI wglEnumGpuDevicesNV (HGPUNV hGpu, UINT iIndex, PGPU_DEVICE pGpuDevice);
86 extern HDC WINAPI wglCreateAffinityDCNV (const HGPUNV *pGpuList);
87 extern BOOL WINAPI wglEnumGpusFromAffinityDCNV (HDC hAffinityDC, UINT iIndex, HGPUNV *hGpu);
88 extern BOOL WINAPI wglDeleteDCNV (HDC hAffinityDC);
89 # else
90 typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iIndex, HGPUNV *hGpu);
91 typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iIndex, PGPU_DEVICE pGpuDevice);
92 typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *pGpuList);
93 typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iIndex, HGPUNV *hGpu);
94 typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hAffinityDC);
95 # endif // WGL_WGLEXT_PROTOTYPES
96 # endif // WGL_NV_gpu_affinity
97 
98 #ifndef WGL_ARB_pbuffer
99 # define WGL_ARB_pbuffer 1
100 
101 # define WGL_DRAW_TO_PBUFFER_ARB 0x202D
102 # define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
103 # define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
104 # define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
105 # define WGL_PBUFFER_LARGEST_ARB 0x2033
106 # define WGL_PBUFFER_WIDTH_ARB 0x2034
107 # define WGL_PBUFFER_HEIGHT_ARB 0x2035
108 # define WGL_PBUFFER_LOST_ARB 0x2036
109 
110 DECLARE_HANDLE(HPBUFFERARB);
111 
112 typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList);
113 typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);
114 typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);
115 typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int* piValue);
116 typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);
117 
118 # define wglCreatePbufferARB WGLEW_GET_FUN(__wglewCreatePbufferARB)
119 # define wglDestroyPbufferARB WGLEW_GET_FUN(__wglewDestroyPbufferARB)
120 # define wglGetPbufferDCARB WGLEW_GET_FUN(__wglewGetPbufferDCARB)
121 # define wglQueryPbufferARB WGLEW_GET_FUN(__wglewQueryPbufferARB)
122 # define wglReleasePbufferDCARB WGLEW_GET_FUN(__wglewReleasePbufferDCARB)
123 
124 # define WGLEW_ARB_pbuffer WGLEW_GET_VAR(__WGLEW_ARB_pbuffer)
125 
126 # endif /* WGL_ARB_pbuffer */
127 #endif
128 
129 #ifndef WGL
130 typedef void* HDC;
131 typedef void* HWND;
132 typedef void* HPBUFFERARB;
133 typedef void* HGLRC;
134 # define PFNWGLDELETEDCNVPROC void*
135 # define WINAPI
136 #endif
137 
139 #endif // EQ_OS_H
Includes OpenGL and GLEW headers.