VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/glext.cpp@ 8060

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

The Giant CDDL Dual-License Header Change.

File size: 5.4 KB
Line 
1/** @file
2 *
3 * VirtualBox Windows NT/2000/XP guest OpenGL ICD
4 *
5 * OpenGL extensions
6 *
7 * References: http://oss.sgi.com/projects/ogl-sample/registry/
8 * http://icps.u-strasbg.fr/~marchesin/perso/extensions/
9 *
10 * Copyright (C) 2006-2007 innotek GmbH
11 *
12 * This file is part of VirtualBox Open Source Edition (OSE), as
13 * available from http://www.virtualbox.org. This file is free software;
14 * you can redistribute it and/or modify it under the terms of the GNU
15 * General Public License (GPL) as published by the Free Software
16 * Foundation, in version 2 as it comes in the "COPYING" file of the
17 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
18 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
19 */
20
21#define VBOX_OGL_WITH_EXTENSION_ARRAY
22#include "VBoxOGL.h"
23
24
25/**
26 * Initialize OpenGL extensions
27 *
28 * @returns VBox status code
29 * @param pCtx OpenGL thread context
30 */
31int vboxInitOpenGLExtensions(PVBOX_OGL_THREAD_CTX pCtx)
32{
33 char *pszExtensions;
34 static bool fInitialized = false;
35 VBoxOGLglGetString parms;
36 int rc;
37
38 if (fInitialized)
39 return VINF_SUCCESS;
40
41 memset(&parms, 0, sizeof(parms));
42 VBOX_INIT_CALL(&parms.hdr, GLGETSTRING, pCtx);
43
44 parms.name.type = VMMDevHGCMParmType_32bit;
45 parms.name.u.value32 = GL_EXTENSIONS;
46 parms.pString.type = VMMDevHGCMParmType_LinAddr;
47 parms.pString.u.Pointer.size = sizeof(szOpenGLExtensions);
48 parms.pString.u.Pointer.u.linearAddr = (vmmDevHypPtr)szOpenGLExtensions;
49
50 rc = vboxHGCMCall(&parms, sizeof (parms));
51
52 if ( VBOX_FAILURE(rc)
53 || VBOX_FAILURE(parms.hdr.result))
54 {
55 DbgPrintf(("GL_EXTENSIONS failed with %x %x\n", rc, parms.hdr.result));
56 return (rc == VINF_SUCCESS) ? parms.hdr.result : rc;
57 }
58 DbgPrintf(("GL_EXTENSIONS=%s\n\n", szOpenGLExtensions));
59
60 pszExtensions = strdup(szOpenGLExtensions);
61 szOpenGLExtensions[0] = 0;
62
63 for (int i=0;i<RT_ELEMENTS(OpenGLExtensions);i++)
64 {
65 if (strstr((char *)pszExtensions, OpenGLExtensions[i].pszExtName))
66 OpenGLExtensions[i].fAvailable = VBoxIsExtensionAvailable(OpenGLExtensions[i].pszExtFunctionName);
67
68 if ( OpenGLExtensions[i].fAvailable
69 && !strstr(szOpenGLExtensions, OpenGLExtensions[i].pszExtName))
70 {
71 strcat(szOpenGLExtensions, OpenGLExtensions[i].pszExtName);
72 strcat(szOpenGLExtensions, " ");
73 }
74 }
75
76 free(pszExtensions);
77
78 fInitialized = true;
79 return VINF_SUCCESS;
80}
81
82
83PROC APIENTRY DrvGetProcAddress(LPCSTR lpszProc)
84{
85 PROC pfnProc = NULL;
86
87 for (int i=0;i<RT_ELEMENTS(OpenGLExtensions);i++)
88 {
89 if ( OpenGLExtensions[i].fAvailable
90 && !strcmp(OpenGLExtensions[i].pszExtFunctionName, lpszProc))
91 {
92 pfnProc = (PROC)OpenGLExtensions[i].pfnFunction;
93 }
94 }
95 if (pfnProc == NULL)
96 DbgPrintf(("DrvGetProcAddress %s FAILED\n", lpszProc));
97 else
98 DbgPrintf(("DrvGetProcAddress %s\n", lpszProc));
99
100 return pfnProc;
101}
102
103BOOL WINAPI wglSwapIntervalEXT(int interval)
104{
105 VBOX_OGL_GEN_SYNC_OP1_RET(BOOL, wglSwapIntervalEXT, interval);
106 return retval;
107}
108
109int WINAPI wglGetSwapIntervalEXT(void)
110{
111 VBOX_OGL_GEN_SYNC_OP_RET(int, wglGetSwapIntervalEXT);
112 return retval;
113}
114
115
116
117
118
119#if 0
120 GL_ARB_multitexture
121 GL_EXT_texture_env_add
122 GL_EXT_compiled_vertex_array
123 GL_S3_s3tc
124 GL_ARB_occlusion_query
125 GL_ARB_point_parameters
126 GL_ARB_texture_border_clamp
127 GL_ARB_texture_compression
128 GL_ARB_texture_cube_map
129 GL_ARB_texture_env_add
130 GL_ARB_texture_env_combine
131 GL_ARB_texture_env_crossbar
132 GL_ARB_texture_env_dot3
133 GL_ARB_texture_mirrored_repeat
134 GL_ARB_transpose_matrix
135 GL_ARB_vertex_blend
136 GL_ARB_vertex_buffer_object
137 GL_ARB_vertex_program
138 GL_ARB_window_pos
139 GL_ATI_element_array
140 GL_ATI_envmap_bumpmap
141 GL_ATI_fragment_shader
142 GL_ATI_map_object_buffer
143 GL_ATI_texture_env_combine3
144 GL_ATI_texture_mirror_once
145 GL_ATI_vertex_array_object
146 GL_ATI_vertex_attrib_array_object
147 GL_ATI_vertex_streams
148 GL_ATIX_texture_env_combine3
149 GL_ATIX_texture_env_route
150 GL_ATIX_vertex_shader_output_point_size
151 GL_EXT_abgr
152 GL_EXT_bgra
153 GL_EXT_blend_color
154 GL_EXT_blend_func_separate
155 GL_EXT_blend_minmax
156 GL_EXT_blend_subtract
157 GL_EXT_clip_volume_hint
158 GL_EXT_draw_range_elements
159 GL_EXT_fog_coord
160 GL_EXT_multi_draw_arrays
161 GL_EXT_packed_pixels
162 GL_EXT_point_parameters
163 GL_EXT_polygon_offset
164 GL_EXT_rescale_normal
165 GL_EXT_secondary_color
166 GL_EXT_separate_specular_color
167 GL_EXT_stencil_wrap
168 GL_EXT_texgen_reflection
169 GL_EXT_texture3D
170 GL_EXT_texture_compression_s3tc
171 GL_EXT_texture_cube_map
172 GL_EXT_texture_edge_clamp
173 GL_EXT_texture_env_combine
174 GL_EXT_texture_env_dot3
175 GL_EXT_texture_filter_anisotropic
176 GL_EXT_texture_lod_bias
177 GL_EXT_texture_mirror_clamp
178 GL_EXT_texture_object
179 GL_EXT_texture_rectangle
180 GL_EXT_vertex_array
181 GL_EXT_vertex_shader
182 GL_HP_occlusion_test
183 GL_KTX_buffer_region
184 GL_NV_blend_square
185 GL_NV_occlusion_query
186 GL_NV_texgen_reflection
187 GL_SGI_color_matrix
188 GL_SGIS_generate_mipmap
189 GL_SGIS_multitexture
190 GL_SGIS_texture_border_clamp
191 GL_SGIS_texture_edge_clamp
192 GL_SGIS_texture_lod
193 GL_SUN_multi_draw_arrays
194 GL_WIN_swap_hint
195 WGL_EXT_extensions_string
196#endif
197
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