Equalizer  2.1.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 <GL/glx.h>
39 #include <X11/Xlib.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 <AGL/agl.h>
60 #include <ApplicationServices/ApplicationServices.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 {
77  DWORD cb;
78  CHAR DeviceName[32];
79  CHAR DeviceString[128];
80  DWORD Flags;
81  RECT rcVirtualScreen;
82 } GPU_DEVICE, *PGPU_DEVICE;
83 
84 #ifdef WGL_WGLEXT_PROTOTYPES
85 extern BOOL WINAPI wglEnumGpusNV(UINT iIndex, HGPUNV* hGpu);
86 extern BOOL WINAPI wglEnumGpuDevicesNV(HGPUNV hGpu, UINT iIndex,
87  PGPU_DEVICE pGpuDevice);
88 extern HDC WINAPI wglCreateAffinityDCNV(const HGPUNV* pGpuList);
89 extern BOOL WINAPI wglEnumGpusFromAffinityDCNV(HDC hAffinityDC, UINT iIndex,
90  HGPUNV* hGpu);
91 extern BOOL WINAPI wglDeleteDCNV(HDC hAffinityDC);
92 #else
93 typedef BOOL(WINAPI* PFNWGLENUMGPUSNVPROC)(UINT iIndex, HGPUNV* hGpu);
94 typedef BOOL(WINAPI* PFNWGLENUMGPUDEVICESNVPROC)(HGPUNV hGpu, UINT iIndex,
95  PGPU_DEVICE pGpuDevice);
96 typedef HDC(WINAPI* PFNWGLCREATEAFFINITYDCNVPROC)(const HGPUNV* pGpuList);
97 typedef BOOL(WINAPI* PFNWGLENUMGPUSFROMAFFINITYDCNVPROC)(HDC hAffinityDC,
98  UINT iIndex,
99  HGPUNV* hGpu);
100 typedef BOOL(WINAPI* PFNWGLDELETEDCNVPROC)(HDC hAffinityDC);
101 #endif // WGL_WGLEXT_PROTOTYPES
102 #endif // WGL_NV_gpu_affinity
103 
104 #ifndef WGL_ARB_pbuffer
105 #define WGL_ARB_pbuffer 1
106 
107 #define WGL_DRAW_TO_PBUFFER_ARB 0x202D
108 #define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
109 #define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
110 #define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
111 #define WGL_PBUFFER_LARGEST_ARB 0x2033
112 #define WGL_PBUFFER_WIDTH_ARB 0x2034
113 #define WGL_PBUFFER_HEIGHT_ARB 0x2035
114 #define WGL_PBUFFER_LOST_ARB 0x2036
115 
116 DECLARE_HANDLE(HPBUFFERARB);
117 
118 typedef HPBUFFERARB(WINAPI* PFNWGLCREATEPBUFFERARBPROC)(
119  HDC hDC, int iPixelFormat, int iWidth, int iHeight,
120  const int* piAttribList);
121 typedef BOOL(WINAPI* PFNWGLDESTROYPBUFFERARBPROC)(HPBUFFERARB hPbuffer);
122 typedef HDC(WINAPI* PFNWGLGETPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer);
123 typedef BOOL(WINAPI* PFNWGLQUERYPBUFFERARBPROC)(HPBUFFERARB hPbuffer,
124  int iAttribute, int* piValue);
125 typedef int(WINAPI* PFNWGLRELEASEPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer,
126  HDC hDC);
127 
128 #define wglCreatePbufferARB WGLEW_GET_FUN(__wglewCreatePbufferARB)
129 #define wglDestroyPbufferARB WGLEW_GET_FUN(__wglewDestroyPbufferARB)
130 #define wglGetPbufferDCARB WGLEW_GET_FUN(__wglewGetPbufferDCARB)
131 #define wglQueryPbufferARB WGLEW_GET_FUN(__wglewQueryPbufferARB)
132 #define wglReleasePbufferDCARB WGLEW_GET_FUN(__wglewReleasePbufferDCARB)
133 
134 #define WGLEW_ARB_pbuffer WGLEW_GET_VAR(__WGLEW_ARB_pbuffer)
135 
136 #endif /* WGL_ARB_pbuffer */
137 #endif
138 
139 #ifndef WGL
140 typedef void* HDC;
141 typedef void* HWND;
142 typedef void* HPBUFFERARB;
143 typedef void* HGLRC;
144 #define PFNWGLDELETEDCNVPROC void*
145 #define WINAPI
146 #endif
147 
149 #endif // EQ_OS_H
Includes OpenGL and GLEW headers.