VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedOpenGL/gldrv.h@ 4071

Last change on this file since 4071 was 4071, checked in by vboxsync, 17 years ago

Biggest check-in ever. New source code headers for all (C) innotek files.

File size: 5.7 KB
Line 
1/** @file
2 * VBox OpenGL windows helper functions
3 */
4
5/*
6 * Copyright (C) 2006-2007 innotek GmbH
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License as published by the Free Software Foundation,
12 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
13 * distribution. VirtualBox OSE is distributed in the hope that it will
14 * be useful, but WITHOUT ANY WARRANTY of any kind.
15 */
16
17#ifndef ___VBOXGLWIN_H
18#define ___VBOXGLWIN_H
19
20#include <iprt/types.h>
21#include <iprt/mem.h>
22
23#ifdef RT_OS_WINDOWS
24#define VBOX_OGL_DEBUG_WINDOW_OUTPUT
25#elif defined(RT_OS_LINUX)
26
27#define GLX_GLXEXT_PROTOTYPES
28#include <X11/Xlib.h>
29#include <GL/gl.h>
30#include <GL/glx.h>
31#include <GL/glxext.h>
32
33#define VBOX_OGL_DEBUG_WINDOW_OUTPUT
34#endif
35
36#ifdef VBOX_OGL_DEBUG_WINDOW_OUTPUT
37#if defined(RT_OS_WINDOWS)
38#define VBOX_OGL_GUEST_TO_HOST_HDC(a) pClient->hdc
39#elif defined(RT_OS_LINUX)
40#define VBOX_OGL_GUEST_TO_HOST_HDC(a) pClient->glxContext
41#endif
42#endif
43
44
45typedef struct
46{
47 uint64_t lastretval;
48 uint32_t ulLastError;
49
50 bool fHasLastError;
51
52 uint8_t *pLastParam;
53 uint32_t cbLastParam;
54
55 struct
56 {
57#ifdef RT_OS_WINDOWS
58 HWND hwnd;
59 HDC hdc;
60 HGLRC hglrc;
61#elif defined RT_OS_LINUX
62 Display *dpy;
63 Window win;
64 GLXContext ctx;
65 GLXFBConfig *fbConfig;
66 XVisualInfo *visinfo;
67#endif
68 } enable;
69
70#ifdef VBOX_OGL_DEBUG_WINDOW_OUTPUT
71#ifdef RT_OS_WINDOWS
72 HWND hwnd;
73 HDC hdc;
74#elif defined RT_OS_LINUX
75 Display *dpy;
76 Window xWindow;
77 GLXFBConfig actFBConfig;
78 int winWidth, winHeight;
79 GLXFBConfig *PixelFormatToFBConfigMapper;
80 int numFBConfigs;
81 GLXContext glxContext;
82 PFNGLXCHOOSEFBCONFIGSGIXPROC glxChooseFBConfig;
83 PFNGLXGETVISUALFROMFBCONFIGSGIXPROC glxGetVisualFromFBConfig;
84 PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC glxCreateNewContext;
85#endif
86#endif
87} VBOXOGLCTX, *PVBOXOGLCTX;
88
89
90#ifndef RT_OS_WINDOWS
91
92typedef uint32_t DWORD;
93typedef uint16_t WORD;
94typedef uint8_t BYTE;
95typedef BYTE BOOL;
96typedef RTGCUINTPTR HANDLE;
97typedef HANDLE HDC;
98typedef HANDLE HGLRC;
99typedef uint32_t UINT;
100typedef uint32_t COLORREF;
101typedef void VOID;
102typedef void * LPVOID;
103typedef int16_t SHORT;
104typedef uint16_t USHORT;
105typedef int64_t INT64;
106typedef int32_t INT32;
107typedef float FLOAT; /* ??? */
108
109#define DECLARE_HANDLE(a) typedef HANDLE a
110#define WINAPI
111
112#define PFD_DOUBLEBUFFER 0x00000001
113#define PFD_STEREO 0x00000002
114#define PFD_DRAW_TO_WINDOW 0x00000004
115#define PFD_SUPPORT_OPENGL 0x00000020
116
117#define PFD_TYPE_RGBA 0
118#define PFD_TYPE_COLORINDEX 1
119
120#define PFD_MAIN_PLANE 0
121#define PFD_OVERLAY_PLANE 1
122#define PFD_UNDERLAY_PLANE (-1)
123
124typedef struct
125{
126 WORD nSize;
127 WORD nVersion;
128 DWORD dwFlags;
129 BYTE iPixelType;
130 BYTE cColorBits;
131 BYTE cRedBits;
132 BYTE cRedShift;
133 BYTE cGreenBits;
134 BYTE cGreenShift;
135 BYTE cBlueBits;
136 BYTE cBlueShift;
137 BYTE cAlphaBits;
138 BYTE cAlphaShift;
139 BYTE cAccumBits;
140 BYTE cAccumRedBits;
141 BYTE cAccumGreenBits;
142 BYTE cAccumBlueBits;
143 BYTE cAccumAlphaBits;
144 BYTE cDepthBits;
145 BYTE cStencilBits;
146 BYTE cAuxBuffers;
147 BYTE iLayerType;
148 BYTE bReserved;
149 DWORD dwLayerMask;
150 DWORD dwVisibleMask;
151 DWORD dwDamageMask;
152} PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR, *LPPIXELFORMATDESCRIPTOR;
153
154typedef struct
155{
156 WORD nSize;
157 WORD nVersion;
158 DWORD dwFlags;
159 BYTE iPixelType;
160 BYTE cColorBits;
161 BYTE cRedBits;
162 BYTE cRedShift;
163 BYTE cGreenBits;
164 BYTE cGreenShift;
165 BYTE cBlueBits;
166 BYTE cBlueShift;
167 BYTE cAlphaBits;
168 BYTE cAlphaShift;
169 BYTE cAccumBits;
170 BYTE cAccumRedBits;
171 BYTE cAccumGreenBits;
172 BYTE cAccumBlueBits;
173 BYTE cAccumAlphaBits;
174 BYTE cDepthBits;
175 BYTE cStencilBits;
176 BYTE cAuxBuffers;
177 BYTE iLayerPlane;
178 BYTE bReserved;
179 COLORREF crTransparent;
180} LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, LPLAYERPLANEDESCRIPTOR;
181
182#endif
183
184void vboxglDrvReleaseContext(VBOXOGLCTX *pClient, uint8_t *pCmdBuffer);
185void vboxglDrvCreateContext(VBOXOGLCTX *pClient, uint8_t *pCmdBuffer);
186void vboxglDrvDeleteContext(VBOXOGLCTX *pClient, uint8_t *pCmdBuffer);
187void vboxglDrvCopyContext(VBOXOGLCTX *pClient, uint8_t *pCmdBuffer);
188void vboxglDrvSetContext(VBOXOGLCTX *pClient, uint8_t *pCmdBuffer);
189void vboxglDrvCreateLayerContext(VBOXOGLCTX *pClient, uint8_t *pCmdBuffer);
190void vboxglDrvShareLists(VBOXOGLCTX *pClient, uint8_t *pCmdBuffer);
191void vboxglDrvDescribeLayerPlane(VBOXOGLCTX *pClient, uint8_t *pCmdBuffer);
192void vboxglDrvSetLayerPaletteEntries(VBOXOGLCTX *pClient, uint8_t *pCmdBuffer);
193void vboxglDrvGetLayerPaletteEntries(VBOXOGLCTX *pClient, uint8_t *pCmdBuffer);
194void vboxglDrvRealizeLayerPalette(VBOXOGLCTX *pClient, uint8_t *pCmdBuffer);
195void vboxglDrvSwapLayerBuffers(VBOXOGLCTX *pClient, uint8_t *pCmdBuffer);
196void vboxglDrvDescribePixelFormat(VBOXOGLCTX *pClient, uint8_t *pCmdBuffer);
197void vboxglDrvSetPixelFormat(VBOXOGLCTX *pClient, uint8_t *pCmdBuffer);
198void vboxglDrvSwapBuffers(VBOXOGLCTX *pClient, uint8_t *pCmdBuffer);
199
200int vboxglEnableOpenGL(VBOXOGLCTX *pClient);
201int vboxglDisableOpenGL(VBOXOGLCTX *pClient);
202
203RTUINTPTR vboxDrvIsExtensionAvailable(char *pszExtFunctionName);
204
205#endif /* !___VBOXGLWIN_H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette