VirtualBox

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

Last change on this file since 3513 was 3513, checked in by vboxsync, 18 years ago

filter out opengl extensions, that we don't support (yet)

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