Equalizer  1.6.1
os.h
Go to the documentation of this file.
1 
2 /* Copyright (c) 2006-2012, 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/client/api.h>
22 #include <eq/client/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 # define Cursor CGLCursor // avoid name clash with X11 'Cursor'
56 # include <ApplicationServices/ApplicationServices.h>
57 # include <AGL/agl.h>
58 # include <Carbon/Carbon.h>
59 # define EQ_AGL_MENUBARHEIGHT 22
60 # ifdef check // undo global namespace pollution (AssertMacros.h)
61 # undef check
62 # endif
63 #endif
64 
65 #ifdef WGL
66 # include <wingdi.h>
67 
68 # ifndef WGL_NV_gpu_affinity
69 # define WGL_NV_gpu_affinity 1
70 DECLARE_HANDLE(HGPUNV);
71 typedef struct _GPU_DEVICE {
72  DWORD cb;
73  CHAR DeviceName[32];
74  CHAR DeviceString[128];
75  DWORD Flags;
76  RECT rcVirtualScreen;
78 
79 # ifdef WGL_WGLEXT_PROTOTYPES
80 extern BOOL WINAPI wglEnumGpusNV (UINT iIndex, HGPUNV *hGpu);
81 extern BOOL WINAPI wglEnumGpuDevicesNV (HGPUNV hGpu, UINT iIndex, PGPU_DEVICE pGpuDevice);
82 extern HDC WINAPI wglCreateAffinityDCNV (const HGPUNV *pGpuList);
83 extern BOOL WINAPI wglEnumGpusFromAffinityDCNV (HDC hAffinityDC, UINT iIndex, HGPUNV *hGpu);
84 extern BOOL WINAPI wglDeleteDCNV (HDC hAffinityDC);
85 # else
86 typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iIndex, HGPUNV *hGpu);
87 typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iIndex, PGPU_DEVICE pGpuDevice);
88 typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *pGpuList);
89 typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iIndex, HGPUNV *hGpu);
90 typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hAffinityDC);
91 # endif // WGL_WGLEXT_PROTOTYPES
92 # endif // WGL_NV_gpu_affinity
93 
94 #ifndef WGL_ARB_pbuffer
95 # define WGL_ARB_pbuffer 1
96 
97 # define WGL_DRAW_TO_PBUFFER_ARB 0x202D
98 # define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
99 # define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
100 # define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
101 # define WGL_PBUFFER_LARGEST_ARB 0x2033
102 # define WGL_PBUFFER_WIDTH_ARB 0x2034
103 # define WGL_PBUFFER_HEIGHT_ARB 0x2035
104 # define WGL_PBUFFER_LOST_ARB 0x2036
105 
106 DECLARE_HANDLE(HPBUFFERARB);
107 
108 typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList);
109 typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);
110 typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);
111 typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int* piValue);
112 typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);
113 
114 # define wglCreatePbufferARB WGLEW_GET_FUN(__wglewCreatePbufferARB)
115 # define wglDestroyPbufferARB WGLEW_GET_FUN(__wglewDestroyPbufferARB)
116 # define wglGetPbufferDCARB WGLEW_GET_FUN(__wglewGetPbufferDCARB)
117 # define wglQueryPbufferARB WGLEW_GET_FUN(__wglewQueryPbufferARB)
118 # define wglReleasePbufferDCARB WGLEW_GET_FUN(__wglewReleasePbufferDCARB)
119 
120 # define WGLEW_ARB_pbuffer WGLEW_GET_VAR(__WGLEW_ARB_pbuffer)
121 
122 # endif /* WGL_ARB_pbuffer */
123 #endif
124 
125 #ifndef WGL
126 typedef void* HDC;
127 typedef void* HWND;
128 typedef void* HPBUFFERARB;
129 typedef void* HGLRC;
130 # define PFNWGLDELETEDCNVPROC void*
131 # define WINAPI
132 #endif
133 
135 #endif // EQ_OS_H
136 
Includes OpenGL and GLEW headers.