Index: /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/Makefile.kmk	(revision 3339)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/Makefile.kmk	(revision 3339)
@@ -0,0 +1,50 @@
+# $Id: Makefile.kmk 21700 2007-06-01 16:01:28Z umoeller $
+## @file
+# Sub-Makefile for the VirtualBox Windows OpenGL ICD.
+#
+
+#
+# Copyright (C) 2006-2007 innotek GmbH
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License as published by the Free Software Foundation,
+# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+# distribution. VirtualBox OSE is distributed in the hope that it will
+# be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# If you received this file as part of a commercial VirtualBox
+# distribution, then only the terms of your commercial VirtualBox
+# license agreement apply instead of the previous paragraph.
+#
+
+DEPTH ?= ../../../../../..
+SUB_DEPTH = ../../..
+include	$(PATH_KBUILD)/subheader.kmk
+
+# Include sub-makefile(s).
+include $(PATH_SUB_CURRENT)/test/Makefile.kmk
+
+DLLS += VBoxOGL
+VBoxOGL_TEMPLATE    = VBOXW32GUESTR3
+VBoxOGL_SDKS        = W2K3DDKX86
+VBoxOGL_DEFS        = VBOX_HGCM _WIN32_WINNT=0x0500 VBOX_OGL_GUEST_SIDE
+VBoxOGL_SOURCES     = \
+        dllmain.cpp \
+	drv.cpp \
+        VBoxOGL.cpp \
+        VBoxCmd.cpp \
+        OGLSimpleSync.cpp \
+        OGLSimpleAsync.cpp \
+        OGLComplexSync.cpp \
+        OGLComplexAsync.cpp \
+        OGLLookup.cpp \
+        MesaGL.cpp \
+	VBoxOGL.rc \
+	VBoxOGL.def
+VBoxOGL_LIBS        = \
+	$(PATH_LIB)/additions/RuntimeW32GuestR3.lib
+
+include	$(PATH_KBUILD)/subfooter.kmk
+
Index: /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/MesaGL.cpp
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/MesaGL.cpp	(revision 3339)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/MesaGL.cpp	(revision 3339)
@@ -0,0 +1,215 @@
+/** @file
+ *
+ * VirtualBox Windows NT/2000/XP guest OpenGL ICD
+ *
+ * Copyright (C) 2006-2007 innotek GmbH
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation,
+ * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+ * distribution. VirtualBox OSE is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * If you received this file as part of a commercial VirtualBox
+ * distribution, then only the terms of your commercial VirtualBox
+ * license agreement apply instead of the previous paragraph.
+ *
+ */
+/*
+ * Mesa 3-D graphics library
+ * Version:  6.5.1
+ *
+ * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include "VBoxOGL.h"
+#include <iprt/cdefs.h>
+#include <iprt/assert.h>
+
+void APIENTRY glInterleavedArrays (GLenum format, GLsizei stride, const GLvoid *pointer)
+{
+   GLboolean tflag, cflag, nflag;  /* enable/disable flags */
+   GLint tcomps, ccomps, vcomps;   /* components per texcoord, color, vertex */
+   GLenum ctype = 0;               /* color type */
+   GLint coffset = 0, noffset = 0, voffset;/* color, normal, vertex offsets */
+   const GLint toffset = 0;        /* always zero */
+   GLint defstride;                /* default stride */
+   GLint c, f;
+
+   f = sizeof(GLfloat);
+   c = f * ((4 * sizeof(GLubyte) + (f - 1)) / f);
+
+   if (stride < 0) {
+      glLogError(GL_INVALID_VALUE);
+      return;
+   }
+
+   switch (format) {
+      case GL_V2F:
+         tflag = GL_FALSE;  cflag = GL_FALSE;  nflag = GL_FALSE;
+         tcomps = 0;  ccomps = 0;  vcomps = 2;
+         voffset = 0;
+         defstride = 2*f;
+         break;
+      case GL_V3F:
+         tflag = GL_FALSE;  cflag = GL_FALSE;  nflag = GL_FALSE;
+         tcomps = 0;  ccomps = 0;  vcomps = 3;
+         voffset = 0;
+         defstride = 3*f;
+         break;
+      case GL_C4UB_V2F:
+         tflag = GL_FALSE;  cflag = GL_TRUE;  nflag = GL_FALSE;
+         tcomps = 0;  ccomps = 4;  vcomps = 2;
+         ctype = GL_UNSIGNED_BYTE;
+         coffset = 0;
+         voffset = c;
+         defstride = c + 2*f;
+         break;
+      case GL_C4UB_V3F:
+         tflag = GL_FALSE;  cflag = GL_TRUE;  nflag = GL_FALSE;
+         tcomps = 0;  ccomps = 4;  vcomps = 3;
+         ctype = GL_UNSIGNED_BYTE;
+         coffset = 0;
+         voffset = c;
+         defstride = c + 3*f;
+         break;
+      case GL_C3F_V3F:
+         tflag = GL_FALSE;  cflag = GL_TRUE;  nflag = GL_FALSE;
+         tcomps = 0;  ccomps = 3;  vcomps = 3;
+         ctype = GL_FLOAT;
+         coffset = 0;
+         voffset = 3*f;
+         defstride = 6*f;
+         break;
+      case GL_N3F_V3F:
+         tflag = GL_FALSE;  cflag = GL_FALSE;  nflag = GL_TRUE;
+         tcomps = 0;  ccomps = 0;  vcomps = 3;
+         noffset = 0;
+         voffset = 3*f;
+         defstride = 6*f;
+         break;
+      case GL_C4F_N3F_V3F:
+         tflag = GL_FALSE;  cflag = GL_TRUE;  nflag = GL_TRUE;
+         tcomps = 0;  ccomps = 4;  vcomps = 3;
+         ctype = GL_FLOAT;
+         coffset = 0;
+         noffset = 4*f;
+         voffset = 7*f;
+         defstride = 10*f;
+         break;
+      case GL_T2F_V3F:
+         tflag = GL_TRUE;  cflag = GL_FALSE;  nflag = GL_FALSE;
+         tcomps = 2;  ccomps = 0;  vcomps = 3;
+         voffset = 2*f;
+         defstride = 5*f;
+         break;
+      case GL_T4F_V4F:
+         tflag = GL_TRUE;  cflag = GL_FALSE;  nflag = GL_FALSE;
+         tcomps = 4;  ccomps = 0;  vcomps = 4;
+         voffset = 4*f;
+         defstride = 8*f;
+         break;
+      case GL_T2F_C4UB_V3F:
+         tflag = GL_TRUE;  cflag = GL_TRUE;  nflag = GL_FALSE;
+         tcomps = 2;  ccomps = 4;  vcomps = 3;
+         ctype = GL_UNSIGNED_BYTE;
+         coffset = 2*f;
+         voffset = c+2*f;
+         defstride = c+5*f;
+         break;
+      case GL_T2F_C3F_V3F:
+         tflag = GL_TRUE;  cflag = GL_TRUE;  nflag = GL_FALSE;
+         tcomps = 2;  ccomps = 3;  vcomps = 3;
+         ctype = GL_FLOAT;
+         coffset = 2*f;
+         voffset = 5*f;
+         defstride = 8*f;
+         break;
+      case GL_T2F_N3F_V3F:
+         tflag = GL_TRUE;  cflag = GL_FALSE;  nflag = GL_TRUE;
+         tcomps = 2;  ccomps = 0;  vcomps = 3;
+         noffset = 2*f;
+         voffset = 5*f;
+         defstride = 8*f;
+         break;
+      case GL_T2F_C4F_N3F_V3F:
+         tflag = GL_TRUE;  cflag = GL_TRUE;  nflag = GL_TRUE;
+         tcomps = 2;  ccomps = 4;  vcomps = 3;
+         ctype = GL_FLOAT;
+         coffset = 2*f;
+         noffset = 6*f;
+         voffset = 9*f;
+         defstride = 12*f;
+         break;
+      case GL_T4F_C4F_N3F_V4F:
+         tflag = GL_TRUE;  cflag = GL_TRUE;  nflag = GL_TRUE;
+         tcomps = 4;  ccomps = 4;  vcomps = 4;
+         ctype = GL_FLOAT;
+         coffset = 4*f;
+         noffset = 8*f;
+         voffset = 11*f;
+         defstride = 15*f;
+         break;
+      default:
+         glLogError(GL_INVALID_ENUM);
+         return;
+   }
+
+   if (stride==0) {
+      stride = defstride;
+   }
+
+   glDisableClientState( GL_EDGE_FLAG_ARRAY );
+   glDisableClientState( GL_INDEX_ARRAY );
+   /* XXX also disable secondary color and generic arrays? */
+
+   /* Texcoords */
+   if (tflag) {
+      glEnableClientState( GL_TEXTURE_COORD_ARRAY );
+      glTexCoordPointer( tcomps, GL_FLOAT, stride, (GLubyte *) pointer + toffset );
+   }
+   else {
+      glDisableClientState( GL_TEXTURE_COORD_ARRAY );
+   }
+
+   /* Color */
+   if (cflag) {
+      glEnableClientState( GL_COLOR_ARRAY );
+      glColorPointer( ccomps, ctype, stride, (GLubyte *) pointer + coffset );
+   }
+   else {
+      glDisableClientState( GL_COLOR_ARRAY );
+   }
+
+
+   /* Normals */
+   if (nflag) {
+      glEnableClientState( GL_NORMAL_ARRAY );
+      glNormalPointer( GL_FLOAT, stride, (GLubyte *) pointer + noffset );
+   }
+   else {
+      glDisableClientState( GL_NORMAL_ARRAY );
+   }
+
+   /* Vertices */
+   glEnableClientState( GL_VERTEX_ARRAY );
+   glVertexPointer( vcomps, GL_FLOAT, stride, (GLubyte *) pointer + voffset );
+}
Index: /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/OGLComplexAsync.cpp
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/OGLComplexAsync.cpp	(revision 3339)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/OGLComplexAsync.cpp	(revision 3339)
@@ -0,0 +1,858 @@
+/** @file
+ *
+ * VirtualBox Windows NT/2000/XP guest OpenGL ICD
+ *
+ * Complex buffered OpenGL functions
+ *
+ * Copyright (C) 2006-2007 innotek GmbH
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation,
+ * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+ * distribution. VirtualBox OSE is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * If you received this file as part of a commercial VirtualBox
+ * distribution, then only the terms of your commercial VirtualBox
+ * license agreement apply instead of the previous paragraph.
+ *
+ */
+
+#include "VBoxOGL.h"
+#include <iprt/cdefs.h>
+#include <iprt/assert.h>
+
+void APIENTRY glFogfv(GLenum pname, const GLfloat *params)
+{
+    if (pname == GL_FOG_COLOR)
+    {
+        VBOX_OGL_GEN_OP2PTR(Fogfv, pname, 4*sizeof(*params), params);
+    }
+    else
+    {
+        VBOX_OGL_GEN_OP2PTR(Fogfv, pname, 1*sizeof(*params), params);
+    }
+}
+
+void APIENTRY glFogiv(GLenum pname, const GLint *params)
+{
+    if (pname == GL_FOG_COLOR)
+    {
+        VBOX_OGL_GEN_OP2PTR(Fogiv, pname, 4*sizeof(*params), params);
+    }
+    else
+    {
+        VBOX_OGL_GEN_OP2PTR(Fogiv, pname, 1*sizeof(*params), params);
+    }
+}
+
+void APIENTRY glLightModelfv(GLenum pname, const GLfloat *params)
+{
+    if (pname == GL_LIGHT_MODEL_AMBIENT)
+    {
+        VBOX_OGL_GEN_OP2PTR(LightModelfv, pname, 4*sizeof(*params), params);
+    }
+    else
+    {
+        VBOX_OGL_GEN_OP2PTR(LightModelfv, pname, 1*sizeof(*params), params);
+    }
+}
+
+void APIENTRY glLightModeliv(GLenum pname, const GLint *params)
+{
+    if (pname == GL_LIGHT_MODEL_AMBIENT)
+    {
+        VBOX_OGL_GEN_OP2PTR(LightModeliv, pname, 4*sizeof(*params), params);
+    }
+    else
+    {
+        VBOX_OGL_GEN_OP2PTR(LightModeliv, pname, 1*sizeof(*params), params);
+    }
+}
+
+void APIENTRY glLightfv(GLenum light, GLenum pname, const GLfloat *params)
+{
+    uint32_t n = glInternalLightvElem(pname);
+
+    if (!n)
+    {
+        AssertFailed();
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    VBOX_OGL_GEN_OP3PTR(Lightfv, light, pname, n*sizeof(*params), params);
+}
+
+void APIENTRY glLightiv(GLenum light, GLenum pname, const GLint *params)
+{
+    uint32_t n = glInternalLightvElem(pname);
+
+    if (!n)
+    {
+        AssertFailed();
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    VBOX_OGL_GEN_OP3PTR(Lightiv, light, pname, n*sizeof(*params), params);
+}
+
+void APIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params)
+{
+    uint32_t n = glInternalMaterialvElem(pname);
+
+    if (!n)
+    {
+        AssertFailed();
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    VBOX_OGL_GEN_OP3PTR(Materialfv, face, pname, n*sizeof(*params), params);
+}
+
+
+void APIENTRY glMaterialiv (GLenum face, GLenum pname, const GLint *params)
+{
+    uint32_t n = glInternalMaterialvElem(pname);
+
+    if (!n)
+    {
+        AssertFailed();
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    VBOX_OGL_GEN_OP3PTR(Materialfv, face, pname, n*sizeof(*params), params);
+}
+
+void APIENTRY glPixelMapfv (GLenum map, GLsizei mapsize, const GLfloat *values)
+{
+    VBOX_OGL_GEN_OP2PTR(PixelMapfv, map, mapsize*sizeof(*values), values);
+}
+
+void APIENTRY glPixelMapuiv (GLenum map, GLsizei mapsize, const GLuint *values)
+{
+    VBOX_OGL_GEN_OP2PTR(PixelMapuiv, map, mapsize*sizeof(*values), values);
+}
+
+void APIENTRY glPixelMapusv (GLenum map, GLsizei mapsize, const GLushort *values)
+{
+    VBOX_OGL_GEN_OP2PTR(PixelMapusv, map, mapsize*sizeof(*values), values);
+}
+
+void APIENTRY glDeleteTextures(GLsizei n, const GLuint *textures)
+{
+    VBOX_OGL_GEN_OP1PTR(DeleteTextures, n*sizeof(*textures), textures);
+}
+
+void APIENTRY glTexEnviv (GLenum target, GLenum pname, const GLint *params)
+{
+    uint32_t n = glInternalTexEnvvElem(pname);
+
+    if (!n)
+    {
+        AssertFailed();
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    VBOX_OGL_GEN_OP3PTR(TexEnviv, target, pname, n*sizeof(*params), params);
+    return;
+}
+
+void APIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params)
+{
+    uint32_t n = glInternalTexEnvvElem(pname);
+
+    if (!n)
+    {
+        AssertFailed();
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    VBOX_OGL_GEN_OP3PTR(TexEnvfv, target, pname, n*sizeof(*params), params);
+}
+
+void APIENTRY glTexGendv (GLenum coord, GLenum pname, const GLdouble *params)
+{
+    uint32_t n = glInternalTexGenvElem(pname);
+
+    if (!n)
+    {
+        AssertFailed();
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    VBOX_OGL_GEN_OP3PTR(TexGendv, coord, pname, n*sizeof(*params), params);
+    return;
+}
+
+void APIENTRY glTexGenfv (GLenum coord, GLenum pname, const GLfloat *params)
+{
+    uint32_t n = glInternalTexGenvElem(pname);
+
+    if (!n)
+    {
+        AssertFailed();
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    VBOX_OGL_GEN_OP3PTR(TexGenfv, coord, pname, n*sizeof(*params), params);
+    return;
+}
+
+void APIENTRY glTexGeniv (GLenum coord, GLenum pname, const GLint *params)
+{
+    uint32_t n = glInternalTexGenvElem(pname);
+
+    if (!n)
+    {
+        AssertFailed();
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    VBOX_OGL_GEN_OP3PTR(TexGeniv, coord, pname, n*sizeof(*params), params);
+    return;
+}
+
+
+void APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params)
+{
+    uint32_t n = glInternalTexParametervElem(pname);
+
+    if (!n)
+    {
+        AssertFailed();
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    VBOX_OGL_GEN_OP3PTR(TexParameterfv, target, pname, n*sizeof(*params), params);
+    return;
+}
+
+void APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params)
+{
+    uint32_t n = glInternalTexParametervElem(pname);
+
+    if (!n)
+    {
+        AssertFailed();
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    VBOX_OGL_GEN_OP3PTR(TexParameteriv, target, pname, n*sizeof(*params), params);
+    return;
+}
+
+void APIENTRY glLoadMatrixd (const GLdouble *m)
+{
+   VBOX_OGL_GEN_OP1PTR(LoadMatrixd, 16*sizeof(*m), m);
+}
+
+void APIENTRY glLoadMatrixf (const GLfloat *m)
+{
+   VBOX_OGL_GEN_OP1PTR(LoadMatrixf, 16*sizeof(*m), m);
+}
+
+
+void APIENTRY glMultMatrixd (const GLdouble *m)
+{
+   VBOX_OGL_GEN_OP1PTR(MultMatrixd, 16*sizeof(*m), m);
+}
+
+void APIENTRY glMultMatrixf (const GLfloat *m)
+{
+   VBOX_OGL_GEN_OP1PTR(MultMatrixf, 16*sizeof(*m), m);
+}
+
+void APIENTRY glPolygonStipple (const GLubyte *mask)
+{
+   VBOX_OGL_GEN_OP1PTR(PolygonStipple, 32*32/8, mask);
+}
+
+void APIENTRY glClipPlane (GLenum plane, const GLdouble *equation)
+{
+   VBOX_OGL_GEN_OP2PTR(ClipPlane, plane, 4*sizeof(*equation), equation);
+}
+
+
+
+
+/** @todo might not work as the caller could change the array contents afterwards */
+void APIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
+{
+    if (size < 2 || size > 4)
+    {
+        glLogError(GL_INVALID_VALUE);
+        return;
+    }
+
+    GLint cbDataType = glVBoxGetDataTypeSize(type);
+
+    if (!cbDataType)
+    {
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+
+    GLint cVertex   = glInternalGetIntegerv(GL_VERTEX_ARRAY_COUNT_EXT);
+    GLint minStride = size*cbDataType;
+
+    if (    cVertex <= 0
+        ||  stride < minStride)
+    {
+        glLogError(GL_INVALID_VALUE);
+        return;
+    }
+
+    if (stride == 0)
+        stride = minStride;
+
+    VBOX_OGL_GEN_OP4PTR(VertexPointer, size, type, stride, stride * cVertex, pointer);
+    return;
+}
+
+/** @todo might not work as the caller could change the array contents afterwards */
+void APIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
+{
+    if (size < 1 || size > 4)
+    {
+        glLogError(GL_INVALID_VALUE);
+        return;
+    }
+
+    GLint cbDataType = glVBoxGetDataTypeSize(type);
+
+    if (!cbDataType)
+    {
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+
+    GLint cTexCoord = glInternalGetIntegerv(GL_TEXTURE_COORD_ARRAY_COUNT_EXT);
+    GLint minStride = size*cbDataType;
+
+    if (    cTexCoord <= 0
+        ||  stride < minStride)
+    {
+        glLogError(GL_INVALID_VALUE);
+        return;
+    }
+
+    if (stride == 0)
+        stride = minStride;
+
+    VBOX_OGL_GEN_OP4PTR(TexCoordPointer, size, type, stride, stride * cTexCoord, pointer);
+    return;
+}
+
+/** @todo might not work as the caller could change the array contents afterwards */
+void APIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
+{
+    if (size < 3 || size > 4)
+    {
+        glLogError(GL_INVALID_VALUE);
+        return;
+    }
+
+    GLint cbDataType = glVBoxGetDataTypeSize(type);
+
+    if (!cbDataType)
+    {
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+
+    GLint cColors   = glInternalGetIntegerv(GL_COLOR_ARRAY_COUNT_EXT);
+    GLint minStride = size*cbDataType;
+
+    if (    cColors <= 0
+        ||  stride < minStride)
+    {
+        glLogError(GL_INVALID_VALUE);
+        return;
+    }
+
+    if (stride == 0)
+        stride = minStride;
+
+    VBOX_OGL_GEN_OP4PTR(ColorPointer, size, type, stride, stride * cColors, pointer);
+    return;
+}
+
+/** @todo might not work as the caller could change the array contents afterwards */
+void APIENTRY glEdgeFlagPointer (GLsizei stride, const GLvoid *pointer)
+{
+    GLint cEdgeFlag = glInternalGetIntegerv(GL_EDGE_FLAG_ARRAY_COUNT_EXT);
+    GLint minStride = sizeof(GLboolean);
+
+    if (    cEdgeFlag <= 0
+        ||  stride < minStride)
+    {
+        glLogError(GL_INVALID_VALUE);
+        return;
+    }
+
+    if (stride == 0)
+        stride = minStride;
+
+    VBOX_OGL_GEN_OP2PTR(EdgeFlagPointer, stride, stride * cEdgeFlag, pointer);
+    return;
+}
+
+/** @todo might not work as the caller could change the array contents afterwards */
+void APIENTRY glIndexPointer (GLenum type, GLsizei stride, const GLvoid *pointer)
+{
+    GLint cbDataType = glVBoxGetDataTypeSize(type);
+
+    if (!cbDataType)
+    {
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+
+    GLint cIndexPtr = glInternalGetIntegerv(GL_INDEX_ARRAY_COUNT_EXT);
+    GLint minStride = cbDataType;
+
+    if (    cIndexPtr <= 0
+        ||  stride < minStride)
+    {
+        glLogError(GL_INVALID_VALUE);
+        return;
+    }
+
+    if (stride == 0)
+        stride = minStride;
+
+    VBOX_OGL_GEN_OP3PTR(IndexPointer, type, stride, stride * cIndexPtr, pointer);
+}
+
+/** @todo might not work as the caller could change the array contents afterwards */
+void APIENTRY glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer)
+{
+    GLint cbDataType = glVBoxGetDataTypeSize(type);
+
+    if (!cbDataType)
+    {
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+
+    GLint minStride = cbDataType;
+    GLint cNormal   = glInternalGetIntegerv(GL_NORMAL_ARRAY_COUNT_EXT);
+
+    if (    cNormal <= 0
+        ||  stride < minStride)
+    {
+        glLogError(GL_INVALID_VALUE);
+        return;
+    }
+
+    if (stride == 0)
+        stride = minStride;
+
+    VBOX_OGL_GEN_OP3PTR(NormalPointer, type, stride, stride * cNormal, pointer);
+    return;
+}
+
+void APIENTRY glCallLists (GLsizei n, GLenum type, const GLvoid *lists)
+{
+    GLint cbDataType = glVBoxGetDataTypeSize(type);
+
+    if (!cbDataType)
+    {
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    VBOX_OGL_GEN_OP3PTR(CallLists, n, type, n * cbDataType, lists);
+    return;
+}
+
+
+void APIENTRY glMap1d (GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points)
+{
+    GLint cElement, minStride;
+
+    switch (target)
+    {
+    case GL_MAP1_INDEX:
+    case GL_MAP1_TEXTURE_COORD_1:
+        cElement = 1;
+        break;
+
+    case GL_MAP1_TEXTURE_COORD_2:
+        cElement = 2;
+        break;
+
+    case GL_MAP1_NORMAL:
+    case GL_MAP1_TEXTURE_COORD_3:
+    case GL_MAP1_VERTEX_3:
+        cElement = 3;
+        break;
+
+    case GL_MAP1_TEXTURE_COORD_4:
+    case GL_MAP1_VERTEX_4:
+    case GL_MAP1_COLOR_4:
+        cElement = 4;
+        break;
+
+    default:
+        glLogError(GL_INVALID_ENUM);
+        break;
+    }
+    minStride = cElement;
+
+    if (    stride < minStride
+        ||  order < 0)
+    {
+        glLogError(GL_INVALID_VALUE);
+        return;
+    }
+    /* stride is in doubles/floats this time */
+    if (stride == 0)
+        stride = minStride;
+
+    VBOX_OGL_GEN_OP6PTR(Map1d, target, u1, u2, stride, order, stride*order*sizeof(*points), points);
+    return;
+}
+
+void APIENTRY glMap1f (GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points)
+{
+    GLint cElement, minStride;
+
+    switch (target)
+    {
+    case GL_MAP1_INDEX:
+    case GL_MAP1_TEXTURE_COORD_1:
+        cElement = 1;
+        break;
+
+    case GL_MAP1_TEXTURE_COORD_2:
+        cElement = 2;
+        break;
+
+    case GL_MAP1_NORMAL:
+    case GL_MAP1_TEXTURE_COORD_3:
+    case GL_MAP1_VERTEX_3:
+        cElement = 3;
+        break;
+
+    case GL_MAP1_TEXTURE_COORD_4:
+    case GL_MAP1_VERTEX_4:
+    case GL_MAP1_COLOR_4:
+        cElement = 4;
+        break;
+
+    default:
+        glLogError(GL_INVALID_ENUM);
+        break;
+    }
+    minStride = cElement;
+
+    if (    stride < minStride
+        ||  order < 0)
+    {
+        glLogError(GL_INVALID_VALUE);
+        return;
+    }
+    /* stride is in doubles/floats this time */
+    if (stride == 0)
+        stride = minStride;
+
+    VBOX_OGL_GEN_OP6PTR(Map1f, target, u1, u2, stride, order, stride*order*sizeof(*points), points);
+    return;
+}
+
+void APIENTRY glMap2d (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points)
+{
+    GLint cElement, minuStride, minvStride;
+
+    switch (target)
+    {
+    case GL_MAP2_INDEX:
+    case GL_MAP2_TEXTURE_COORD_1:
+        cElement = 1;
+        break;
+
+    case GL_MAP2_TEXTURE_COORD_2:
+        cElement = 2;
+        break;
+
+    case GL_MAP2_NORMAL:
+    case GL_MAP2_TEXTURE_COORD_3:
+    case GL_MAP2_VERTEX_3:
+        cElement = 3;
+        break;
+
+    case GL_MAP2_TEXTURE_COORD_4:
+    case GL_MAP2_VERTEX_4:
+    case GL_MAP2_COLOR_4:
+        cElement = 4;
+        break;
+
+    default:
+        glLogError(GL_INVALID_ENUM);
+        break;
+    }
+    minuStride = cElement;
+    minvStride = minuStride*uorder;
+
+    if (    ustride < minuStride
+        ||  uorder < 0
+        ||  vstride < minvStride
+        ||  vorder < 0)
+    {
+        glLogError(GL_INVALID_VALUE);
+        return;
+    }
+    /* stride is in doubles/floats this time */
+    if (ustride == 0)
+        ustride = minuStride;
+
+    if (vstride == 0)
+        vstride = minuStride*uorder;
+
+    VBOX_OGL_GEN_OP10PTR(Map2d, target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, ustride*uorder * vstride*vorder * sizeof(*points), points);
+    return;
+}
+
+void APIENTRY glMap2f (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points)
+{
+    GLint cElement, minuStride, minvStride;
+
+    switch (target)
+    {
+    case GL_MAP2_INDEX:
+    case GL_MAP2_TEXTURE_COORD_1:
+        cElement = 1;
+        break;
+
+    case GL_MAP2_TEXTURE_COORD_2:
+        cElement = 2;
+        break;
+
+    case GL_MAP2_NORMAL:
+    case GL_MAP2_TEXTURE_COORD_3:
+    case GL_MAP2_VERTEX_3:
+        cElement = 3;
+        break;
+
+    case GL_MAP2_TEXTURE_COORD_4:
+    case GL_MAP2_VERTEX_4:
+    case GL_MAP2_COLOR_4:
+        cElement = 4;
+        break;
+
+    default:
+        glLogError(GL_INVALID_ENUM);
+        break;
+    }
+    minuStride = cElement;
+    minvStride = minuStride*uorder;
+
+    if (    ustride < minuStride
+        ||  uorder < 0
+        ||  vstride < minvStride
+        ||  vorder < 0)
+    {
+        glLogError(GL_INVALID_VALUE);
+        return;
+    }
+    /* stride is in doubles/floats this time */
+    if (ustride == 0)
+        ustride = minuStride;
+
+    if (vstride == 0)
+        vstride = minuStride*uorder;
+
+    VBOX_OGL_GEN_OP10PTR(Map2f, target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, ustride*uorder * vstride*vorder * sizeof(*points), points);
+    return;
+}
+
+void APIENTRY glTexImage1D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
+{
+    GLint cbDataType = glVBoxGetDataTypeSize(type);
+
+    if (!cbDataType)
+    {
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    if (target != GL_TEXTURE_1D)
+    {
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    if (    level < 0 
+        ||  (border != 0 && border != 1))
+    {
+        glLogError(GL_INVALID_VALUE);
+        return;
+    }
+    if (    width < 0
+        ||  width > glInternalGetIntegerv(GL_MAX_TEXTURE_SIZE)+2)
+    {
+        glLogError(GL_INVALID_VALUE);
+        return;
+    }
+    GLint cbPixel = cbDataType * glInternalGetPixelFormatElements(format);
+
+    VBOX_OGL_GEN_OP8PTR(TexImage1D, target, level, internalformat, width, border, format, type, cbPixel*width, pixels);
+    return;
+}
+
+void APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
+{
+    GLint maxTextureSize = glInternalGetIntegerv(GL_MAX_TEXTURE_SIZE) + 2;
+    GLint cbDataType = glVBoxGetDataTypeSize(type);
+
+    if (!cbDataType)
+    {
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    if (target != GL_TEXTURE_1D)
+    {
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    if (    level < 0 
+        ||  (border != 0 && border != 1))
+    {
+        glLogError(GL_INVALID_VALUE);
+        return;
+    }
+    if (    width < 0
+        ||  width > maxTextureSize
+        ||  height < 0
+        ||  height > maxTextureSize)
+    {
+        glLogError(GL_INVALID_VALUE);
+        return;
+    }
+    GLint cbPixel = cbDataType * glInternalGetPixelFormatElements(format);
+
+    VBOX_OGL_GEN_OP9PTR(TexImage2D, target, level, internalformat, width, height, border, format, type, cbPixel*width*height, pixels);
+    return;
+}
+
+
+void APIENTRY glTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
+{
+    GLint w = glInternalGetTexLevelParameteriv(GL_TEXTURE_WIDTH);
+    GLint b = glInternalGetTexLevelParameteriv(GL_TEXTURE_BORDER);
+    GLint cbDataType = glVBoxGetDataTypeSize(type);
+
+    if (!cbDataType)
+    {
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    if (target != GL_TEXTURE_1D)
+    {
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    if (    level < 0 
+        ||  xoffset < -b
+        ||  (xoffset + width) > (w - b))
+    {
+        glLogError(GL_INVALID_VALUE);
+        return;
+    }
+    if (    width < 0
+        ||  width > glInternalGetIntegerv(GL_MAX_TEXTURE_SIZE)+2)
+    {
+        glLogError(GL_INVALID_VALUE);
+        return;
+    }
+    GLint cbFormat = glInternalGetPixelFormatElements(format);
+    if (cbFormat == 0)
+    {
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+
+    GLint cbPixel = cbDataType * cbFormat;
+
+    /** @todo could optimize by skipping unused texture data */
+    VBOX_OGL_GEN_OP7PTR(TexSubImage1D, target, level, xoffset, width, format, type, cbPixel*width, pixels);
+    return;
+}
+
+void APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
+{
+    GLint w = glInternalGetTexLevelParameteriv(GL_TEXTURE_WIDTH);
+    GLint h = glInternalGetTexLevelParameteriv(GL_TEXTURE_HEIGHT);
+    GLint b = glInternalGetTexLevelParameteriv(GL_TEXTURE_BORDER);
+    GLint cbDataType = glVBoxGetDataTypeSize(type);
+
+    if (!cbDataType)
+    {
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    if (target != GL_TEXTURE_1D)
+    {
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    if (    level < 0 
+        ||  xoffset < -b
+        ||  (xoffset + width) > (w - b)
+        ||  yoffset < -b
+        ||  (yoffset + height) > (h - b))
+    {
+        glLogError(GL_INVALID_VALUE);
+        return;
+    }
+    if (    width < 0
+        ||  width > glInternalGetIntegerv(GL_MAX_TEXTURE_SIZE)+2)
+    {
+        glLogError(GL_INVALID_VALUE);
+        return;
+    }
+    GLint cbFormat = glInternalGetPixelFormatElements(format);
+    if (cbFormat == 0)
+    {
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+
+    GLint cbPixel = cbDataType * cbFormat;
+
+    /** @todo could optimize by skipping unused texture data */
+    VBOX_OGL_GEN_OP9PTR(TexSubImage2D, target, level, xoffset, yoffset, width, height, format, type, cbPixel*width*height, pixels);
+    return;
+}
+
+void APIENTRY glPrioritizeTextures (GLsizei n, const GLuint *textures, const GLclampf *priorities)
+{
+    if (n < 0)
+    {
+        glLogError(GL_INVALID_VALUE);
+        return;
+    }
+    VBOX_OGL_GEN_OP3PTRPTR(PrioritizeTextures, n, n*sizeof(*textures), textures, n*sizeof(*priorities), priorities);
+    return;
+}
+
+
+void APIENTRY glRectdv (const GLdouble *v1, const GLdouble *v2)
+{
+    VBOX_OGL_GEN_OP2PTRPTR(Rectdv, sizeof(GLdouble)*2, v1, sizeof(GLdouble)*2, v2);
+}
+
+void APIENTRY glRectfv (const GLfloat *v1, const GLfloat *v2)
+{
+    VBOX_OGL_GEN_OP2PTRPTR(Rectfv, sizeof(GLfloat)*2, v1, sizeof(GLfloat)*2, v2);
+}
+
+void APIENTRY glRectiv (const GLint *v1, const GLint *v2)
+{
+    VBOX_OGL_GEN_OP2PTRPTR(Rectiv, sizeof(GLint)*2, v1, sizeof(GLint)*2, v2);
+}
+
+void APIENTRY glRectsv (const GLshort *v1, const GLshort *v2)
+{
+    VBOX_OGL_GEN_OP2PTRPTR(Rectsv, sizeof(GLshort)*2, v1, sizeof(GLshort)*2, v2);
+}
Index: /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/OGLComplexSync.cpp
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/OGLComplexSync.cpp	(revision 3339)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/OGLComplexSync.cpp	(revision 3339)
@@ -0,0 +1,424 @@
+/** @file
+ *
+ * VirtualBox Windows NT/2000/XP guest OpenGL ICD
+ *
+ * Complex buffered OpenGL functions
+ *
+ * Copyright (C) 2006-2007 innotek GmbH
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation,
+ * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+ * distribution. VirtualBox OSE is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * If you received this file as part of a commercial VirtualBox
+ * distribution, then only the terms of your commercial VirtualBox
+ * license agreement apply instead of the previous paragraph.
+ *
+ */
+
+#include "VBoxOGL.h"
+
+
+/* Driver functions */
+HGLRC APIENTRY DrvCreateContext(HDC hdc)
+{
+    uint32_t cx, cy;
+    PIXELFORMATDESCRIPTOR pfd;
+    int rc;
+    HWND hwnd;
+
+    /** check dimensions and pixel format of hdc */
+    hwnd = WindowFromDC(hdc);
+    if (hwnd)
+    {
+        RECT rect;
+
+        GetWindowRect(hwnd, &rect);
+        cx = rect.right - rect.left;
+        cy = rect.bottom - rect.top;
+    }
+    else
+    {
+        /** @todo get dimenions of memory dc; a bitmap should be selected in there */
+        AssertFailed();
+    }
+
+    uint32_t iPixelFormat = GetPixelFormat(hdc);
+    if (iPixelFormat)
+    {
+        rc = DescribePixelFormat(hdc, iPixelFormat, sizeof(pfd), &pfd);
+        Assert(rc);
+    }
+    else
+    {
+        pfd.cColorBits = GetDeviceCaps(hdc, BITSPIXEL);
+        pfd.iPixelType = PFD_TYPE_RGBA;
+        pfd.cDepthBits = 16;
+    }
+    VBOX_OGL_GEN_SYNC_OP6_RET(HGLRC, DrvCreateContext, hdc, cx, cy, pfd.cColorBits, pfd.iPixelType, pfd.cDepthBits);
+    return retval;
+}
+
+/* Test export for directly linking with vboxogl.dll */
+HGLRC WINAPI wglCreateContext(HDC hdc)
+{
+    return DrvCreateContext(hdc);
+}
+
+HGLRC APIENTRY DrvCreateLayerContext(HDC hdc, int iLayerPlane)
+{
+    uint32_t cx, cy;
+    PIXELFORMATDESCRIPTOR pfd;
+    int rc;
+    HWND hwnd;
+
+    /** check dimensions and pixel format of hdc */
+    hwnd = WindowFromDC(hdc);
+    if (hwnd)
+    {
+        RECT rect;
+
+        GetWindowRect(hwnd, &rect);
+        cx = rect.right - rect.left;
+        cy = rect.bottom - rect.top;
+    }
+    else
+    {
+        /** @todo get dimenions of memory dc; a bitmap should be selected in there */
+        AssertFailed();
+    }
+    uint32_t iPixelFormat = GetPixelFormat(hdc);
+    if (iPixelFormat)
+    {
+        rc = DescribePixelFormat(hdc, iPixelFormat, sizeof(pfd), &pfd);
+        Assert(rc);
+    }
+    else
+    {
+        pfd.cColorBits = GetDeviceCaps(hdc, BITSPIXEL);
+        pfd.iPixelType = PFD_TYPE_RGBA;
+        pfd.cDepthBits = 16;
+    }
+
+    VBOX_OGL_GEN_SYNC_OP7_RET(HGLRC, DrvCreateLayerContext, hdc, iLayerPlane, cx, cy, pfd.cColorBits, pfd.iPixelType, pfd.cDepthBits);
+    return retval;
+}
+
+BOOL APIENTRY DrvDescribeLayerPlane(HDC hdc,int iPixelFormat,
+                                    int iLayerPlane, UINT nBytes,
+                                    LPLAYERPLANEDESCRIPTOR plpd)
+{
+    VBOX_OGL_GEN_SYNC_OP5_PASS_PTR_RET(BOOL, DrvDescribeLayerPlane, hdc, iPixelFormat, iLayerPlane, nBytes, nBytes, plpd);
+    return retval;
+}
+
+int APIENTRY DrvGetLayerPaletteEntries(HDC hdc, int iLayerPlane,
+                                       int iStart, int cEntries,
+                                       COLORREF *pcr)
+{
+    VBOX_OGL_GEN_SYNC_OP5_PASS_PTR_RET(int, DrvGetLayerPaletteEntries, hdc, iLayerPlane, iStart, cEntries, sizeof(COLORREF)*cEntries, pcr);
+    return retval;
+}
+
+int APIENTRY DrvDescribePixelFormat(HDC hdc, int iPixelFormat, UINT nBytes, LPPIXELFORMATDESCRIPTOR ppfd)
+{
+    /* if ppfd == NULL, then DrvDescribelayerPlane returns the maximum nr of supported pixel formats */
+    VBOX_OGL_GEN_SYNC_OP4_PASS_PTR_RET(int, DrvDescribePixelFormat, hdc, iPixelFormat, nBytes, nBytes, ppfd);
+    return retval;
+}
+
+void APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
+{
+    GLint cbDataType = glVBoxGetDataTypeSize(type);
+
+    if (!cbDataType)
+    {
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+
+    GLint cbPixel = cbDataType * glInternalGetPixelFormatElements(format);
+
+    VBOX_OGL_GEN_SYNC_OP7_PASS_PTR(ReadPixels, x, y, width, height, format, type, cbPixel*width*height, pixels);
+    return;
+}
+
+
+/** @todo */
+void APIENTRY glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer)
+{
+    AssertFailed();
+}
+
+/** @todo */
+void APIENTRY glSelectBuffer(GLsizei size, GLuint *buffer)
+{
+    AssertFailed();
+}
+
+/** @todo */
+/* Note: when in GL_FEEDBACK or GL_SELECT mode -> fill those buffers
+ *       when switching to GL_FEEDBACK or GL_SELECT mode -> pass pointers 
+ */
+GLint APIENTRY glRenderMode (GLenum mode)
+{
+    AssertFailed();
+    VBOX_OGL_GEN_SYNC_OP1_RET(GLint, RenderMode, mode);
+    return retval;
+}
+
+
+void APIENTRY glGenTextures (GLsizei n, GLuint *textures)
+{
+    VBOX_OGL_GEN_SYNC_OP2_PASS_PTR(GenTextures, n, n*sizeof(GLuint), textures);
+    return;
+}
+
+GLboolean APIENTRY glAreTexturesResident (GLsizei n, const GLuint *textures, GLboolean *residences)
+{
+    AssertFailed();
+    return 1;
+}
+
+void APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
+{
+    AssertFailed();
+    return;
+}
+
+void APIENTRY glBitmap (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)
+{
+    AssertFailed();
+    return;
+}
+
+void APIENTRY glDrawPixels (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
+{
+    AssertFailed();
+    return;
+}
+
+void APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params)
+{
+    uint32_t n = glInternalTexParametervElem(pname);
+
+    if (!n)
+    {
+        AssertFailed();
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    VBOX_OGL_GEN_SYNC_OP3_PASS_PTR(GetTexParameterfv, target, pname, n*sizeof(*params), params);
+    return;
+}
+
+void APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params)
+{
+    uint32_t n = glInternalTexParametervElem(pname);
+
+    if (!n)
+    {
+        AssertFailed();
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    VBOX_OGL_GEN_SYNC_OP3_PASS_PTR(GetTexParameteriv, target, pname, n*sizeof(*params), params);
+    return;
+}
+
+void APIENTRY glGetTexGenfv (GLenum coord, GLenum pname, GLfloat *params)
+{
+    uint32_t n = glInternalTexGenvElem(pname);
+
+    if (!n)
+    {
+        AssertFailed();
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    VBOX_OGL_GEN_SYNC_OP3_PASS_PTR(GetTexGenfv, coord, pname, n*sizeof(*params), params);
+    return;
+}
+
+void APIENTRY glGetTexGeniv (GLenum coord, GLenum pname, GLint *params)
+{
+    uint32_t n = glInternalTexGenvElem(pname);
+
+    if (!n)
+    {
+        AssertFailed();
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    VBOX_OGL_GEN_SYNC_OP3_PASS_PTR(GetTexGeniv, coord, pname, n*sizeof(*params), params);
+    return;
+}
+
+void APIENTRY glGetTexGendv (GLenum coord, GLenum pname, GLdouble *params)
+{
+    uint32_t n = glInternalTexGenvElem(pname);
+
+    if (!n)
+    {
+        AssertFailed();
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    VBOX_OGL_GEN_SYNC_OP3_PASS_PTR(GetTexGendv, coord, pname, n*sizeof(*params), params);
+    return;
+}
+
+void APIENTRY glGetTexEnviv (GLenum target, GLenum pname, GLint *params)
+{
+    uint32_t n = glInternalTexEnvvElem(pname);
+
+    if (!n)
+    {
+        AssertFailed();
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    VBOX_OGL_GEN_SYNC_OP3_PASS_PTR(GetTexEnviv, target, pname, n*sizeof(*params), params);
+}
+
+void APIENTRY glGetTexEnvfv (GLenum target, GLenum pname, GLfloat *params)
+{
+    uint32_t n = glInternalTexEnvvElem(pname);
+
+    if (!n)
+    {
+        AssertFailed();
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    VBOX_OGL_GEN_SYNC_OP3_PASS_PTR(GetTexEnvfv, target, pname, n*sizeof(*params), params);
+}
+
+void APIENTRY glGetPixelMapfv (GLenum map, GLfloat *values)
+{
+    uint32_t mapsize = glInternalGetIntegerv(map);
+    if (!mapsize)
+    {
+        AssertFailed();
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    VBOX_OGL_GEN_SYNC_OP2_PASS_PTR(GetPixelMapfv, map, mapsize*sizeof(*values), values);
+}
+
+void APIENTRY glGetPixelMapuiv (GLenum map, GLuint *values)
+{
+    uint32_t mapsize = glInternalGetIntegerv(map);
+    if (!mapsize)
+    {
+        AssertFailed();
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    VBOX_OGL_GEN_SYNC_OP2_PASS_PTR(GetPixelMapuiv, map, mapsize*sizeof(*values), values);
+}
+
+void APIENTRY glGetPixelMapusv (GLenum map, GLushort *values)
+{
+    uint32_t mapsize = glInternalGetIntegerv(map);
+    if (!mapsize)
+    {
+        AssertFailed();
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    VBOX_OGL_GEN_SYNC_OP2_PASS_PTR(GetPixelMapusv, map, mapsize*sizeof(*values), values);
+}
+
+void APIENTRY glGetMaterialiv (GLenum face, GLenum pname, GLint *params)
+{
+    uint32_t n = glInternalMaterialvElem(pname);
+
+    if (!n)
+    {
+        AssertFailed();
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    VBOX_OGL_GEN_SYNC_OP3_PASS_PTR(GetMaterialiv, face, pname, n*sizeof(*params), params);
+}
+
+void APIENTRY glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params)
+{
+    uint32_t n = glInternalMaterialvElem(pname);
+
+    if (!n)
+    {
+        AssertFailed();
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    VBOX_OGL_GEN_SYNC_OP3_PASS_PTR(GetMaterialfv, face, pname, n*sizeof(*params), params);
+}
+
+void APIENTRY glGetLightiv (GLenum light, GLenum pname, GLint *params)
+{
+    uint32_t n = glInternalLightvElem(pname);
+
+    if (!n)
+    {
+        AssertFailed();
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    VBOX_OGL_GEN_SYNC_OP3_PASS_PTR(GetLightiv, light, pname, n*sizeof(*params), params);
+}
+
+void APIENTRY glGetLightfv (GLenum light, GLenum pname, GLfloat *params)
+{
+    uint32_t n = glInternalLightvElem(pname);
+
+    if (!n)
+    {
+        AssertFailed();
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+    VBOX_OGL_GEN_SYNC_OP3_PASS_PTR(GetLightfv, light, pname, n*sizeof(*params), params);
+}
+
+void APIENTRY glGetClipPlane (GLenum plane, GLdouble *equation)
+{
+    VBOX_OGL_GEN_SYNC_OP2_PASS_PTR(GetClipPlane, plane, 4*sizeof(GLdouble), equation);
+    return;
+}
+
+void APIENTRY glGetPolygonStipple (GLubyte *mask)
+{
+   VBOX_OGL_GEN_SYNC_OP1_PASS_PTR(GetPolygonStipple, 32*32/8, mask);
+}
+
+void APIENTRY glGetTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
+{
+    GLint cbDataType = glVBoxGetDataTypeSize(type);
+
+    if (!cbDataType)
+    {
+        glLogError(GL_INVALID_ENUM);
+        return;
+    }
+
+    /** @todo check dimensions of texture */
+    AssertFailed();
+    GLint cbPixel = cbDataType * glInternalGetPixelFormatElements(format);
+    VBOX_OGL_GEN_SYNC_OP5_PASS_PTR(GetTexImage, target, level, format, type, cbPixel, pixels);
+}
+
+void APIENTRY glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params)
+{
+    VBOX_OGL_GEN_SYNC_OP4_PASS_PTR(GetTexLevelParameterfv, target, level, pname, sizeof(*params), params);
+}
+
+void APIENTRY glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params)
+{
+    VBOX_OGL_GEN_SYNC_OP4_PASS_PTR(GetTexLevelParameteriv, target, level, pname, sizeof(*params), params);
+}
Index: /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/OGLLookup.cpp
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/OGLLookup.cpp	(revision 3339)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/OGLLookup.cpp	(revision 3339)
@@ -0,0 +1,213 @@
+/** @file
+ *
+ * VirtualBox Windows NT/2000/XP guest OpenGL ICD
+ *
+ * Parameter size helpers
+ *
+ * Copyright (C) 2006-2007 innotek GmbH
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation,
+ * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+ * distribution. VirtualBox OSE is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * If you received this file as part of a commercial VirtualBox
+ * distribution, then only the terms of your commercial VirtualBox
+ * license agreement apply instead of the previous paragraph.
+ *
+ */
+
+#include "VBoxOGL.h"
+#include <iprt/cdefs.h>
+#include <iprt/assert.h>
+
+/* DataType */
+static GLuint glDataTypeSize[11] = 
+{
+/* GL_BYTE */                           sizeof(GLbyte),
+/* GL_UNSIGNED_BYTE */                  sizeof(GLubyte),
+/* GL_SHORT */                          sizeof(GLshort),
+/* GL_UNSIGNED_SHORT */                 sizeof(GLushort),
+/* GL_INT */                            sizeof(GLint),
+/* GL_UNSIGNED_INT */                   sizeof(GLuint),
+/* GL_FLOAT */                          sizeof(GLfloat),
+/* GL_2_BYTES */                        2,
+/* GL_3_BYTES */                        3,
+/* GL_4_BYTES */                        4,
+/* GL_DOUBLE */                         sizeof(GLdouble),
+};
+
+/**
+ * Query the size of the specified data type
+ *
+ * @returns type size or 0 if unknown type
+ * @param   type        data type
+ */
+GLint glVBoxGetDataTypeSize(GLenum type)
+{
+    if (type - GL_BYTE >= RT_ELEMENTS(glDataTypeSize))
+    {
+        return 0;
+    }
+    return glDataTypeSize[type-GL_BYTE];
+}
+
+/**
+ * Query the specified cached parameter
+ * 
+ * @returns requested cached value
+ * @param   type        Parameter type (Note: minimal checks only!)
+ */
+GLint glInternalGetIntegerv(GLenum type)
+{
+    AssertFailed();
+    return 0;
+}
+
+/**
+ * Query the specified cached texture level parameter
+ * 
+ * @returns requested cached value
+ * @param   type        Parameter type (Note: minimal checks only!)
+ */
+GLint glInternalGetTexLevelParameteriv(GLenum type)
+{
+    AssertFailed();
+    return 0;
+}
+
+
+uint32_t glInternalLightvElem(GLenum pname)
+{
+    switch (pname)
+    {
+    case GL_AMBIENT:
+    case GL_DIFFUSE:
+    case GL_SPECULAR:
+    case GL_POSITION:
+        return 4;
+
+    case GL_SPOT_DIRECTION:
+        return 3;
+
+    case GL_SPOT_EXPONENT:
+    case GL_SPOT_CUTOFF:
+    case GL_CONSTANT_ATTENUATION:
+    case GL_LINEAR_ATTENUATION:
+    case GL_QUADRATIC_ATTENUATION:
+        return 1;
+
+    default:
+        return 0;
+    }
+}
+
+
+uint32_t glInternalMaterialvElem(GLenum pname)
+{
+    switch (pname)
+    {
+    case GL_AMBIENT:
+    case GL_DIFFUSE:
+    case GL_SPECULAR:
+    case GL_EMISSION:
+    case GL_AMBIENT_AND_DIFFUSE:
+        return 4;
+
+    case GL_SHININESS:
+        return 1;
+
+    case GL_COLOR_INDEXES:
+        return 3;
+
+    default:
+        return 0;
+    }
+}
+
+uint32_t glInternalTexEnvvElem(GLenum pname)
+{
+    switch (pname)
+    {
+    case GL_TEXTURE_ENV_MODE:
+        return 1;
+
+    case GL_TEXTURE_ENV_COLOR:
+        return 4;
+
+    default:
+        return 0;
+    }
+}
+
+uint32_t glInternalTexGenvElem(GLenum pname)
+{
+    switch (pname)
+    {
+    case GL_TEXTURE_GEN_MODE:
+        return 1;
+
+    case GL_OBJECT_PLANE:
+    case GL_EYE_PLANE:
+        return 4;
+
+    default:
+        return 0;
+    }
+}
+
+uint32_t glInternalTexParametervElem(GLenum pname)
+{
+    switch (pname)
+    {
+    case GL_TEXTURE_MAG_FILTER:
+    case GL_TEXTURE_MIN_FILTER:
+    case GL_TEXTURE_WRAP_S:
+    case GL_TEXTURE_WRAP_T:
+    case GL_TEXTURE_PRIORITY:
+        return 1;
+
+    case GL_TEXTURE_BORDER_COLOR:
+        return 4;
+
+    default:
+        return 0;
+    }
+}
+
+/**
+ * Query the number of bytes required for a pixel in the specified format
+ * 
+ * @returns requested pixel size
+ * @param   type        Parameter type
+ */
+GLint glInternalGetPixelFormatElements(GLenum format)
+{
+    switch (format)
+    {
+    case GL_COLOR_INDEX:
+    case GL_STENCIL_INDEX:
+    case GL_DEPTH_COMPONENT:
+    case GL_RED:
+    case GL_GREEN:
+    case GL_BLUE:
+    case GL_ALPHA:
+    case GL_LUMINANCE:
+    case GL_LUMINANCE_ALPHA:
+        return 1;
+
+    case GL_RGB:
+    case GL_BGR_EXT:
+        return 3;
+
+    case GL_RGBA:
+    case GL_BGRA_EXT:
+        return 4;
+    default:
+        AssertFailed();
+        return 0;
+    }
+}
Index: /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/OGLSimpleAsync.cpp
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/OGLSimpleAsync.cpp	(revision 3339)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/OGLSimpleAsync.cpp	(revision 3339)
@@ -0,0 +1,279 @@
+/** @file
+ *
+ * VirtualBox Windows NT/2000/XP guest OpenGL ICD
+ *
+ * Simple buffered OpenGL functions
+ *
+ * Copyright (C) 2006-2007 innotek GmbH
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation,
+ * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+ * distribution. VirtualBox OSE is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * If you received this file as part of a commercial VirtualBox
+ * distribution, then only the terms of your commercial VirtualBox
+ * license agreement apply instead of the previous paragraph.
+ *
+ */
+
+#include "VBoxOGL.h"
+
+/** @todo sync? */
+GL_GEN_FUNC1(ReadBuffer, GLenum);
+
+/** @todo sync? */
+GL_GEN_VPAR_FUNC5(CopyPixels, GLint, GLint, GLsizei, GLsizei, GLenum);
+
+GL_GEN_FUNC1(Enable,        GLenum);
+GL_GEN_FUNC1(Disable,       GLenum);
+
+GL_GEN_VPAR_FUNC2(Accum,        GLenum,     GLfloat);
+GL_GEN_VPAR_FUNC2(AlphaFunc,    GLenum,     GLclampf);
+GL_GEN_VPAR_FUNC2(BindTexture,  GLenum,     GLuint);
+
+GL_GEN_FUNC1(ArrayElement,  GLint);
+
+GL_GEN_FUNC1(Begin,         GLenum);
+GL_GEN_FUNC2(BlendFunc,     GLenum);
+
+GL_GEN_FUNC1(CallList,      GLuint);
+
+GL_GEN_FUNC3V(Color3b,      GLbyte);
+GL_GEN_FUNC3V(Color3d,      GLdouble);
+GL_GEN_FUNC3V(Color3f,      GLfloat);
+GL_GEN_FUNC3V(Color3i,      GLint);
+GL_GEN_FUNC3V(Color3s,      GLshort);
+
+GL_GEN_FUNC3V(Color3ub,     GLubyte);
+GL_GEN_FUNC3V(Color3ui,     GLuint);
+GL_GEN_FUNC3V(Color3us,     GLushort);
+
+GL_GEN_FUNC4V(Color4b,      GLbyte);
+GL_GEN_FUNC4V(Color4d,      GLdouble);
+GL_GEN_FUNC4V(Color4f,      GLfloat);
+GL_GEN_FUNC4V(Color4i,      GLint);
+GL_GEN_FUNC4V(Color4s,      GLshort);
+
+GL_GEN_FUNC4V(Color4ub,     GLubyte);
+GL_GEN_FUNC4V(Color4ui,     GLuint);
+GL_GEN_FUNC4V(Color4us,     GLushort);
+
+GL_GEN_FUNC1(Clear,         GLbitfield);
+GL_GEN_FUNC4(ClearAccum,    GLfloat);
+GL_GEN_FUNC4(ClearColor,    GLclampf);
+GL_GEN_FUNC1(ClearDepth,    GLclampd);
+GL_GEN_FUNC1(ClearIndex,    GLfloat);
+GL_GEN_FUNC1(ClearStencil,  GLint);
+
+GL_GEN_FUNC2V(Vertex2d,     GLdouble);
+GL_GEN_FUNC2V(Vertex2f,     GLfloat);
+GL_GEN_FUNC2V(Vertex2i,     GLint);
+GL_GEN_FUNC2V(Vertex2s,     GLshort);
+
+GL_GEN_FUNC3V(Vertex3d,     GLdouble);
+GL_GEN_FUNC3V(Vertex3f,     GLfloat);
+GL_GEN_FUNC3V(Vertex3i,     GLint);
+GL_GEN_FUNC3V(Vertex3s,     GLshort);
+
+GL_GEN_FUNC4V(Vertex4d,     GLdouble);
+GL_GEN_FUNC4V(Vertex4f,     GLfloat);
+GL_GEN_FUNC4V(Vertex4i,     GLint);
+GL_GEN_FUNC4V(Vertex4s,     GLshort);
+
+GL_GEN_FUNC1V(TexCoord1d,   GLdouble);
+GL_GEN_FUNC1V(TexCoord1f,   GLfloat);
+GL_GEN_FUNC1V(TexCoord1i,   GLint);
+GL_GEN_FUNC1V(TexCoord1s,   GLshort);
+
+GL_GEN_FUNC2V(TexCoord2d,   GLdouble);
+GL_GEN_FUNC2V(TexCoord2f,   GLfloat);
+GL_GEN_FUNC2V(TexCoord2i,   GLint);
+GL_GEN_FUNC2V(TexCoord2s,   GLshort);
+
+GL_GEN_FUNC3V(TexCoord3d,   GLdouble);
+GL_GEN_FUNC3V(TexCoord3f,   GLfloat);
+GL_GEN_FUNC3V(TexCoord3i,   GLint);
+GL_GEN_FUNC3V(TexCoord3s,   GLshort);
+
+GL_GEN_FUNC4V(TexCoord4d,   GLdouble);
+GL_GEN_FUNC4V(TexCoord4f,   GLfloat);
+GL_GEN_FUNC4V(TexCoord4i,   GLint);
+GL_GEN_FUNC4V(TexCoord4s,   GLshort);
+
+GL_GEN_FUNC3V(Normal3b,     GLbyte);
+GL_GEN_FUNC3V(Normal3d,     GLdouble);
+GL_GEN_FUNC3V(Normal3f,     GLfloat);
+GL_GEN_FUNC3V(Normal3i,     GLint);
+GL_GEN_FUNC3V(Normal3s,     GLshort);
+
+GL_GEN_FUNC2V(RasterPos2d,  GLdouble);
+GL_GEN_FUNC2V(RasterPos2f,  GLfloat);
+GL_GEN_FUNC2V(RasterPos2i,  GLint);
+GL_GEN_FUNC2V(RasterPos2s,  GLshort);
+
+GL_GEN_FUNC3V(RasterPos3d,  GLdouble);
+GL_GEN_FUNC3V(RasterPos3f,  GLfloat);
+GL_GEN_FUNC3V(RasterPos3i,  GLint);
+GL_GEN_FUNC3V(RasterPos3s,  GLshort);
+
+GL_GEN_FUNC4V(RasterPos4d,  GLdouble);
+GL_GEN_FUNC4V(RasterPos4f,  GLfloat);
+GL_GEN_FUNC4V(RasterPos4i,  GLint);
+GL_GEN_FUNC4V(RasterPos4s,  GLshort);
+
+GL_GEN_FUNC1V(EvalCoord1d,  GLdouble);
+GL_GEN_FUNC1V(EvalCoord1f,  GLfloat);
+
+GL_GEN_FUNC2V(EvalCoord2d,  GLdouble);
+GL_GEN_FUNC2V(EvalCoord2f,  GLfloat);
+
+GL_GEN_FUNC1(EvalPoint1,    GLint);
+GL_GEN_FUNC2(EvalPoint2,    GLint);
+
+GL_GEN_FUNC1V(Indexd,       GLdouble);
+GL_GEN_FUNC1V(Indexf,       GLfloat);
+GL_GEN_FUNC1V(Indexi,       GLint);
+GL_GEN_FUNC1V(Indexs,       GLshort);
+GL_GEN_FUNC1V(Indexub,      GLubyte);
+
+GL_GEN_FUNC4(Rotated,       GLdouble);
+GL_GEN_FUNC4(Rotatef,       GLfloat);
+
+GL_GEN_FUNC3(Scaled,        GLdouble);
+GL_GEN_FUNC3(Scalef,        GLfloat);
+
+GL_GEN_FUNC3(Translated,    GLdouble);
+GL_GEN_FUNC3(Translatef,    GLfloat);
+
+GL_GEN_FUNC1(DepthFunc,     GLenum);
+GL_GEN_FUNC1(DepthMask,     GLboolean);
+
+GL_GEN_FUNC1(CullFace,      GLenum);
+
+GL_GEN_VPAR_FUNC2(DeleteLists,      GLuint, GLsizei);
+
+GL_GEN_VPAR_FUNC2(DepthRange,       GLclampd,   GLclampd);
+GL_GEN_FUNC1(DisableClientState,    GLenum);
+GL_GEN_FUNC1(EnableClientState,     GLenum);
+GL_GEN_VPAR_FUNC3(EvalMesh1,        GLenum,     GLint,      GLint);
+GL_GEN_VPAR_FUNC5(EvalMesh2,        GLenum,     GLint,      GLint,  GLint,  GLint);
+GL_GEN_VPAR_FUNC2(LineStipple,      GLint,      GLushort);
+GL_GEN_FUNC1(LineWidth,             GLfloat);
+GL_GEN_FUNC1(ListBase,              GLuint);
+
+GL_GEN_VPAR_FUNC2(Fogf,             GLenum,     GLfloat);
+GL_GEN_VPAR_FUNC2(Fogi,             GLenum,     GLint);
+
+
+GL_GEN_VPAR_FUNC2(LightModelf,      GLenum,     GLfloat);
+GL_GEN_VPAR_FUNC2(LightModeli,      GLenum,     GLint);
+
+
+GL_GEN_VPAR_FUNC3(Lightf,           GLenum,     GLenum,     GLfloat);
+GL_GEN_VPAR_FUNC3(Lighti,           GLenum,     GLenum,     GLint);
+
+
+GL_GEN_VPAR_FUNC3(DrawArrays,       GLenum,     GLint,      GLsizei);
+
+GL_GEN_FUNC1(DrawBuffer, GLenum);
+
+GL_GEN_FUNC1V(EdgeFlag, GLboolean);
+
+GL_GEN_FUNC(End);
+GL_GEN_FUNC(EndList);
+
+GL_GEN_FUNC1(FrontFace,     GLenum);
+
+
+GL_GEN_VPAR_FUNC7(CopyTexImage1D, GLenum , GLint , GLenum , GLint , GLint , GLsizei , GLint );
+
+GL_GEN_VPAR_FUNC8(CopyTexImage2D, GLenum , GLint , GLenum , GLint , GLint , GLsizei , GLsizei , GLint );
+
+GL_GEN_VPAR_FUNC6(CopyTexSubImage1D, GLenum , GLint , GLint , GLint , GLint , GLsizei );
+
+GL_GEN_VPAR_FUNC8(CopyTexSubImage2D, GLenum , GLint , GLint , GLint , GLint , GLint , GLsizei , GLsizei );
+
+GL_GEN_VPAR_FUNC4(ColorMask, GLboolean , GLboolean , GLboolean , GLboolean );
+
+GL_GEN_VPAR_FUNC2(ColorMaterial, GLenum, GLenum );
+
+GL_GEN_FUNC1(LogicOp, GLenum);
+
+GL_GEN_VPAR_FUNC3(MapGrid1d, GLint, GLdouble, GLdouble);
+GL_GEN_VPAR_FUNC3(MapGrid1f, GLint, GLfloat, GLfloat);
+
+GL_GEN_VPAR_FUNC6(MapGrid2d, GLint , GLdouble , GLdouble , GLint , GLdouble , GLdouble );
+
+GL_GEN_VPAR_FUNC6(MapGrid2f, GLint , GLfloat , GLfloat , GLint , GLfloat , GLfloat );
+
+GL_GEN_VPAR_FUNC3(Materialf, GLenum , GLenum , GLfloat );
+
+GL_GEN_VPAR_FUNC3(Materiali, GLenum , GLenum , GLint );
+
+GL_GEN_FUNC1(MatrixMode, GLenum);
+
+GL_GEN_VPAR_FUNC6(Ortho, GLdouble , GLdouble , GLdouble , GLdouble , GLdouble , GLdouble );
+
+GL_GEN_FUNC1(PassThrough, GLfloat);
+
+GL_GEN_VPAR_FUNC2(PixelStoref, GLenum, GLfloat);
+GL_GEN_VPAR_FUNC2(PixelStorei, GLenum, GLint);
+GL_GEN_VPAR_FUNC2(PixelTransferf, GLenum, GLfloat);
+GL_GEN_VPAR_FUNC2(PixelTransferi, GLenum, GLint);
+
+GL_GEN_FUNC2(PixelZoom, GLfloat);
+GL_GEN_FUNC1(PointSize, GLfloat);
+
+GL_GEN_FUNC2(PolygonMode, GLenum)
+GL_GEN_FUNC2(PolygonOffset, GLfloat);
+
+GL_GEN_FUNC(PopAttrib);
+GL_GEN_FUNC(PopClientAttrib);
+GL_GEN_FUNC(PopMatrix);
+GL_GEN_FUNC(PopName);
+
+
+GL_GEN_FUNC1(PushAttrib, GLbitfield);
+GL_GEN_FUNC1(PushClientAttrib, GLbitfield);
+GL_GEN_FUNC (PushMatrix);
+GL_GEN_FUNC1(PushName, GLuint);
+
+GL_GEN_VPAR_FUNC3(TexEnvf, GLenum , GLenum , GLfloat);
+GL_GEN_VPAR_FUNC3(TexEnvi, GLenum , GLenum , GLint);
+GL_GEN_VPAR_FUNC3(TexGend, GLenum , GLenum , GLdouble);
+GL_GEN_VPAR_FUNC3(TexGenf, GLenum , GLenum , GLfloat);
+GL_GEN_VPAR_FUNC3(TexGeni, GLenum , GLenum , GLint);
+
+GL_GEN_VPAR_FUNC3(TexParameterf, GLenum , GLenum , GLfloat );
+GL_GEN_VPAR_FUNC3(TexParameteri, GLenum , GLenum , GLint );
+
+GL_GEN_FUNC (LoadIdentity);
+GL_GEN_FUNC1(LoadName, GLuint);
+
+GL_GEN_FUNC1(ShadeModel, GLenum);
+GL_GEN_VPAR_FUNC3(StencilFunc, GLenum, GLint, GLuint);
+GL_GEN_FUNC1(StencilMask, GLuint);
+GL_GEN_VPAR_FUNC3(StencilOp, GLenum, GLenum, GLenum);
+
+GL_GEN_VPAR_FUNC4(Viewport, GLint, GLint, GLsizei, GLsizei);
+GL_GEN_VPAR_FUNC4(Scissor, GLint, GLint, GLsizei, GLsizei);
+
+
+GL_GEN_FUNC4(Rectd, GLdouble);
+GL_GEN_FUNC4(Rectf, GLfloat);
+GL_GEN_FUNC4(Recti, GLint);
+GL_GEN_FUNC4(Rects, GLshort);
+
+GL_GEN_VPAR_FUNC2(NewList, GLuint, GLenum);
+
+GL_GEN_FUNC2(Hint, GLenum);
+GL_GEN_FUNC1(IndexMask, GLuint);
+GL_GEN_FUNC(InitNames);
+
+
+GL_GEN_FUNC6(Frustum, GLdouble);
+
Index: /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/OGLSimpleSync.cpp
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/OGLSimpleSync.cpp	(revision 3339)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/OGLSimpleSync.cpp	(revision 3339)
@@ -0,0 +1,460 @@
+/** @file
+ *
+ * VirtualBox Windows NT/2000/XP guest OpenGL ICD
+ *
+ * Simple buffered OpenGL functions
+ *
+ * Copyright (C) 2006-2007 innotek GmbH
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation,
+ * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+ * distribution. VirtualBox OSE is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * If you received this file as part of a commercial VirtualBox
+ * distribution, then only the terms of your commercial VirtualBox
+ * license agreement apply instead of the previous paragraph.
+ *
+ */
+
+#include "VBoxOGL.h"
+
+
+BOOL APIENTRY DrvDeleteContext(HGLRC hglrc)
+{
+    VBOX_OGL_GEN_SYNC_OP1_RET(BOOL, DrvDeleteContext, hglrc);
+    return retval;
+}
+
+/* Test export for directly linking with vboxogl.dll */
+BOOL WINAPI wglDeleteContext(HGLRC hglrc)
+{
+    return DrvDeleteContext(hglrc);
+}
+
+BOOL APIENTRY DrvCopyContext(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask)
+{
+    VBOX_OGL_GEN_SYNC_OP3_RET(BOOL, DrvCopyContext, hglrcSrc, hglrcDst, mask);
+    return retval;
+}
+
+void APIENTRY DrvReleaseContext(HGLRC hglrc)
+{
+    VBOX_OGL_GEN_SYNC_OP1(DrvReleaseContext, hglrc);
+}
+
+BOOL APIENTRY DrvShareLists(HGLRC hglrc1, HGLRC hglrc2)
+{
+    VBOX_OGL_GEN_SYNC_OP2_RET(BOOL, DrvShareLists, hglrc1, hglrc2);
+    return retval;
+}
+
+int APIENTRY DrvSetLayerPaletteEntries(HDC hdc, int iLayerPlane,
+                                       int iStart, int cEntries,
+                                       CONST COLORREF *pcr)
+{
+    VBOX_OGL_GEN_SYNC_OP5_PTR_RET(int, DrvSetLayerPaletteEntries, hdc, iLayerPlane, iStart, cEntries, sizeof(COLORREF)*cEntries, pcr);
+    return retval;
+}
+
+BOOL APIENTRY DrvRealizeLayerPalette(HDC hdc, int iLayerPlane, BOOL bRealize)
+{
+    VBOX_OGL_GEN_SYNC_OP3_RET(BOOL, DrvRealizeLayerPalette, hdc, iLayerPlane, bRealize);
+    return retval;
+}
+
+BOOL APIENTRY DrvSwapLayerBuffers(HDC hdc, UINT fuPlanes)
+{
+    VBOX_OGL_GEN_SYNC_OP2_RET(BOOL, DrvSwapLayerBuffers, hdc, fuPlanes);
+    return retval;
+}
+
+BOOL APIENTRY DrvSetPixelFormat(HDC hdc, int iPixelFormat)
+{
+    VBOX_OGL_GEN_SYNC_OP1_RET(BOOL, DrvSetPixelFormat, hdc);
+    return retval;
+}
+
+BOOL APIENTRY DrvSwapBuffers(HDC hdc)
+{
+    VBOX_OGL_GEN_SYNC_OP1_RET(BOOL, DrvSwapBuffers, hdc);
+    return retval;
+}
+
+/* Test export for directly linking with vboxogl.dll */
+BOOL WINAPI SwapBuffers(HDC hdc)
+{
+    return DrvSwapBuffers(hdc);
+}
+
+/* OpenGL functions */
+void APIENTRY glFinish (void)
+{
+    /** @todo if no back buffer, then draw to screen */
+    VBOX_OGL_GEN_SYNC_OP(Finish);
+}
+
+void APIENTRY glFlush (void)
+{
+    /** @todo if no back buffer, then draw to screen */
+    VBOX_OGL_GEN_SYNC_OP(Flush);
+}
+
+GLuint APIENTRY glGenLists (GLsizei range)
+{
+    VBOX_OGL_GEN_SYNC_OP1_RET(GLuint, GenLists, range);
+    return retval;
+}
+
+GLboolean APIENTRY glIsEnabled (GLenum cap)
+{
+    /** @todo cache? */
+    VBOX_OGL_GEN_SYNC_OP1_RET(GLboolean, IsEnabled, cap);
+    return retval;
+}
+
+GLboolean APIENTRY glIsList (GLuint list)
+{
+    VBOX_OGL_GEN_SYNC_OP1_RET(GLboolean, IsList, list);
+    return retval;
+}
+
+GLboolean APIENTRY glIsTexture (GLuint texture)
+{
+    VBOX_OGL_GEN_SYNC_OP1_RET(GLboolean, IsTexture, texture);
+    return retval;
+}
+
+static uint32_t vboxglGetNrElements(GLenum pname)
+{
+    switch(pname)
+    {
+    case GL_ACCUM_ALPHA_BITS:
+    case GL_ACCUM_BLUE_BITS:
+    case GL_ACCUM_GREEN_BITS:
+    case GL_ACCUM_RED_BITS:
+    case GL_ALPHA_BIAS:
+    case GL_ALPHA_BITS:
+    case GL_ALPHA_SCALE:
+    case GL_ALPHA_TEST:
+    case GL_ALPHA_TEST_FUNC:
+    case GL_ALPHA_TEST_REF:
+    case GL_ATTRIB_STACK_DEPTH:
+    case GL_AUTO_NORMAL:
+    case GL_AUX_BUFFERS:
+    case GL_BLEND:
+    case GL_BLEND_DST:
+//    case GL_BLEND_EQUATION_EXT:
+    case GL_BLEND_SRC:
+    case GL_BLUE_BIAS:
+    case GL_BLUE_BITS:
+    case GL_BLUE_SCALE:
+    case GL_CLIENT_ATTRIB_STACK_DEPTH:
+//    case GL_CLIP_PLANEi:
+    case GL_COLOR_ARRAY:
+    case GL_COLOR_ARRAY_SIZE:
+    case GL_COLOR_ARRAY_STRIDE:
+    case GL_COLOR_ARRAY_TYPE:
+    case GL_COLOR_LOGIC_OP:
+    case GL_COLOR_MATERIAL:
+    case GL_COLOR_MATERIAL_FACE:
+    case GL_COLOR_MATERIAL_PARAMETER:
+    case GL_CULL_FACE:
+    case GL_CULL_FACE_MODE:
+    case GL_CURRENT_INDEX:
+    case GL_CURRENT_RASTER_DISTANCE:
+    case GL_CURRENT_RASTER_INDEX:
+    case GL_CURRENT_RASTER_POSITION_VALID:
+    case GL_DEPTH_BIAS:
+    case GL_DEPTH_BITS:
+    case GL_DEPTH_CLEAR_VALUE:
+    case GL_DEPTH_FUNC:
+    case GL_DEPTH_SCALE:
+    case GL_DEPTH_TEST:
+    case GL_DEPTH_WRITEMASK:
+    case GL_DITHER:
+    case GL_DOUBLEBUFFER:
+    case GL_DRAW_BUFFER:
+    case GL_EDGE_FLAG:
+    case GL_EDGE_FLAG_ARRAY:
+    case GL_EDGE_FLAG_ARRAY_STRIDE:
+    case GL_FOG:
+    case GL_FOG_DENSITY:
+    case GL_FOG_END:
+    case GL_FOG_HINT:
+    case GL_FOG_INDEX:
+    case GL_FOG_MODE:
+    case GL_FOG_START:
+    case GL_FRONT_FACE:
+    case GL_GREEN_BIAS:
+    case GL_GREEN_BITS:
+    case GL_GREEN_SCALE:
+    case GL_INDEX_ARRAY:
+    case GL_INDEX_ARRAY_STRIDE:
+    case GL_INDEX_ARRAY_TYPE:
+    case GL_INDEX_BITS:
+    case GL_INDEX_CLEAR_VALUE:
+    case GL_INDEX_LOGIC_OP:
+    case GL_INDEX_MODE:
+    case GL_INDEX_OFFSET:
+    case GL_INDEX_SHIFT:
+    case GL_INDEX_WRITEMASK:
+//    case GL_LIGHTi:
+    case GL_LIGHTING:
+    case GL_LIGHT_MODEL_LOCAL_VIEWER:
+    case GL_LIGHT_MODEL_TWO_SIDE:
+    case GL_LINE_SMOOTH:
+    case GL_LINE_SMOOTH_HINT:
+    case GL_LINE_STIPPLE:
+    case GL_LINE_STIPPLE_PATTERN:
+    case GL_LINE_STIPPLE_REPEAT:
+    case GL_LINE_WIDTH:
+    case GL_LINE_WIDTH_GRANULARITY  :
+    case GL_LIST_BASE:
+    case GL_LIST_INDEX:
+    case GL_LIST_MODE:
+    case GL_LOGIC_OP_MODE:
+    case GL_MAP1_COLOR_4:
+    case GL_MAP1_GRID_SEGMENTS:
+    case GL_MAP1_INDEX:
+    case GL_MAP1_NORMAL:
+    case GL_MAP1_TEXTURE_COORD_1:
+    case GL_MAP1_TEXTURE_COORD_2:
+    case GL_MAP1_TEXTURE_COORD_3:
+    case GL_MAP1_TEXTURE_COORD_4:
+    case GL_MAP1_VERTEX_3:
+    case GL_MAP1_VERTEX_4:
+    case GL_MAP2_COLOR_4:
+    case GL_MAP2_INDEX:
+    case GL_MAP2_NORMAL:
+    case GL_MAP2_TEXTURE_COORD_1:
+    case GL_MAP2_TEXTURE_COORD_2:
+    case GL_MAP2_TEXTURE_COORD_3:
+    case GL_MAP2_TEXTURE_COORD_4:
+    case GL_MAP2_VERTEX_3:
+    case GL_MAP2_VERTEX_4:
+    case GL_MAP_COLOR:
+    case GL_MAP_STENCIL:
+    case GL_MATRIX_MODE:
+    case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
+    case GL_MAX_ATTRIB_STACK_DEPTH:
+    case GL_MAX_CLIP_PLANES:
+    case GL_MAX_EVAL_ORDER:
+    case GL_MAX_LIGHTS:
+    case GL_MAX_LIST_NESTING:
+    case GL_MAX_MODELVIEW_STACK_DEPTH:
+    case GL_MAX_NAME_STACK_DEPTH:
+    case GL_MAX_PIXEL_MAP_TABLE:
+    case GL_MAX_PROJECTION_STACK_DEPTH:
+    case GL_MAX_TEXTURE_SIZE:
+    case GL_MAX_TEXTURE_STACK_DEPTH :
+    case GL_MODELVIEW_STACK_DEPTH:
+    case GL_NAME_STACK_DEPTH:
+    case GL_NORMAL_ARRAY:
+    case GL_NORMAL_ARRAY_STRIDE:
+    case GL_NORMAL_ARRAY_TYPE:
+    case GL_NORMALIZE:
+    case GL_PACK_ALIGNMENT:
+    case GL_PACK_LSB_FIRST:
+    case GL_PACK_ROW_LENGTH:
+    case GL_PACK_SKIP_PIXELS:
+    case GL_PACK_SKIP_ROWS:
+    case GL_PACK_SWAP_BYTES:
+    case GL_PERSPECTIVE_CORRECTION_HINT:
+    case GL_PIXEL_MAP_A_TO_A_SIZE:
+    case GL_PIXEL_MAP_B_TO_B_SIZE:
+    case GL_PIXEL_MAP_G_TO_G_SIZE:
+    case GL_PIXEL_MAP_I_TO_A_SIZE:
+    case GL_PIXEL_MAP_I_TO_B_SIZE:
+    case GL_PIXEL_MAP_I_TO_G_SIZE:
+    case GL_PIXEL_MAP_I_TO_I_SIZE:
+    case GL_PIXEL_MAP_I_TO_R_SIZE:
+    case GL_PIXEL_MAP_R_TO_R_SIZE:
+    case GL_PIXEL_MAP_S_TO_S_SIZE:
+    case GL_POINT_SIZE:
+    case GL_POINT_SIZE_GRANULARITY	  :
+    case GL_POINT_SMOOTH:
+    case GL_POINT_SMOOTH_HINT	  :
+    case GL_POLYGON_OFFSET_FACTOR:
+    case GL_POLYGON_OFFSET_UNITS :
+    case GL_POLYGON_OFFSET_FILL:
+    case GL_POLYGON_OFFSET_LINE:
+    case GL_POLYGON_OFFSET_POINT:
+    case GL_POLYGON_SMOOTH:
+    case GL_POLYGON_SMOOTH_HINT:
+    case GL_POLYGON_STIPPLE:
+    case GL_PROJECTION_STACK_DEPTH:
+    case GL_READ_BUFFER:
+    case GL_RED_BIAS:
+    case GL_RED_BITS:
+    case GL_RED_SCALE:
+    case GL_RENDER_MODE:
+    case GL_RGBA_MODE:
+    case GL_SCISSOR_TEST:
+    case GL_SHADE_MODEL:
+    case GL_STENCIL_BITS:
+    case GL_STENCIL_CLEAR_VALUE:
+    case GL_STENCIL_FAIL:
+    case GL_STENCIL_FUNC:
+    case GL_STENCIL_PASS_DEPTH_FAIL:
+    case GL_STENCIL_PASS_DEPTH_PASS:
+    case GL_STENCIL_REF:
+    case GL_STENCIL_TEST:
+    case GL_STENCIL_VALUE_MASK:
+    case GL_STENCIL_WRITEMASK:
+    case GL_STEREO:
+    case GL_SUBPIXEL_BITS:
+    case GL_TEXTURE_1D:
+//    case GL_TEXTURE_1D_BINDING:
+    case GL_TEXTURE_2D	:
+//    case GL_TEXTURE_2D_BINDING:
+    case GL_TEXTURE_COORD_ARRAY:
+    case GL_TEXTURE_COORD_ARRAY_SIZE:
+    case GL_TEXTURE_COORD_ARRAY_STRIDE:
+    case GL_TEXTURE_COORD_ARRAY_TYPE:
+    case GL_TEXTURE_GEN_Q:
+    case GL_TEXTURE_GEN_R:
+    case GL_TEXTURE_GEN_S:
+    case GL_TEXTURE_GEN_T:
+    case GL_TEXTURE_STACK_DEPTH:
+    case GL_UNPACK_ALIGNMENT:
+    case GL_UNPACK_LSB_FIRST:
+    case GL_UNPACK_ROW_LENGTH:
+    case GL_UNPACK_SKIP_PIXELS:
+    case GL_UNPACK_SKIP_ROWS:
+    case GL_UNPACK_SWAP_BYTES:
+    case GL_VERTEX_ARRAY:
+    case GL_VERTEX_ARRAY_SIZE:
+    case GL_VERTEX_ARRAY_STRIDE:
+    case GL_VERTEX_ARRAY_TYPE:
+    case GL_ZOOM_X:
+    case GL_ZOOM_Y:
+        return 1;
+
+    case GL_ACCUM_CLEAR_VALUE:
+//    case GL_BLEND_COLOR_EXT:
+    case GL_COLOR_CLEAR_VALUE:
+    case GL_COLOR_WRITEMASK:
+    case GL_CURRENT_COLOR:
+    case GL_CURRENT_RASTER_COLOR:
+    case GL_CURRENT_RASTER_POSITION:
+    case GL_CURRENT_RASTER_TEXTURE_COORDS:
+    case GL_CURRENT_TEXTURE_COORDS:
+    case GL_FOG_COLOR:
+    case GL_LIGHT_MODEL_AMBIENT:
+    case GL_MAP2_GRID_DOMAIN:
+    case GL_VIEWPORT:
+    case GL_SCISSOR_BOX:
+        return 4;
+
+    case GL_DEPTH_RANGE:
+    case GL_LINE_WIDTH_RANGE:
+    case GL_MAP1_GRID_DOMAIN:
+    case GL_MAP2_GRID_SEGMENTS:
+    case GL_MAX_VIEWPORT_DIMS:
+    case GL_POINT_SIZE_RANGE:
+    case GL_POLYGON_MODE:
+        return 2;
+
+    case GL_CURRENT_NORMAL:
+        return 3;
+
+    case GL_MODELVIEW_MATRIX:
+    case GL_PROJECTION_MATRIX:
+    case GL_TEXTURE_MATRIX:
+        return 16;
+
+    default:
+        return 0;
+    }
+}
+
+void APIENTRY glGetBooleanv (GLenum pname, GLboolean *params)
+{
+    uint32_t n = vboxglGetNrElements(pname);
+
+    if (!n)
+    {
+        AssertMsgFailed(("glGetBooleanv: Invalid enum %x\n", pname));
+        glSetError(GL_INVALID_ENUM);
+        return;
+    }
+
+    VBOX_OGL_GEN_SYNC_OP2_PASS_PTR(GetBooleanv, pname, n*sizeof(GLboolean), params);
+    return;
+}
+
+void APIENTRY glGetDoublev (GLenum pname, GLdouble *params)
+{
+    uint32_t n = vboxglGetNrElements(pname);
+
+    if (!n)
+    {
+        AssertMsgFailed(("glGetDoublev: Invalid enum %x\n", pname));
+        glSetError(GL_INVALID_ENUM);
+        return;
+    }
+
+    VBOX_OGL_GEN_SYNC_OP2_PASS_PTR(GetDoublev, pname, n*sizeof(GLdouble), params);
+    return;
+}
+
+void APIENTRY glGetFloatv (GLenum pname, GLfloat *params)
+{
+    uint32_t n = vboxglGetNrElements(pname);
+
+    if (!n)
+    {
+        AssertMsgFailed(("glGetFloatv: Invalid enum %x\n", pname));
+        glSetError(GL_INVALID_ENUM);
+        return;
+    }
+
+    VBOX_OGL_GEN_SYNC_OP2_PASS_PTR(GetFloatv, pname, n*sizeof(GLfloat), params);
+    return;
+}
+
+void APIENTRY glGetIntegerv (GLenum pname, GLint *params)
+{
+    uint32_t n = vboxglGetNrElements(pname);
+
+    if (!n)
+    {
+        AssertMsgFailed(("glGetIntegerv: Invalid enum %x\n", pname));
+        glSetError(GL_INVALID_ENUM);
+        return;
+    }
+
+    VBOX_OGL_GEN_SYNC_OP2_PASS_PTR(GetIntegerv, pname, n*sizeof(GLint), params);
+    return;
+}
+
+
+void APIENTRY glGetMapdv (GLenum target, GLenum query, GLdouble *v)
+{
+    AssertFailed(); /** @todo */
+    return;
+}
+
+void APIENTRY glGetMapfv (GLenum target, GLenum query, GLfloat *v)
+{
+    AssertFailed(); /** @todo */
+    return;
+}
+
+void APIENTRY glGetMapiv (GLenum target, GLenum query, GLint *v)
+{
+    AssertFailed(); /** @todo */
+    return;
+}
+
+void APIENTRY glGetPointerv (GLenum pname, GLvoid* *params)
+{
+    AssertFailed(); /** @todo */
+    return;
+}
+
+
Index: /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/VBoxCmd.cpp
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/VBoxCmd.cpp	(revision 3339)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/VBoxCmd.cpp	(revision 3339)
@@ -0,0 +1,144 @@
+/** @file
+ *
+ * VBoxDisp -- Windows Guest OpenGL ICD
+ *
+ * Copyright (C) 2006-2007 innotek GmbH
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation,
+ * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+ * distribution. VirtualBox OSE is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * If you received this file as part of a commercial VirtualBox
+ * distribution, then only the terms of your commercial VirtualBox
+ * license agreement apply instead of the previous paragraph.
+ *
+ */
+#define VBOX_OGL_WITH_CMD_STRINGS
+#include "VBoxOGL.h"
+#include <VBox/version.h>
+#include <stdarg.h>
+#include <stdio.h>
+
+
+/**
+ * Queue a new OpenGL command
+ *
+ * @param   enmOp       OpenGL command op
+ * @param   cParams     Number of parameters
+ * @param   cbParams    Memory needed for parameters
+ */
+void VBoxCmdStart(uint32_t enmOp, uint32_t cParams, uint32_t cbParams)
+{
+    PVBOX_OGL_THREAD_CTX pCtx = VBoxOGLGetThreadCtx();
+    PVBOX_OGL_CMD        pCmd = (PVBOX_OGL_CMD)pCtx->pCurrentCmd;
+
+    DbgPrintf(("Start %s cParams=%d cbParams=%d\n", pszVBoxOGLCmd[enmOp], cParams, cbParams));
+
+    if (pCtx->pCurrentCmd + cParams*VBOX_OGL_CMD_ALIGN + cbParams + sizeof(VBOX_OGL_CMD) >= pCtx->pCmdBufferEnd)
+    {
+        DbgPrintf(("VBoxCmdStart -> cmd queue full -> flush!\n"));
+        VBoxOGLFlush();
+        pCmd = (PVBOX_OGL_CMD)pCtx->pCurrentCmd;
+    }
+    Assert(pCtx->pCurrentCmd + cbParams + sizeof(VBOX_OGL_CMD) < pCtx->pCmdBufferEnd);
+
+#ifdef VBOX_OGL_CMD_STRICT
+    pCmd->Magic       = VBOX_OGL_CMD_MAGIC;
+#endif
+    pCmd->enmOp       = enmOp;
+    pCmd->cbCmd       = sizeof(VBOX_OGL_CMD);
+    pCmd->cParams     = cParams;
+    return;
+}
+
+/**
+ * Add a parameter (fixed size) to the currently queued OpenGL command
+ *
+ * @param   pParam      Parameter ptr
+ * @param   cbParam     Parameter value size
+ */
+void VBoxCmdSaveParameter(uint8_t *pParam, uint32_t cbParam)
+{
+    PVBOX_OGL_THREAD_CTX pCtx = VBoxOGLGetThreadCtx();
+    PVBOX_OGL_CMD        pCmd = (PVBOX_OGL_CMD)pCtx->pCurrentCmd;
+    uint8_t             *pCurrentCmdBlock = (uint8_t *)pCmd + pCmd->cbCmd;
+
+    Assert(pCurrentCmdBlock + cbParam < pCtx->pCmdBufferEnd);
+
+#ifdef DEBUG
+    switch(cbParam)
+    {
+    case 1:
+        DbgPrintf(("Param %s val=%x cbParam=%d\n", pszVBoxOGLCmd[pCmd->enmOp], *(uint8_t *)pParam, cbParam));
+        break;
+    case 2:
+        DbgPrintf(("Param %s val=%x cbParam=%d\n", pszVBoxOGLCmd[pCmd->enmOp], *(uint16_t *)pParam, cbParam));
+        break;
+    case 4:
+    default:
+        DbgPrintf(("Param %s val=%x cbParam=%d\n", pszVBoxOGLCmd[pCmd->enmOp], *(uint32_t *)pParam, cbParam));
+        break;
+    }
+#endif
+
+    memcpy(pCurrentCmdBlock, pParam, cbParam);
+    pCmd->cbCmd += cbParam;
+    pCmd->cbCmd  = RT_ALIGN(pCmd->cbCmd, VBOX_OGL_CMD_ALIGN);
+}
+
+/**
+ * Add a parameter (variable size) to the currently queued OpenGL command
+ *
+ * @param   pParam      Parameter ptr
+ * @param   cbParam     Parameter value size
+ */
+void VBoxCmdSaveMemParameter(uint8_t *pParam, uint32_t cbParam)
+{
+    PVBOX_OGL_THREAD_CTX pCtx = VBoxOGLGetThreadCtx();
+    PVBOX_OGL_CMD        pCmd = (PVBOX_OGL_CMD)pCtx->pCurrentCmd;
+    uint8_t             *pCurrentCmdBlock = (uint8_t *)pCmd + pCmd->cbCmd;
+    PVBOX_OGL_VAR_PARAM  pCurrentParam = (PVBOX_OGL_VAR_PARAM)pCurrentCmdBlock;
+
+    Assert(pCurrentCmdBlock + cbParam < pCtx->pCmdBufferEnd);
+
+    DbgPrintf(("Mem Param %s cbParam=%d\n", pszVBoxOGLCmd[pCmd->enmOp], cbParam));
+
+#ifdef VBOX_OGL_CMD_STRICT
+    pCurrentParam->Magic   = VBOX_OGL_CMD_MAGIC;
+#endif
+
+    if (pParam && cbParam)
+    {
+        pCurrentParam->cbParam = cbParam;
+        memcpy(pCurrentParam+1, pParam, cbParam);
+    }
+    else
+    {
+        pCurrentParam->cbParam = 0;
+        cbParam = 0;
+    }
+    pCmd->cbCmd += sizeof(*pCurrentParam) + cbParam;
+    pCmd->cbCmd  = RT_ALIGN(pCmd->cbCmd, VBOX_OGL_CMD_ALIGN);
+}
+
+/**
+ * Finish the queued command
+ *
+ * @param   enmOp       OpenGL command op
+ */
+void VBoxCmdStop(uint32_t enmOp)
+{
+    PVBOX_OGL_THREAD_CTX pCtx = VBoxOGLGetThreadCtx();
+    PVBOX_OGL_CMD        pCmd = (PVBOX_OGL_CMD)pCtx->pCurrentCmd;
+    uint8_t             *pCurrentCmdBlock = (uint8_t *)pCmd + pCmd->cbCmd;
+
+    DbgPrintf(("End %s cbCmd=%d\n", pszVBoxOGLCmd[pCmd->enmOp], pCmd->cbCmd));
+
+    pCtx->pCurrentCmd = pCurrentCmdBlock;
+    pCtx->cCommands++;
+}
+
Index: /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/VBoxICDList.h
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/VBoxICDList.h	(revision 3339)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/VBoxICDList.h	(revision 3339)
@@ -0,0 +1,388 @@
+/** @file
+ *
+ * VirtualBox Windows NT/2000/XP guest OpenGL ICD
+ *
+ * Copyright (C) 2006-2007 innotek GmbH
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation,
+ * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+ * distribution. VirtualBox OSE is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * If you received this file as part of a commercial VirtualBox
+ * distribution, then only the terms of your commercial VirtualBox
+ * license agreement apply instead of the previous paragraph.
+ *
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version:  6.1
+ *
+ * Copyright (C) 1999-2004  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * File name: icd.c
+ * Author:    Gregor Anich
+ *
+ * ICD (Installable Client Driver) interface.
+ * Based on the windows GDI/WGL driver.
+ */
+
+ICD_ENTRY(NewList)				/* 0 */
+ICD_ENTRY(EndList)				/* 1 */
+ICD_ENTRY(CallList)				/* 2 */
+ICD_ENTRY(CallLists)				/* 3 */
+ICD_ENTRY(DeleteLists)			/* 4 */
+ICD_ENTRY(GenLists)				/* 5 */
+ICD_ENTRY(ListBase)				/* 6 */
+ICD_ENTRY(Begin)					/* 7 */
+ICD_ENTRY(Bitmap)					/* 8 */
+ICD_ENTRY(Color3b)				/* 9 */
+ICD_ENTRY(Color3bv)				/* 10 */
+ICD_ENTRY(Color3d)				/* 11 */
+ICD_ENTRY(Color3dv)				/* 12 */
+ICD_ENTRY(Color3f)				/* 13 */
+ICD_ENTRY(Color3fv)				/* 14 */
+ICD_ENTRY(Color3i)				/* 15 */
+ICD_ENTRY(Color3iv)				/* 16 */
+ICD_ENTRY(Color3s)				/* 17 */
+ICD_ENTRY(Color3sv)				/* 18 */
+ICD_ENTRY(Color3ub)				/* 19 */
+ICD_ENTRY(Color3ubv)				/* 20 */
+ICD_ENTRY(Color3ui)				/* 21 */
+ICD_ENTRY(Color3uiv)				/* 22 */
+ICD_ENTRY(Color3us)				/* 23 */
+ICD_ENTRY(Color3usv)				/* 24 */
+ICD_ENTRY(Color4b)				/* 25 */
+ICD_ENTRY(Color4bv)				/* 26 */
+ICD_ENTRY(Color4d)				/* 27 */
+ICD_ENTRY(Color4dv)				/* 28 */
+ICD_ENTRY(Color4f)				/* 29 */
+ICD_ENTRY(Color4fv)				/* 30 */
+ICD_ENTRY(Color4i)				/* 31 */
+ICD_ENTRY(Color4iv)				/* 32 */
+ICD_ENTRY(Color4s)				/* 33 */
+ICD_ENTRY(Color4sv)				/* 34 */
+ICD_ENTRY(Color4ub)				/* 35 */
+ICD_ENTRY(Color4ubv)				/* 36 */
+ICD_ENTRY(Color4ui)				/* 37 */
+ICD_ENTRY(Color4uiv)				/* 38 */
+ICD_ENTRY(Color4us)				/* 39 */
+ICD_ENTRY(Color4usv)				/* 40 */
+ICD_ENTRY(EdgeFlag)				/* 41 */
+ICD_ENTRY(EdgeFlagv)				/* 42 */
+ICD_ENTRY(End)					/* 43 */
+ICD_ENTRY(Indexd)					/* 44 */
+ICD_ENTRY(Indexdv)				/* 45 */
+ICD_ENTRY(Indexf)					/* 46 */
+ICD_ENTRY(Indexfv)				/* 47 */
+ICD_ENTRY(Indexi)					/* 48 */
+ICD_ENTRY(Indexiv)				/* 49 */
+ICD_ENTRY(Indexs)					/* 50 */
+ICD_ENTRY(Indexsv)				/* 51 */
+ICD_ENTRY(Normal3b)				/* 52 */
+ICD_ENTRY(Normal3bv)				/* 53 */
+ICD_ENTRY(Normal3d)				/* 54 */
+ICD_ENTRY(Normal3dv)				/* 55 */
+ICD_ENTRY(Normal3f)				/* 56 */
+ICD_ENTRY(Normal3fv)				/* 57 */
+ICD_ENTRY(Normal3i)				/* 58 */
+ICD_ENTRY(Normal3iv)				/* 59 */
+ICD_ENTRY(Normal3s)				/* 60 */
+ICD_ENTRY(Normal3sv)				/* 61 */
+ICD_ENTRY(RasterPos2d)			/* 62 */
+ICD_ENTRY(RasterPos2dv)			/* 63 */
+ICD_ENTRY(RasterPos2f)			/* 64 */
+ICD_ENTRY(RasterPos2fv)			/* 65 */
+ICD_ENTRY(RasterPos2i)			/* 66 */
+ICD_ENTRY(RasterPos2iv)			/* 67 */
+ICD_ENTRY(RasterPos2s)			/* 68 */
+ICD_ENTRY(RasterPos2sv)			/* 69 */
+ICD_ENTRY(RasterPos3d)			/* 70 */
+ICD_ENTRY(RasterPos3dv)			/* 71 */
+ICD_ENTRY(RasterPos3f)			/* 72 */
+ICD_ENTRY(RasterPos3fv)			/* 73 */
+ICD_ENTRY(RasterPos3i)			/* 74 */
+ICD_ENTRY(RasterPos3iv)			/* 75 */
+ICD_ENTRY(RasterPos3s)			/* 76 */
+ICD_ENTRY(RasterPos3sv)			/* 77 */
+ICD_ENTRY(RasterPos4d)			/* 78 */
+ICD_ENTRY(RasterPos4dv)			/* 79 */
+ICD_ENTRY(RasterPos4f)			/* 80 */
+ICD_ENTRY(RasterPos4fv)			/* 81 */
+ICD_ENTRY(RasterPos4i)			/* 82 */
+ICD_ENTRY(RasterPos4iv)			/* 83 */
+ICD_ENTRY(RasterPos4s)			/* 84 */
+ICD_ENTRY(RasterPos4sv)			/* 85 */
+ICD_ENTRY(Rectd)					/* 86 */
+ICD_ENTRY(Rectdv)					/* 87 */
+ICD_ENTRY(Rectf)					/* 88 */
+ICD_ENTRY(Rectfv)					/* 89 */
+ICD_ENTRY(Recti)					/* 90 */
+ICD_ENTRY(Rectiv)					/* 91 */
+ICD_ENTRY(Rects)					/* 92 */
+ICD_ENTRY(Rectsv)					/* 93 */
+ICD_ENTRY(TexCoord1d)				/* 94 */
+ICD_ENTRY(TexCoord1dv)			/* 95 */
+ICD_ENTRY(TexCoord1f)				/* 96 */
+ICD_ENTRY(TexCoord1fv)			/* 97 */
+ICD_ENTRY(TexCoord1i)				/* 98 */
+ICD_ENTRY(TexCoord1iv)			/* 99 */
+ICD_ENTRY(TexCoord1s)				/* 100 */
+ICD_ENTRY(TexCoord1sv)			/* 101 */
+ICD_ENTRY(TexCoord2d)				/* 102 */
+ICD_ENTRY(TexCoord2dv)			/* 103 */
+ICD_ENTRY(TexCoord2f)				/* 104 */
+ICD_ENTRY(TexCoord2fv)			/* 105 */
+ICD_ENTRY(TexCoord2i)				/* 106 */
+ICD_ENTRY(TexCoord2iv)			/* 107 */
+ICD_ENTRY(TexCoord2s)				/* 108 */
+ICD_ENTRY(TexCoord2sv)			/* 109 */
+ICD_ENTRY(TexCoord3d)				/* 110 */
+ICD_ENTRY(TexCoord3dv)			/* 111 */
+ICD_ENTRY(TexCoord3f)				/* 112 */
+ICD_ENTRY(TexCoord3fv)			/* 113 */
+ICD_ENTRY(TexCoord3i)				/* 114 */
+ICD_ENTRY(TexCoord3iv)			/* 115 */
+ICD_ENTRY(TexCoord3s)				/* 116 */
+ICD_ENTRY(TexCoord3sv)			/* 117 */
+ICD_ENTRY(TexCoord4d)				/* 118 */
+ICD_ENTRY(TexCoord4dv)			/* 119 */
+ICD_ENTRY(TexCoord4f)				/* 120 */
+ICD_ENTRY(TexCoord4fv)			/* 121 */
+ICD_ENTRY(TexCoord4i)				/* 122 */
+ICD_ENTRY(TexCoord4iv)			/* 123 */
+ICD_ENTRY(TexCoord4s)				/* 124 */
+ICD_ENTRY(TexCoord4sv)			/* 125 */
+ICD_ENTRY(Vertex2d)				/* 126 */
+ICD_ENTRY(Vertex2dv)				/* 127 */
+ICD_ENTRY(Vertex2f)				/* 128 */
+ICD_ENTRY(Vertex2fv)				/* 129 */
+ICD_ENTRY(Vertex2i)				/* 130 */
+ICD_ENTRY(Vertex2iv)				/* 131 */
+ICD_ENTRY(Vertex2s)				/* 132 */
+ICD_ENTRY(Vertex2sv)				/* 133 */
+ICD_ENTRY(Vertex3d)				/* 134 */
+ICD_ENTRY(Vertex3dv)				/* 135 */
+ICD_ENTRY(Vertex3f)				/* 136 */
+ICD_ENTRY(Vertex3fv)				/* 137 */
+ICD_ENTRY(Vertex3i)				/* 138 */
+ICD_ENTRY(Vertex3iv)				/* 139 */
+ICD_ENTRY(Vertex3s)				/* 140 */
+ICD_ENTRY(Vertex3sv)				/* 141 */
+ICD_ENTRY(Vertex4d)				/* 142 */
+ICD_ENTRY(Vertex4dv)				/* 143 */
+ICD_ENTRY(Vertex4f)				/* 144 */
+ICD_ENTRY(Vertex4fv)				/* 145 */
+ICD_ENTRY(Vertex4i)				/* 146 */
+ICD_ENTRY(Vertex4iv)				/* 147 */
+ICD_ENTRY(Vertex4s)				/* 148 */
+ICD_ENTRY(Vertex4sv)				/* 149 */
+ICD_ENTRY(ClipPlane)				/* 150 */
+ICD_ENTRY(ColorMaterial)			/* 151 */
+ICD_ENTRY(CullFace)				/* 152 */
+ICD_ENTRY(Fogf)					/* 153 */
+ICD_ENTRY(Fogfv)					/* 154 */
+ICD_ENTRY(Fogi)					/* 155 */
+ICD_ENTRY(Fogiv)					/* 156 */
+ICD_ENTRY(FrontFace)				/* 157 */
+ICD_ENTRY(Hint)					/* 158 */
+ICD_ENTRY(Lightf)					/* 159 */
+ICD_ENTRY(Lightfv)				/* 160 */
+ICD_ENTRY(Lighti)					/* 161 */
+ICD_ENTRY(Lightiv)				/* 162 */
+ICD_ENTRY(LightModelf)			/* 163 */
+ICD_ENTRY(LightModelfv)			/* 164 */
+ICD_ENTRY(LightModeli)			/* 165 */
+ICD_ENTRY(LightModeliv)			/* 166 */
+ICD_ENTRY(LineStipple)			/* 167 */
+ICD_ENTRY(LineWidth)				/* 168 */
+ICD_ENTRY(Materialf)				/* 169 */
+ICD_ENTRY(Materialfv)				/* 170 */
+ICD_ENTRY(Materiali)				/* 171 */
+ICD_ENTRY(Materialiv)				/* 172 */
+ICD_ENTRY(PointSize)				/* 173 */
+ICD_ENTRY(PolygonMode)			/* 174 */
+ICD_ENTRY(PolygonStipple)			/* 175 */
+ICD_ENTRY(Scissor)				/* 176 */
+ICD_ENTRY(ShadeModel)				/* 177 */
+ICD_ENTRY(TexParameterf)			/* 178 */
+ICD_ENTRY(TexParameterfv)			/* 179 */
+ICD_ENTRY(TexParameteri)			/* 180 */
+ICD_ENTRY(TexParameteriv)			/* 181 */
+ICD_ENTRY(TexImage1D)				/* 182 */
+ICD_ENTRY(TexImage2D)				/* 183 */
+ICD_ENTRY(TexEnvf)				/* 184 */
+ICD_ENTRY(TexEnvfv)				/* 185 */
+ICD_ENTRY(TexEnvi)				/* 186 */
+ICD_ENTRY(TexEnviv)				/* 187 */
+ICD_ENTRY(TexGend)				/* 188 */
+ICD_ENTRY(TexGendv)				/* 189 */
+ICD_ENTRY(TexGenf)				/* 190 */
+ICD_ENTRY(TexGenfv)				/* 191 */
+ICD_ENTRY(TexGeni)				/* 192 */
+ICD_ENTRY(TexGeniv)				/* 193 */
+ICD_ENTRY(FeedbackBuffer)			/* 194 */
+ICD_ENTRY(SelectBuffer)			/* 195 */
+ICD_ENTRY(RenderMode)				/* 196 */
+ICD_ENTRY(InitNames)				/* 197 */
+ICD_ENTRY(LoadName)				/* 198 */
+ICD_ENTRY(PassThrough)			/* 199 */
+ICD_ENTRY(PopName)				/* 200 */
+ICD_ENTRY(PushName)				/* 201 */
+ICD_ENTRY(DrawBuffer)				/* 202 */
+ICD_ENTRY(Clear)					/* 203 */
+ICD_ENTRY(ClearAccum)				/* 204 */
+ICD_ENTRY(ClearIndex)				/* 205 */
+ICD_ENTRY(ClearColor)				/* 206 */
+ICD_ENTRY(ClearStencil)			/* 207 */
+ICD_ENTRY(ClearDepth)				/* 208 */
+ICD_ENTRY(StencilMask)			/* 209 */
+ICD_ENTRY(ColorMask)				/* 210 */
+ICD_ENTRY(DepthMask)				/* 211 */
+ICD_ENTRY(IndexMask)				/* 212 */
+ICD_ENTRY(Accum)					/* 213 */
+ICD_ENTRY(Disable)				/* 214 */
+ICD_ENTRY(Enable)					/* 215 */
+ICD_ENTRY(Finish)					/* 216 */
+ICD_ENTRY(Flush)					/* 217 */
+ICD_ENTRY(PopAttrib)				/* 218 */
+ICD_ENTRY(PushAttrib)				/* 219 */
+ICD_ENTRY(Map1d)					/* 220 */
+ICD_ENTRY(Map1f)					/* 221 */
+ICD_ENTRY(Map2d)					/* 222 */
+ICD_ENTRY(Map2f)					/* 223 */
+ICD_ENTRY(MapGrid1d)				/* 224 */
+ICD_ENTRY(MapGrid1f)				/* 225 */
+ICD_ENTRY(MapGrid2d)				/* 226 */
+ICD_ENTRY(MapGrid2f)				/* 227 */
+ICD_ENTRY(EvalCoord1d)			/* 228 */
+ICD_ENTRY(EvalCoord1dv)			/* 229 */
+ICD_ENTRY(EvalCoord1f)			/* 230 */
+ICD_ENTRY(EvalCoord1fv)			/* 231 */
+ICD_ENTRY(EvalCoord2d)			/* 232 */
+ICD_ENTRY(EvalCoord2dv)			/* 233 */
+ICD_ENTRY(EvalCoord2f)			/* 234 */
+ICD_ENTRY(EvalCoord2fv)			/* 235 */
+ICD_ENTRY(EvalMesh1)				/* 236 */
+ICD_ENTRY(EvalPoint1)				/* 237 */
+ICD_ENTRY(EvalMesh2)				/* 238 */
+ICD_ENTRY(EvalPoint2)				/* 239 */
+ICD_ENTRY(AlphaFunc)				/* 240 */
+ICD_ENTRY(BlendFunc)				/* 241 */
+ICD_ENTRY(LogicOp)				/* 242 */
+ICD_ENTRY(StencilFunc)			/* 243 */
+ICD_ENTRY(StencilOp)				/* 244 */
+ICD_ENTRY(DepthFunc)				/* 245 */
+ICD_ENTRY(PixelZoom)				/* 246 */
+ICD_ENTRY(PixelTransferf)			/* 247 */
+ICD_ENTRY(PixelTransferi)			/* 248 */
+ICD_ENTRY(PixelStoref)			/* 249 */
+ICD_ENTRY(PixelStorei)			/* 250 */
+ICD_ENTRY(PixelMapfv)				/* 251 */
+ICD_ENTRY(PixelMapuiv)			/* 252 */
+ICD_ENTRY(PixelMapusv)			/* 253 */
+ICD_ENTRY(ReadBuffer)				/* 254 */
+ICD_ENTRY(CopyPixels)				/* 255 */
+ICD_ENTRY(ReadPixels)				/* 256 */
+ICD_ENTRY(DrawPixels)				/* 257 */
+ICD_ENTRY(GetBooleanv)			/* 258 */
+ICD_ENTRY(GetClipPlane)			/* 259 */
+ICD_ENTRY(GetDoublev)				/* 260 */
+ICD_ENTRY(GetError)				/* 261 */
+ICD_ENTRY(GetFloatv)				/* 262 */
+ICD_ENTRY(GetIntegerv)			/* 263 */
+ICD_ENTRY(GetLightfv)				/* 264 */
+ICD_ENTRY(GetLightiv)				/* 265 */
+ICD_ENTRY(GetMapdv)				/* 266 */
+ICD_ENTRY(GetMapfv)				/* 267 */
+ICD_ENTRY(GetMapiv)				/* 268 */
+ICD_ENTRY(GetMaterialfv)			/* 269 */
+ICD_ENTRY(GetMaterialiv)			/* 270 */
+ICD_ENTRY(GetPixelMapfv)			/* 271 */
+ICD_ENTRY(GetPixelMapuiv)			/* 272 */
+ICD_ENTRY(GetPixelMapusv)			/* 273 */
+ICD_ENTRY(GetPolygonStipple)		/* 274 */
+ICD_ENTRY(GetString)				/* 275 */
+ICD_ENTRY(GetTexEnvfv)			/* 276 */
+ICD_ENTRY(GetTexEnviv)			/* 277 */
+ICD_ENTRY(GetTexGendv)			/* 278 */
+ICD_ENTRY(GetTexGenfv)			/* 279 */
+ICD_ENTRY(GetTexGeniv)			/* 280 */
+ICD_ENTRY(GetTexImage)			/* 281 */
+ICD_ENTRY(GetTexParameterfv)		/* 282 */
+ICD_ENTRY(GetTexParameteriv)		/* 283 */
+ICD_ENTRY(GetTexLevelParameterfv)	/* 284 */
+ICD_ENTRY(GetTexLevelParameteriv)	/* 285 */
+ICD_ENTRY(IsEnabled)				/* 286 */
+ICD_ENTRY(IsList)					/* 287 */
+ICD_ENTRY(DepthRange)				/* 288 */
+ICD_ENTRY(Frustum)				/* 289 */
+ICD_ENTRY(LoadIdentity)			/* 290 */
+ICD_ENTRY(LoadMatrixf)			/* 291 */
+ICD_ENTRY(LoadMatrixd)			/* 292 */
+ICD_ENTRY(MatrixMode)				/* 293 */
+ICD_ENTRY(MultMatrixf)			/* 294 */
+ICD_ENTRY(MultMatrixd)			/* 295 */
+ICD_ENTRY(Ortho)					/* 296 */
+ICD_ENTRY(PopMatrix)				/* 297 */
+ICD_ENTRY(PushMatrix)				/* 298 */
+ICD_ENTRY(Rotated)				/* 299 */
+ICD_ENTRY(Rotatef)				/* 300 */
+ICD_ENTRY(Scaled)					/* 301 */
+ICD_ENTRY(Scalef)					/* 302 */
+ICD_ENTRY(Translated)				/* 303 */
+ICD_ENTRY(Translatef)				/* 304 */
+ICD_ENTRY(Viewport)				/* 305 */
+ICD_ENTRY(ArrayElement)			/* 306 */
+ICD_ENTRY(BindTexture)			/* 307 */
+ICD_ENTRY(ColorPointer)			/* 308 */
+ICD_ENTRY(DisableClientState)		/* 309 */
+ICD_ENTRY(DrawArrays)				/* 310 */
+ICD_ENTRY(DrawElements)			/* 311 */
+ICD_ENTRY(EdgeFlagPointer)		/* 312 */
+ICD_ENTRY(EnableClientState)		/* 313 */
+ICD_ENTRY(IndexPointer)			/* 314 */
+ICD_ENTRY(Indexub)				/* 315 */
+ICD_ENTRY(Indexubv)				/* 316 */
+ICD_ENTRY(InterleavedArrays)		/* 317 */
+ICD_ENTRY(NormalPointer)			/* 318 */
+ICD_ENTRY(PolygonOffset)			/* 319 */
+ICD_ENTRY(TexCoordPointer)		/* 320 */
+ICD_ENTRY(VertexPointer)			/* 321 */
+ICD_ENTRY(AreTexturesResident)	/* 322 */
+ICD_ENTRY(CopyTexImage1D)			/* 323 */
+ICD_ENTRY(CopyTexImage2D)			/* 324 */
+ICD_ENTRY(CopyTexSubImage1D)		/* 325 */
+ICD_ENTRY(CopyTexSubImage2D)		/* 326 */
+ICD_ENTRY(DeleteTextures)			/* 327 */
+ICD_ENTRY(GenTextures)			/* 328 */
+ICD_ENTRY(GetPointerv)			/* 329 */
+ICD_ENTRY(IsTexture)				/* 330 */
+ICD_ENTRY(PrioritizeTextures)		/* 331 */
+ICD_ENTRY(TexSubImage1D)			/* 332 */
+ICD_ENTRY(TexSubImage2D)			/* 333 */
+ICD_ENTRY(PopClientAttrib)		/* 334 */
+ICD_ENTRY(PushClientAttrib)		/* 335 */
Index: /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/VBoxOGL.cpp
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/VBoxOGL.cpp	(revision 3339)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/VBoxOGL.cpp	(revision 3339)
@@ -0,0 +1,460 @@
+/** @file
+ *
+ * VBoxDisp -- Windows Guest OpenGL ICD
+ *
+ * Copyright (C) 2006-2007 innotek GmbH
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation,
+ * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+ * distribution. VirtualBox OSE is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * If you received this file as part of a commercial VirtualBox
+ * distribution, then only the terms of your commercial VirtualBox
+ * license agreement apply instead of the previous paragraph.
+ *
+ */
+#include "VBoxOGL.h"
+#include <VBox/version.h>
+#include <VBox/VBoxGuest.h>
+#include <stdarg.h>
+#include <stdio.h>
+
+#define VBOX_INIT_CALL(a, b, c)                 \
+    (a)->result      = VINF_SUCCESS;            \
+    (a)->u32ClientID = (c)->u32ClientID;        \
+    (a)->u32Function = VBOXOGL_FN_##b;          \
+    (a)->cParms      = VBOXOGL_CPARMS_##b
+
+
+       HINSTANCE    hDllVBoxOGL                 = 0;
+static DWORD        dwOGLTlsIndex               = TLS_OUT_OF_INDEXES;
+static VBOX_OGL_CTX vboxOGLCtx                  = {0};
+static char         szOpenGLVersion[256]        = "";
+static char         szOpenGLExtensions[8192]    = ""; /* this one can be rather long */
+
+
+/**
+ * Set the thread local OpenGL context
+ *
+ * @param   pCtx        thread local OpenGL context ptr
+ */
+void VBoxOGLSetThreadCtx(PVBOX_OGL_THREAD_CTX pCtx)
+{
+    BOOL ret;
+
+    ret = TlsSetValue(dwOGLTlsIndex, pCtx);
+    Assert(ret);
+}
+
+
+/**
+ * Return the thread local OpenGL context
+ *
+ * @return thread local OpenGL context ptr or NULL if failure
+ */
+PVBOX_OGL_THREAD_CTX VBoxOGLGetThreadCtx()
+{
+    PVBOX_OGL_THREAD_CTX pCtx;
+
+    pCtx = (PVBOX_OGL_THREAD_CTX)TlsGetValue(dwOGLTlsIndex);
+    if (!pCtx)
+    {
+        /* lazy init */
+        VBoxOGLThreadAttach();
+        pCtx = (PVBOX_OGL_THREAD_CTX)TlsGetValue(dwOGLTlsIndex);
+    }
+    Assert(pCtx);
+    return pCtx;
+}
+
+/**
+ * Initialize the OpenGL guest-host communication channel
+ *
+ * @return success or failure (boolean)
+ * @param   hDllInst        Dll instance handle
+ */
+BOOL VBoxOGLInit(HINSTANCE hDllInst)
+{
+    dwOGLTlsIndex = TlsAlloc();
+    if (dwOGLTlsIndex == TLS_OUT_OF_INDEXES)
+    {
+        DbgPrintf(("TlsAlloc failed with %d\n", GetLastError()));
+        return FALSE;
+    }
+    DbgPrintf(("VBoxOGLInit TLS index=%d\n", dwOGLTlsIndex));
+
+    /* open VBox guest driver */
+    vboxOGLCtx.hGuestDrv = CreateFile(VBOXGUEST_DEVICE_NAME,
+                                      GENERIC_READ | GENERIC_WRITE,
+                                      FILE_SHARE_READ | FILE_SHARE_WRITE,
+                                      NULL,
+                                      OPEN_EXISTING,
+                                      FILE_ATTRIBUTE_NORMAL,
+                                      NULL);
+    if (vboxOGLCtx.hGuestDrv == INVALID_HANDLE_VALUE)
+    {
+        DbgPrintf(("VBoxService: could not open VBox Guest Additions driver! rc = %d\n", GetLastError()));
+        return FALSE;
+    }
+
+    VBoxOGLThreadAttach();
+    hDllVBoxOGL = hDllInst;
+    return TRUE;
+}
+
+/**
+ * Destroy the OpenGL guest-host communication channel
+ *
+ * @return success or failure (boolean)
+ */
+BOOL VBoxOGLExit()
+{
+    DbgPrintf(("VBoxOGLExit\n"));
+    VBoxOGLThreadDetach();
+    CloseHandle(vboxOGLCtx.hGuestDrv);
+
+    hDllVBoxOGL = 0;
+    return TRUE;
+}
+
+
+/**
+ * Initialize new thread
+ *
+ * @return success or failure (boolean)
+ */
+BOOL VBoxOGLThreadAttach()
+{
+    PVBOX_OGL_THREAD_CTX pCtx;
+
+    DbgPrintf(("VBoxOGLThreadAttach id=%x\n", GetCurrentThreadId()));
+
+    pCtx = (PVBOX_OGL_THREAD_CTX)malloc(sizeof(*pCtx));
+    AssertReturn(pCtx, FALSE);
+    if (!pCtx)
+        return FALSE;
+
+    pCtx->pCmdBuffer    = (uint8_t *)VirtualAlloc(NULL, VBOX_OGL_MAX_CMD_BUFFER, MEM_COMMIT, PAGE_READWRITE);
+    pCtx->pCmdBufferEnd = pCtx->pCmdBuffer + VBOX_OGL_MAX_CMD_BUFFER;
+    pCtx->pCurrentCmd   = pCtx->pCmdBuffer;
+    pCtx->cCommands     = 0;
+    Assert(pCtx->pCmdBuffer);
+    if (!pCtx->pCmdBuffer)
+        return FALSE;
+
+    VBoxOGLSetThreadCtx(pCtx);
+
+    VBoxGuestHGCMConnectInfo info;
+    memset (&info, 0, sizeof (info));
+
+    info.Loc.type = VMMDevHGCMLoc_LocalHost_Existing;
+
+    strcpy (info.Loc.u.host.achName, "VBoxSharedOpenGL");
+
+    DWORD cbReturned;
+
+    if (DeviceIoControl(vboxOGLCtx.hGuestDrv,
+                        IOCTL_VBOXGUEST_HGCM_CONNECT,
+                        &info, sizeof (info),
+                        &info, sizeof (info),
+                        &cbReturned,
+                        NULL))
+    {
+        if (info.result == VINF_SUCCESS)
+        {
+            pCtx->u32ClientID = info.u32ClientID;
+            DbgPrintf(("HGCM connect was successful: client id =%x\n", pCtx->u32ClientID));
+        }
+    }
+    else
+    {
+        DbgPrintf(("HGCM connect failed with rc=%x\n", GetLastError()));
+        return FALSE;
+    }
+
+    VBoxOGLglGetString parms;
+    memset(&parms, 0, sizeof(parms));
+
+    VBOX_INIT_CALL(&parms.hdr, GLGETSTRING, pCtx);
+
+    parms.name.type                      = VMMDevHGCMParmType_32bit;
+    parms.name.u.value32                 = GL_VERSION;
+    parms.pString.type                   = VMMDevHGCMParmType_LinAddr;
+    parms.pString.u.Pointer.size         = sizeof(szOpenGLVersion);
+    parms.pString.u.Pointer.u.linearAddr = (vmmDevHypPtr)szOpenGLVersion;
+
+    int rc = vboxHGCMCall(vboxOGLCtx.hGuestDrv, &parms, sizeof (parms));
+
+    if (    VBOX_FAILURE(rc)
+        ||  VBOX_FAILURE(parms.hdr.result))
+    {
+        DbgPrintf(("GL_VERSION failed with %x %x\n", rc, parms.hdr.result));
+        return FALSE;
+    }
+    DbgPrintf(("GL_VERSION=%s\n", szOpenGLVersion));
+
+    memset(&parms, 0, sizeof(parms));
+    VBOX_INIT_CALL(&parms.hdr, GLGETSTRING, pCtx);
+
+    parms.name.type                      = VMMDevHGCMParmType_32bit;
+    parms.name.u.value32                 = GL_EXTENSIONS;
+    parms.pString.type                   = VMMDevHGCMParmType_LinAddr;
+    parms.pString.u.Pointer.size         = sizeof(szOpenGLExtensions);
+    parms.pString.u.Pointer.u.linearAddr = (vmmDevHypPtr)szOpenGLExtensions;
+
+    rc = vboxHGCMCall(vboxOGLCtx.hGuestDrv, &parms, sizeof (parms));
+
+    if (    VBOX_FAILURE(rc)
+        ||  VBOX_FAILURE(parms.hdr.result))
+    {
+        DbgPrintf(("GL_EXTENSIONS failed with %x %x\n", rc, parms.hdr.result));
+        return FALSE;
+    }
+    DbgPrintf(("GL_EXTENSIONS=%s\n\n", szOpenGLExtensions));
+
+    return TRUE;
+}
+
+/**
+ * Clean up for terminating thread
+ *
+ * @return success or failure (boolean)
+ */
+BOOL VBoxOGLThreadDetach()
+{
+    PVBOX_OGL_THREAD_CTX pCtx;
+
+    DbgPrintf(("VBoxOGLThreadDetach id=%x\n", GetCurrentThreadId()));
+
+    pCtx = VBoxOGLGetThreadCtx();
+    if (pCtx && pCtx->u32ClientID)
+    {
+        VBoxGuestHGCMDisconnectInfo info;
+
+        memset (&info, 0, sizeof (info));
+
+        info.u32ClientID = pCtx->u32ClientID;
+
+        DWORD cbReturned;
+
+        BOOL bRet = DeviceIoControl(vboxOGLCtx.hGuestDrv,
+                                    IOCTL_VBOXGUEST_HGCM_DISCONNECT,
+                                    &info, sizeof (info),
+                                    &info, sizeof (info),
+                                    &cbReturned,
+                                    NULL);
+
+        if (!bRet)
+        {
+            DbgPrintf(("Disconnect failed with %x\n", GetLastError()));
+        }
+    }
+    if (pCtx)
+    {
+        if (pCtx->pCmdBuffer)
+            VirtualFree(pCtx->pCmdBuffer, 0, MEM_RELEASE);
+
+        free(pCtx);
+        VBoxOGLSetThreadCtx(NULL);
+    }
+
+    return TRUE;
+}
+
+
+
+/**
+ * Send an HGCM request
+ *
+ * @return VBox status code
+ * @param   hDriver     Driver handle
+ * @param   pvData      Data pointer
+ * @param   cbData      Data size
+ */
+int vboxHGCMCall(HANDLE hDriver, void *pvData, unsigned cbData)
+{
+    DWORD cbReturned;
+
+    if (DeviceIoControl (hDriver,
+                         IOCTL_VBOXGUEST_HGCM_CALL,
+                         pvData, cbData,
+                         pvData, cbData,
+                         &cbReturned,
+                         NULL))
+    {
+        return VINF_SUCCESS;
+    }
+    DbgPrintf(("vboxCall failed with %x\n", GetLastError()));
+    return VERR_NOT_SUPPORTED;
+}
+
+#ifdef DEBUG
+/**
+ * Log to the debug output device
+ *
+ * @param   pszFormat   Format string
+ * @param   ...         Variable parameters
+ */
+void VBoxDbgLog(char *pszFormat, ...)
+{
+   va_list va;
+
+   va_start(va, pszFormat);
+   CHAR  Buffer[10240];
+   if (strlen(pszFormat) < 512)
+   {
+      vsprintf (Buffer, pszFormat, va);
+
+      printf(Buffer);
+//      OutputDebugStringA(Buffer);
+   }
+
+   va_end (va);
+}
+#endif
+
+
+GLenum APIENTRY glGetError (void)
+{
+    PVBOX_OGL_THREAD_CTX pCtx = VBoxOGLGetThreadCtx();
+
+    /** @todo if fetch error flag set -> flush buffer */
+    return pCtx->glLastError;
+}
+
+void APIENTRY glSetError(GLenum glNewError)
+{
+    PVBOX_OGL_THREAD_CTX pCtx = VBoxOGLGetThreadCtx();
+
+    pCtx->glLastError = glNewError;
+}
+
+/**
+ * Query OpenGL strings
+ *
+ * @returns OpenGL string pointer
+ * @param   name    string type
+ */
+const GLubyte * APIENTRY glGetString (GLenum name)
+{
+    DbgPrintf(("glGetString %x\n", name));
+    switch (name)
+    {
+    /* Note: We hide the host vendor and renderer to avoid exposing potential critical information (exploits) */
+    case GL_VENDOR:
+        return (const GLubyte *)VBOX_VENDOR;
+
+    case GL_RENDERER:
+        return (const GLubyte *)"VirtualBox OpenGL Renderer";
+
+    case GL_VERSION:
+        return (const GLubyte *)szOpenGLVersion;
+
+    case GL_EXTENSIONS:
+        return (const GLubyte *)szOpenGLExtensions;
+
+    default:
+        glLogError(GL_INVALID_ENUM);
+        return NULL;
+    }
+}
+
+/**
+ * Flush the OpenGL command queue and return the return val of the last command
+ *
+ * @returns return val of last command
+ */
+uint64_t VBoxOGLFlush()
+{
+    PVBOX_OGL_THREAD_CTX pCtx = VBoxOGLGetThreadCtx();
+    VBoxOGLglFlush       parms;
+
+    AssertReturn(pCtx->pCurrentCmd > pCtx->pCmdBuffer, 0);
+
+    VBOX_INIT_CALL(&parms.hdr, GLFLUSH, pCtx);
+
+    parms.pCmdBuffer.type                   = VMMDevHGCMParmType_LinAddr;
+    parms.pCmdBuffer.u.Pointer.size         = pCtx->pCurrentCmd - pCtx->pCmdBuffer;
+    parms.pCmdBuffer.u.Pointer.u.linearAddr = (vmmDevHypPtr)pCtx->pCmdBuffer;
+    parms.cCommands.type                    = VMMDevHGCMParmType_32bit;
+    parms.cCommands.u.value32               = pCtx->cCommands;
+    parms.retval.type                       = VMMDevHGCMParmType_64bit;
+    parms.retval.u.value64                  = 0;
+    parms.lasterror.type                    = VMMDevHGCMParmType_32bit;
+    parms.lasterror.u.value32               = 0;
+
+    int rc = vboxHGCMCall(vboxOGLCtx.hGuestDrv, &parms, sizeof (parms));
+
+    /* reset command buffer */
+    pCtx->pCurrentCmd = pCtx->pCmdBuffer;
+    pCtx->cCommands   = 0;
+
+    if (    VBOX_FAILURE(rc)
+        ||  VBOX_FAILURE(parms.hdr.result))
+    {
+        DbgPrintf(("GL_FLUSH failed with %x %x\n", rc, parms.hdr.result));
+        return 0;
+    }
+
+    glSetError(parms.lasterror.u.value32);
+#ifdef DEBUG
+    if (parms.lasterror.u.value32)
+        DbgPrintf(("Last command returned error %x\n", parms.lasterror.u.value32));
+#endif
+    return parms.retval.u.value64;
+}
+
+/**
+ * Flush the OpenGL command queue and return the return val of the last command
+ * The last command's final parameter is a pointer where its result is stored
+ *
+ * @returns return val of last command
+ * @param   pLastParam      Last parameter's address
+ * @param   cbParam         Last parameter's size
+ */
+uint64_t VBoxOGLFlushPtr(void *pLastParam, uint32_t cbParam)
+{
+    PVBOX_OGL_THREAD_CTX pCtx = VBoxOGLGetThreadCtx();
+    VBoxOGLglFlushPtr    parms;
+
+    AssertReturn(pCtx->pCurrentCmd > pCtx->pCmdBuffer, 0);
+
+    VBOX_INIT_CALL(&parms.hdr, GLFLUSHPTR, pCtx);
+
+    parms.pCmdBuffer.type                   = VMMDevHGCMParmType_LinAddr;
+    parms.pCmdBuffer.u.Pointer.size         = pCtx->pCurrentCmd - pCtx->pCmdBuffer;
+    parms.pCmdBuffer.u.Pointer.u.linearAddr = (vmmDevHypPtr)pCtx->pCmdBuffer;
+    parms.cCommands.type                    = VMMDevHGCMParmType_32bit;
+    parms.cCommands.u.value32               = pCtx->cCommands;
+    parms.retval.type                       = VMMDevHGCMParmType_64bit;
+    parms.retval.u.value64                  = 0;
+    parms.lasterror.type                    = VMMDevHGCMParmType_32bit;
+    parms.lasterror.u.value32               = 0;
+    parms.pLastParam.type                   = VMMDevHGCMParmType_LinAddr;
+    parms.pLastParam.u.Pointer.size         = cbParam;
+    parms.pLastParam.u.Pointer.u.linearAddr = (vmmDevHypPtr)pLastParam;
+
+    int rc = vboxHGCMCall(vboxOGLCtx.hGuestDrv, &parms, sizeof (parms));
+
+    /* reset command buffer */
+    pCtx->pCurrentCmd = pCtx->pCmdBuffer;
+    pCtx->cCommands   = 0;
+
+    if (    VBOX_FAILURE(rc)
+        ||  VBOX_FAILURE(parms.hdr.result))
+    {
+        DbgPrintf(("GL_FLUSH failed with %x %x\n", rc, parms.hdr.result));
+        return 0;
+    }
+
+    glSetError(parms.lasterror.u.value32);
+#ifdef DEBUG
+    if (parms.lasterror.u.value32)
+        DbgPrintf(("Last command returned error %x\n", parms.lasterror.u.value32));
+#endif
+    return parms.retval.u.value64;
+}
Index: /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/VBoxOGL.def
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/VBoxOGL.def	(revision 3339)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/VBoxOGL.def	(revision 3339)
@@ -0,0 +1,385 @@
+;/** @file
+; *
+; * VBoxDisp -- Windows Guest OpenGL ICD
+; *
+; * Copyright (C) 2006-2007 innotek GmbH
+; *
+; * This file is part of VirtualBox Open Source Edition (OSE), as
+; * available from http://www.virtualbox.org. This file is free software;
+; * you can redistribute it and/or modify it under the terms of the GNU
+; * General Public License as published by the Free Software Foundation,
+; * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+; * distribution. VirtualBox OSE is distributed in the hope that it will
+; * be useful, but WITHOUT ANY WARRANTY of any kind.
+; *
+; * If you received this file as part of a commercial VirtualBox
+; * distribution, then only the terms of your commercial VirtualBox
+; * license agreement apply instead of the previous paragraph.
+; *
+; */
+
+LIBRARY VBoxOGL
+
+EXPORTS
+    DrvCopyContext
+    DrvCreateContext
+    DrvCreateLayerContext
+    DrvDeleteContext
+    DrvDescribeLayerPlane
+    DrvDescribePixelFormat
+    DrvGetLayerPaletteEntries
+    DrvGetProcAddress
+    DrvRealizeLayerPalette
+    DrvReleaseContext
+    DrvSetContext
+    DrvSetLayerPaletteEntries
+    DrvSetPixelFormat
+    DrvShareLists
+    DrvSwapBuffers
+    DrvSwapLayerBuffers
+    DrvValidateVersion
+
+; exported by the ICDTABLE
+    glNewList
+    glEndList
+    glCallList
+    glCallLists
+    glDeleteLists
+    glGenLists
+    glListBase
+    glBegin
+    glBitmap
+    glColor3b
+    glColor3bv
+    glColor3d
+    glColor3dv
+    glColor3f
+    glColor3fv
+    glColor3i
+    glColor3iv
+    glColor3s
+    glColor3sv
+    glColor3ub
+    glColor3ubv
+    glColor3ui
+    glColor3uiv
+    glColor3us
+    glColor3usv
+    glColor4b
+    glColor4bv
+    glColor4d
+    glColor4dv
+    glColor4f
+    glColor4fv
+    glColor4i
+    glColor4iv
+    glColor4s
+    glColor4sv
+    glColor4ub
+    glColor4ubv
+    glColor4ui
+    glColor4uiv
+    glColor4us
+    glColor4usv
+    glEdgeFlag
+    glEdgeFlagv
+    glEnd
+    glIndexd
+    glIndexdv
+    glIndexf
+    glIndexfv
+    glIndexi
+    glIndexiv
+    glIndexs
+    glIndexsv
+    glNormal3b
+    glNormal3bv
+    glNormal3d
+    glNormal3dv
+    glNormal3f
+    glNormal3fv
+    glNormal3i
+    glNormal3iv
+    glNormal3s
+    glNormal3sv
+    glRasterPos2d
+    glRasterPos2dv
+    glRasterPos2f
+    glRasterPos2fv
+    glRasterPos2i
+    glRasterPos2iv
+    glRasterPos2s
+    glRasterPos2sv
+    glRasterPos3d
+    glRasterPos3dv
+    glRasterPos3f
+    glRasterPos3fv
+    glRasterPos3i
+    glRasterPos3iv
+    glRasterPos3s
+    glRasterPos3sv
+    glRasterPos4d
+    glRasterPos4dv
+    glRasterPos4f
+    glRasterPos4fv
+    glRasterPos4i
+    glRasterPos4iv
+    glRasterPos4s
+    glRasterPos4sv
+    glRectd
+    glRectdv
+    glRectf
+    glRectfv
+    glRecti
+    glRectiv
+    glRects
+    glRectsv
+    glTexCoord1d
+    glTexCoord1dv
+    glTexCoord1f
+    glTexCoord1fv
+    glTexCoord1i
+    glTexCoord1iv
+    glTexCoord1s
+    glTexCoord1sv
+    glTexCoord2d
+    glTexCoord2dv
+    glTexCoord2f
+    glTexCoord2fv
+    glTexCoord2i
+    glTexCoord2iv
+    glTexCoord2s
+    glTexCoord2sv
+    glTexCoord3d
+    glTexCoord3dv
+    glTexCoord3f
+    glTexCoord3fv
+    glTexCoord3i
+    glTexCoord3iv
+    glTexCoord3s
+    glTexCoord3sv
+    glTexCoord4d
+    glTexCoord4dv
+    glTexCoord4f
+    glTexCoord4fv
+    glTexCoord4i
+    glTexCoord4iv
+    glTexCoord4s
+    glTexCoord4sv
+    glVertex2d
+    glVertex2dv
+    glVertex2f
+    glVertex2fv
+    glVertex2i
+    glVertex2iv
+    glVertex2s
+    glVertex2sv
+    glVertex3d
+    glVertex3dv
+    glVertex3f
+    glVertex3fv
+    glVertex3i
+    glVertex3iv
+    glVertex3s
+    glVertex3sv
+    glVertex4d
+    glVertex4dv
+    glVertex4f
+    glVertex4fv
+    glVertex4i
+    glVertex4iv
+    glVertex4s
+    glVertex4sv
+    glClipPlane
+    glColorMaterial
+    glCullFace
+    glFogf
+    glFogfv
+    glFogi
+    glFogiv
+    glFrontFace
+    glHint
+    glLightf
+    glLightfv
+    glLighti
+    glLightiv
+    glLightModelf
+    glLightModelfv
+    glLightModeli
+    glLightModeliv
+    glLineStipple
+    glLineWidth
+    glMaterialf
+    glMaterialfv
+    glMateriali
+    glMaterialiv
+    glPointSize
+    glPolygonMode
+    glPolygonStipple
+    glScissor
+    glShadeModel
+    glTexParameterf
+    glTexParameterfv
+    glTexParameteri
+    glTexParameteriv
+    glTexImage1D
+    glTexImage2D
+    glTexEnvf
+    glTexEnvfv
+    glTexEnvi
+    glTexEnviv
+    glTexGend
+    glTexGendv
+    glTexGenf
+    glTexGenfv
+    glTexGeni
+    glTexGeniv
+    glFeedbackBuffer
+    glSelectBuffer
+    glRenderMode
+    glInitNames
+    glLoadName
+    glPassThrough
+    glPopName
+    glPushName
+    glDrawBuffer
+    glClear
+    glClearAccum
+    glClearIndex
+    glClearColor
+    glClearStencil
+    glClearDepth
+    glStencilMask
+    glColorMask
+    glDepthMask
+    glIndexMask
+    glAccum
+    glDisable
+    glEnable
+    glFinish
+    glFlush
+    glPopAttrib
+    glPushAttrib
+    glMap1d
+    glMap1f
+    glMap2d
+    glMap2f
+    glMapGrid1d
+    glMapGrid1f
+    glMapGrid2d
+    glMapGrid2f
+    glEvalCoord1d
+    glEvalCoord1dv
+    glEvalCoord1f
+    glEvalCoord1fv
+    glEvalCoord2d
+    glEvalCoord2dv
+    glEvalCoord2f
+    glEvalCoord2fv
+    glEvalMesh1
+    glEvalPoint1
+    glEvalMesh2
+    glEvalPoint2
+    glAlphaFunc
+    glBlendFunc
+    glLogicOp
+    glStencilFunc
+    glStencilOp
+    glDepthFunc
+    glPixelZoom
+    glPixelTransferf
+    glPixelTransferi
+    glPixelStoref
+    glPixelStorei
+    glPixelMapfv
+    glPixelMapuiv
+    glPixelMapusv
+    glReadBuffer
+    glCopyPixels
+    glReadPixels
+    glDrawPixels
+    glGetBooleanv
+    glGetClipPlane
+    glGetDoublev
+    glGetError
+    glGetFloatv
+    glGetIntegerv
+    glGetLightfv
+    glGetLightiv
+    glGetMapdv
+    glGetMapfv
+    glGetMapiv
+    glGetMaterialfv
+    glGetMaterialiv
+    glGetPixelMapfv
+    glGetPixelMapuiv
+    glGetPixelMapusv
+    glGetPolygonStipple
+    glGetString
+    glGetTexEnvfv
+    glGetTexEnviv
+    glGetTexGendv
+    glGetTexGenfv
+    glGetTexGeniv
+    glGetTexImage
+    glGetTexParameterfv
+    glGetTexParameteriv
+    glGetTexLevelParameterfv
+    glGetTexLevelParameteriv
+    glIsEnabled
+    glIsList
+    glDepthRange
+    glFrustum
+    glLoadIdentity
+    glLoadMatrixf
+    glLoadMatrixd
+    glMatrixMode
+    glMultMatrixf
+    glMultMatrixd
+    glOrtho
+    glPopMatrix
+    glPushMatrix
+    glRotated
+    glRotatef
+    glScaled
+    glScalef
+    glTranslated
+    glTranslatef
+    glViewport
+    glArrayElement
+    glBindTexture
+    glColorPointer
+    glDisableClientState
+    glDrawArrays
+    glDrawElements
+    glEdgeFlagPointer
+    glEnableClientState
+    glIndexPointer
+    glIndexub
+    glIndexubv
+    glInterleavedArrays
+    glNormalPointer
+    glPolygonOffset
+    glTexCoordPointer
+    glVertexPointer
+    glAreTexturesResident
+    glCopyTexImage1D
+    glCopyTexImage2D
+    glCopyTexSubImage1D
+    glCopyTexSubImage2D
+    glDeleteTextures
+    glGenTextures
+    glGetPointerv
+    glIsTexture
+    glPrioritizeTextures
+    glTexSubImage1D
+    glTexSubImage2D
+    glPopClientAttrib
+    glPushClientAttrib
+
+; test exports
+    wglCreateContext
+    wglMakeCurrent
+    wglDeleteContext
+    SwapBuffers
+
Index: /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/VBoxOGL.h
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/VBoxOGL.h	(revision 3339)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/VBoxOGL.h	(revision 3339)
@@ -0,0 +1,231 @@
+/** @file
+ *
+ * VirtualBox Windows NT/2000/XP guest OpenGL ICD
+ *
+ * Copyright (C) 2006-2007 innotek GmbH
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation,
+ * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+ * distribution. VirtualBox OSE is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * If you received this file as part of a commercial VirtualBox
+ * distribution, then only the terms of your commercial VirtualBox
+ * license agreement apply instead of the previous paragraph.
+ *
+ */
+#ifndef __VBOXOGL_H__
+#define __VBOXOGL_H__
+
+#include <windows.h>
+/* get rid of the inconsistent dll linkage warnings */
+#undef WINGDIAPI
+#define WINGDIAPI
+#include "GL/gl.h"
+
+#include <iprt/cdefs.h>
+#include <iprt/assert.h>
+
+#include <VBox/HostServices/VBoxOpenGLSvc.h>
+#include <VBox/HostServices/VBoxOGLOp.h>
+
+typedef struct _icdTable 
+{
+    DWORD size;
+    PROC  table[336];
+} ICDTABLE, *PICDTABLE;
+
+
+typedef struct
+{
+    HANDLE      hGuestDrv;
+
+} VBOX_OGL_CTX, *PVBOX_OGL_CTX;
+
+typedef struct
+{
+    uint32_t        u32ClientID;
+
+    GLenum          glLastError;
+    uint32_t        cCommands;
+    uint8_t        *pCmdBuffer;
+    uint8_t        *pCmdBufferEnd;
+    uint8_t        *pCurrentCmd;
+} VBOX_OGL_THREAD_CTX, *PVBOX_OGL_THREAD_CTX;
+
+
+extern HINSTANCE hDllVBoxOGL;
+
+void APIENTRY glSetError(GLenum glNewError);
+
+#ifdef DEBUG
+#define glLogError(a)               \
+    {                               \
+        /** @todo log error */      \
+        glSetError(a);              \
+    }
+#define DbgPrintf(a)        VBoxDbgLog a
+#else
+#define glLogError(a)       glSetError(a)
+#define DbgPrintf(a)
+#endif
+
+
+/**
+ * Initialize the OpenGL guest-host communication channel
+ *
+ * @return success or failure (boolean)
+ * @param   hDllInst        Dll instance handle
+ */
+BOOL VBoxOGLInit(HINSTANCE hDllInst);
+
+/**
+ * Destroy the OpenGL guest-host communication channel
+ *
+ * @return success or failure (boolean)
+ */
+BOOL VBoxOGLExit();
+
+/**
+ * Initialize new thread
+ *
+ * @return success or failure (boolean)
+ */
+BOOL VBoxOGLThreadAttach();
+
+/**
+ * Clean up for terminating thread
+ *
+ * @return success or failure (boolean)
+ */
+BOOL VBoxOGLThreadDetach();
+
+/**
+ * Set the thread local OpenGL context
+ *
+ * @param   pCtx        thread local OpenGL context ptr
+ */
+void VBoxOGLSetThreadCtx(PVBOX_OGL_THREAD_CTX pCtx);
+
+/**
+ * Return the thread local OpenGL context
+ *
+ * @return thread local OpenGL context ptr or NULL if failure
+ */
+PVBOX_OGL_THREAD_CTX VBoxOGLGetThreadCtx();
+
+
+/**
+ * Queue a new OpenGL command
+ *
+ * @param   enmOp       OpenGL command op
+ * @param   cParam      Number of parameters
+ * @param   cbParams    Memory needed for parameters
+ */
+void VBoxCmdStart(uint32_t enmOp, uint32_t cParam, uint32_t cbParams);
+
+/**
+ * Add a parameter to the currently queued OpenGL command
+ *
+ * @param   pParam      Parameter ptr
+ * @param   cbParam     Parameter value size
+ */
+void VBoxCmdSaveParameter(uint8_t *pParam, uint32_t cbParam);
+
+/**
+ * Add a parameter (variable size) to the currently queued OpenGL command
+ *
+ * @param   pParam      Parameter ptr
+ * @param   cbParam     Parameter value size
+ */
+void VBoxCmdSaveMemParameter(uint8_t *pParam, uint32_t cbParam);
+
+/**
+ * Finish the queued command
+ *
+ * @param   enmOp       OpenGL command op
+ */
+void VBoxCmdStop(uint32_t enmOp);
+
+                 
+/**
+ * Send an HGCM request
+ *
+ * @return VBox status code
+ * @param   hDriver     Driver handle
+ * @param   pvData      Data pointer
+ * @param   cbData      Data size
+ */
+int vboxHGCMCall(HANDLE hDriver, void *pvData, unsigned cbData);
+
+#ifdef DEBUG
+/**
+ * Log to the debug output device
+ *
+ * @param   pszFormat   Format string
+ * @param   ...         Variable parameters
+ */
+void VBoxDbgLog(char *pszFormat, ...);
+#endif
+
+/**
+ * Flush the OpenGL command queue and return the return val of the last command
+ *
+ * @returns return val of last command
+ */
+uint64_t VBoxOGLFlush();
+
+/**
+ * Flush the OpenGL command queue and return the return val of the last command
+ * The last command's final parameter is a pointer where its result is stored
+ *
+ * @returns return val of last command
+ * @param   pLastParam      Last parameter's address
+ * @param   cbParam         Last parameter's size
+ */
+uint64_t VBoxOGLFlushPtr(void *pLastParam, uint32_t cbParam);
+
+/**
+ * Query the specified cached parameter
+ * 
+ * @returns requested cached value
+ * @param   type        Parameter type (Note: minimal checks only!)
+ */
+GLint glInternalGetIntegerv(GLenum type);
+
+/**
+ * Query the specified cached texture level parameter
+ * 
+ * @returns requested cached value
+ * @param   type        Parameter type (Note: minimal checks only!)
+ */
+GLint glInternalGetTexLevelParameteriv(GLenum type);
+
+/**
+ * Query the number of bytes required for a pixel in the specified format
+ * 
+ * @returns requested pixel size
+ * @param   type        Parameter type
+ */
+GLint glInternalGetPixelFormatElements(GLenum format);
+
+/**
+ * Query the size of the specified data type
+ *
+ * @returns type size or 0 if unknown type
+ * @param   type        data type
+ */
+GLint glVBoxGetDataTypeSize(GLenum type);
+
+uint32_t glInternalLightvElem(GLenum pname);
+uint32_t glInternalMaterialvElem(GLenum pname);
+uint32_t glInternalTexEnvvElem(GLenum pname);
+uint32_t glInternalTexGenvElem(GLenum pname);
+uint32_t glInternalTexParametervElem(GLenum pname);
+
+
+#endif /* __VBOXOGL_H__ */
+
Index: /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/VBoxOGL.rc
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/VBoxOGL.rc	(revision 3339)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/VBoxOGL.rc	(revision 3339)
@@ -0,0 +1,65 @@
+/** @file
+ *
+ * VBoxDisp -- Windows Guest OpenGL ICD
+ *
+ * Copyright (C) 2006-2007 innotek GmbH
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation,
+ * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+ * distribution. VirtualBox OSE is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * If you received this file as part of a commercial VirtualBox
+ * distribution, then only the terms of your commercial VirtualBox
+ * license agreement apply instead of the previous paragraph.
+ *
+ */
+#include <windows.h>
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+VS_VERSION_INFO VERSIONINFO
+   FILEVERSION          VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+   PRODUCTVERSION	VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+   FILEFLAGSMASK        0x3fL
+   FILEFLAGS            0x0L
+   FILEOS               0x40004L
+   FILETYPE             0x3L
+   FILESUBTYPE          0x4L
+BEGIN
+   BLOCK "StringFileInfo"
+   BEGIN
+      BLOCK "040904b0"
+      BEGIN
+         VALUE "CompanyName",      "innotek GmbH\0"
+         VALUE "FileDescription",  "VirtualBox OpenGL ICD\0"
+         VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "\0"
+         VALUE "InternalName",     "VBoxOGL.dll\0"
+         VALUE "LegalCopyright",   "(C) 2004-2007 innotek GmbH\0"
+         VALUE "OriginalFilename", "VBoxOGL.dll\0"
+         VALUE "ProductName",      "VirtualBox Guest Tools\0"
+         VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "\0"
+      END
+   END
+   BLOCK "VarFileInfo"
+   BEGIN
+      VALUE "Translation", 0x409, 1200
+   END
+END
+
+1 RCDATA
+BEGIN
+// Machine dependent parameters
+    17,     // Height of vertical thumb
+    17,     // Width of horizontal thumb
+    2,      // Icon horiz compression factor
+    2,      // Icon vert compression factor
+    1,      // Cursor horz compression factor
+    1,      // Cursor vert compression factor
+    0,      // Kanji window height
+    1,      // cxBorder (thickness of vertical lines)
+    1       // cyBorder (thickness of horizontal lines)
+END
Index: /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/dllmain.cpp
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/dllmain.cpp	(revision 3339)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/dllmain.cpp	(revision 3339)
@@ -0,0 +1,60 @@
+/** @file
+ *
+ * VBoxDisp -- Windows Guest OpenGL ICD
+ *
+ * Copyright (C) 2006-2007 innotek GmbH
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation,
+ * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+ * distribution. VirtualBox OSE is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * If you received this file as part of a commercial VirtualBox
+ * distribution, then only the terms of your commercial VirtualBox
+ * license agreement apply instead of the previous paragraph.
+ *
+ */
+#include "VBoxOGL.h"
+#include <VBox/version.h>
+#include <iprt/cdefs.h>
+#include <iprt/assert.h>
+
+
+/**
+ * Dll entrypoint
+ *
+ * @returns type size or 0 if unknown type
+ * @param   hDLLInst        Dll instance handle
+ * @param   fdwReason       Callback reason
+ * @param   lpvReserved     Reserved
+ */
+BOOL WINAPI DllMain(HINSTANCE hDLLInst, DWORD fdwReason, LPVOID lpvReserved)
+{
+    BOOL	bStatus = TRUE;
+
+    switch (fdwReason) 
+    {
+    case DLL_PROCESS_ATTACH:
+        return VBoxOGLInit(hDLLInst);
+
+    case DLL_PROCESS_DETACH:
+        VBoxOGLExit();
+        return TRUE;
+
+    case DLL_THREAD_ATTACH:
+        break;
+
+    case DLL_THREAD_DETACH:
+        return VBoxOGLThreadDetach();
+
+    default:
+        break;
+    }
+
+    return bStatus;
+}
+
+
Index: /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/drv.cpp
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/drv.cpp	(revision 3339)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/drv.cpp	(revision 3339)
@@ -0,0 +1,99 @@
+/** @file
+ *
+ * VirtualBox Windows NT/2000/XP guest OpenGL ICD
+ *
+ * ICD entry points.
+ *
+ * Copyright (C) 2006-2007 innotek GmbH
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation,
+ * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+ * distribution. VirtualBox OSE is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * If you received this file as part of a commercial VirtualBox
+ * distribution, then only the terms of your commercial VirtualBox
+ * license agreement apply instead of the previous paragraph.
+ *
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version:  6.1
+ *
+ * Copyright (C) 1999-2004  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * File name: icd.c
+ * Author:    Gregor Anich
+ *
+ * ICD (Installable Client Driver) interface.
+ * Based on the windows GDI/WGL driver.
+ */
+
+#include "VBoxOGL.h"
+
+#define GL_FUNC(func) gl##func
+
+static ICDTABLE icdTable = { 336, {
+#define ICD_ENTRY(func) (PROC)GL_FUNC(func),
+#include "VBoxICDList.h"
+#undef ICD_ENTRY
+} };
+
+
+
+PROC APIENTRY DrvGetProcAddress(LPCSTR lpszProc)
+{
+    PROC pfnProc = GetProcAddress(hDllVBoxOGL, lpszProc);
+    if (pfnProc == NULL)
+        DbgPrintf(("DrvGetProcAddress %s FAILED\n", lpszProc));
+    else
+        DbgPrintf(("DrvGetProcAddress %s\n", lpszProc));
+
+    return pfnProc;
+}
+
+BOOL APIENTRY DrvValidateVersion(DWORD version)
+{
+    DbgPrintf(("DrvValidateVersion %x -> always TRUE\n", version));
+    return TRUE;
+}
+
+
+PICDTABLE APIENTRY DrvSetContext(HDC hdc, HGLRC hglrc, void *callback)
+{
+    NOREF(callback);
+
+    /* Note: we ignore the callback parameter here */
+    VBOX_OGL_GEN_SYNC_OP2(DrvSetContext, hdc, hglrc);
+    return &icdTable;
+}
+
+/* Test export for directly linking with vboxogl.dll */
+BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)
+{
+    DrvSetContext(hdc, hglrc, NULL);
+    return TRUE;
+}
Index: /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/glext.cpp
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/glext.cpp	(revision 3339)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/glext.cpp	(revision 3339)
@@ -0,0 +1,102 @@
+/** @file
+ *
+ * VirtualBox Windows NT/2000/XP guest OpenGL ICD
+ *
+ * OpenGL extensions 
+ *
+ * References:  http://oss.sgi.com/projects/ogl-sample/registry/
+ *              http://icps.u-strasbg.fr/~marchesin/perso/extensions/
+ *
+ * Copyright (C) 2006-2007 innotek GmbH
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation,
+ * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+ * distribution. VirtualBox OSE is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * If you received this file as part of a commercial VirtualBox
+ * distribution, then only the terms of your commercial VirtualBox
+ * license agreement apply instead of the previous paragraph.
+ *
+ */
+
+ GL_ARB_multitexture
+ GL_EXT_texture_env_add 
+ GL_EXT_compiled_vertex_array 
+ GL_S3_s3tc 
+ GL_ARB_occlusion_query 
+ GL_ARB_point_parameters 
+ GL_ARB_texture_border_clamp 
+ GL_ARB_texture_compression 
+ GL_ARB_texture_cube_map 
+ GL_ARB_texture_env_add 
+ GL_ARB_texture_env_combine 
+ GL_ARB_texture_env_crossbar 
+ GL_ARB_texture_env_dot3 
+ GL_ARB_texture_mirrored_repeat 
+ GL_ARB_transpose_matrix 
+ GL_ARB_vertex_blend 
+ GL_ARB_vertex_buffer_object 
+ GL_ARB_vertex_program 
+ GL_ARB_window_pos 
+ GL_ATI_element_array 
+ GL_ATI_envmap_bumpmap 
+ GL_ATI_fragment_shader 
+ GL_ATI_map_object_buffer 
+ GL_ATI_texture_env_combine3 
+ GL_ATI_texture_mirror_once 
+ GL_ATI_vertex_array_object 
+ GL_ATI_vertex_attrib_array_object 
+ GL_ATI_vertex_streams 
+ GL_ATIX_texture_env_combine3 
+ GL_ATIX_texture_env_route 
+ GL_ATIX_vertex_shader_output_point_size 
+ GL_EXT_abgr 
+ GL_EXT_bgra 
+ GL_EXT_blend_color 
+ GL_EXT_blend_func_separate 
+ GL_EXT_blend_minmax 
+ GL_EXT_blend_subtract 
+ GL_EXT_clip_volume_hint 
+ GL_EXT_draw_range_elements 
+ GL_EXT_fog_coord 
+ GL_EXT_multi_draw_arrays 
+ GL_EXT_packed_pixels 
+ GL_EXT_point_parameters 
+ GL_EXT_polygon_offset 
+ GL_EXT_rescale_normal 
+ GL_EXT_secondary_color 
+ GL_EXT_separate_specular_color 
+ GL_EXT_stencil_wrap 
+ GL_EXT_texgen_reflection 
+ GL_EXT_texture3D 
+ GL_EXT_texture_compression_s3tc 
+ GL_EXT_texture_cube_map 
+ GL_EXT_texture_edge_clamp 
+ GL_EXT_texture_env_combine 
+ GL_EXT_texture_env_dot3 
+ GL_EXT_texture_filter_anisotropic 
+ GL_EXT_texture_lod_bias 
+ GL_EXT_texture_mirror_clamp 
+ GL_EXT_texture_object 
+ GL_EXT_texture_rectangle 
+ GL_EXT_vertex_array 
+ GL_EXT_vertex_shader 
+ GL_HP_occlusion_test 
+ GL_KTX_buffer_region 
+ GL_NV_blend_square 
+ GL_NV_occlusion_query 
+ GL_NV_texgen_reflection 
+ GL_SGI_color_matrix 
+ GL_SGIS_generate_mipmap 
+ GL_SGIS_multitexture 
+ GL_SGIS_texture_border_clamp 
+ GL_SGIS_texture_edge_clamp 
+ GL_SGIS_texture_lod 
+ GL_SUN_multi_draw_arrays 
+ GL_WIN_swap_hint 
+ WGL_EXT_extensions_string 
+ WGL_EXT_swap_control 
Index: /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/test/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/test/Makefile.kmk	(revision 3339)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/test/Makefile.kmk	(revision 3339)
@@ -0,0 +1,50 @@
+# $Id: Makefile.kmk 21700 2007-06-01 16:01:28Z umoeller $
+## @file
+# Sub-Makefile for the Shared OpenGL Host Service testcases.
+#
+
+#
+# Copyright (C) 2006-2007 innotek GmbH
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License as published by the Free Software Foundation,
+# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+# distribution. VirtualBox OSE is distributed in the hope that it will
+# be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# If you received this file as part of a commercial VirtualBox
+# distribution, then only the terms of your commercial VirtualBox
+# license agreement apply instead of the previous paragraph.
+#
+
+DEPTH ?= ../../../../../../..
+SUB_DEPTH = ../../../..
+include $(PATH_KBUILD)/subheader.kmk
+
+ifdef VBOX_WITH_TESTCASES
+#
+# Structure size testcase.
+#
+PROGRAMS += tstShOpenGL tstOGLSample
+
+tstShOpenGL_TEMPLATE = VBOXW32GUESTR3
+tstShOpenGL_DEFS     = VBOX_HGCM
+tstShOpenGL_SOURCES  = tstShOpenGL.cpp
+tstShOpenGL_LIBS     = $(PATH_LIB)/VBoxOGL.lib
+
+
+tstOGLSample_TEMPLATE = VBOXW32GUESTR3
+tstOGLSample_DEFS     = 
+tstOGLSample_SOURCES  = tstOGLSample.cpp
+tstOGLSample_LIBS     = $(PATH_LIB)/VBoxOGL.lib
+
+tstOGLSample_LIBS.win = \
+                       $(PATH_LIB)/VBoxOGL.lib
+###        $(PATH_SDK_W2K3DDKX86_LIB)/opengl32.lib
+
+endif # VBOX_WITH_TESTCASES
+
+include $(PATH_KBUILD)/subfooter.kmk
+
Index: /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/test/tstOGLSample.cpp
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/test/tstOGLSample.cpp	(revision 3339)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/test/tstOGLSample.cpp	(revision 3339)
@@ -0,0 +1,185 @@
+//
+// GLSAMPLE.CPP
+//  by Blaine Hodge
+//
+
+// Includes
+
+#include <windows.h>
+#include <gl/gl.h>
+#include <stdio.h>
+
+// Function Declarations
+
+LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
+void EnableOpenGL(HWND hWnd, HDC * hDC, HGLRC * hRC);
+void DisableOpenGL(HWND hWnd, HDC hDC, HGLRC hRC);
+
+// WinMain
+
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, 
+				   LPSTR lpCmdLine, int iCmdShow)
+{
+	WNDCLASS wc;
+	HWND hWnd;
+	HDC hDC;
+	HGLRC hRC;
+	MSG msg;
+	BOOL quit = FALSE;
+	float theta = 0.0f;
+	
+	// register window class
+	wc.style = CS_OWNDC;
+	wc.lpfnWndProc = WndProc;
+	wc.cbClsExtra = 0;
+	wc.cbWndExtra = 0;
+	wc.hInstance = hInstance;
+	wc.hIcon = LoadIcon( NULL, IDI_APPLICATION );
+	wc.hCursor = LoadCursor( NULL, IDC_ARROW );
+	wc.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH );
+	wc.lpszMenuName = NULL;
+	wc.lpszClassName = "GLSample";
+	RegisterClass( &wc );
+	
+	// create main window
+	hWnd = CreateWindow( 
+		"GLSample", "OpenGL Sample", 
+		WS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE,
+		0, 0, 300, 300,
+		NULL, NULL, hInstance, NULL );
+	
+	// enable OpenGL for the window
+	EnableOpenGL( hWnd, &hDC, &hRC );
+	
+	// program main loop
+	while ( !quit )
+	{
+		
+		// check for messages
+		if ( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE )  )
+		{
+			
+			// handle or dispatch messages
+			if ( msg.message == WM_QUIT ) 
+			{
+				quit = TRUE;
+			} 
+			else 
+			{
+				TranslateMessage( &msg );
+				DispatchMessage( &msg );
+			}
+			
+		} 
+		else 
+		{
+			
+			// OpenGL animation code goes here
+			
+			glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
+			glClear( GL_COLOR_BUFFER_BIT );
+			
+			glPushMatrix();
+			glRotatef( theta, 0.0f, 0.0f, 1.0f );
+			glBegin( GL_TRIANGLES );
+			glColor3f( 1.0f, 0.0f, 0.0f ); glVertex2f( 0.0f, 1.0f );
+			glColor3f( 0.0f, 1.0f, 0.0f ); glVertex2f( 0.87f, -0.5f );
+			glColor3f( 0.0f, 0.0f, 1.0f ); glVertex2f( -0.87f, -0.5f );
+			glEnd();
+			glPopMatrix();
+			
+			SwapBuffers( hDC );
+			
+			theta += 1.0f;
+			
+		}
+		
+	}
+
+        printf("GL_VENDOR       %s\n", glGetString(GL_VENDOR));
+        printf("GL_RENDERER     %s\n", glGetString(GL_RENDERER));
+        printf("GL_VERSION      %s\n", glGetString(GL_VERSION));
+        printf("GL_EXTENSIONS   %s\n", glGetString(GL_EXTENSIONS));
+	
+	// shutdown OpenGL
+	DisableOpenGL( hWnd, hDC, hRC );
+	
+	// destroy the window explicitly
+	DestroyWindow( hWnd );
+	
+	return msg.wParam;
+	
+}
+
+// Window Procedure
+
+LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+	
+	switch (message)
+	{
+		
+	case WM_CREATE:
+		return 0;
+		
+	case WM_CLOSE:
+		PostQuitMessage( 0 );
+		return 0;
+		
+	case WM_DESTROY:
+		return 0;
+		
+	case WM_KEYDOWN:
+		switch ( wParam )
+		{
+			
+		case VK_ESCAPE:
+			PostQuitMessage(0);
+			return 0;
+			
+		}
+		return 0;
+	
+	default:
+		return DefWindowProc( hWnd, message, wParam, lParam );
+			
+	}
+	
+}
+
+// Enable OpenGL
+
+void EnableOpenGL(HWND hWnd, HDC * hDC, HGLRC * hRC)
+{
+	PIXELFORMATDESCRIPTOR pfd;
+	int format;
+	
+	// get the device context (DC)
+	*hDC = GetDC( hWnd );
+	
+	// set the pixel format for the DC
+	ZeroMemory( &pfd, sizeof( pfd ) );
+	pfd.nSize = sizeof( pfd );
+	pfd.nVersion = 1;
+	pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
+	pfd.iPixelType = PFD_TYPE_RGBA;
+	pfd.cColorBits = 24;
+	pfd.cDepthBits = 16;
+	pfd.iLayerType = PFD_MAIN_PLANE;
+	format = ChoosePixelFormat( *hDC, &pfd );
+	SetPixelFormat( *hDC, format, &pfd );
+	
+	// create and enable the render context (RC)
+	*hRC = wglCreateContext( *hDC );
+	wglMakeCurrent( *hDC, *hRC );
+	
+}
+
+// Disable OpenGL
+
+void DisableOpenGL(HWND hWnd, HDC hDC, HGLRC hRC)
+{
+	wglMakeCurrent( NULL, NULL );
+	wglDeleteContext( hRC );
+	ReleaseDC( hWnd, hDC );
+}
Index: /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/test/tstShOpenGL.cpp
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/test/tstShOpenGL.cpp	(revision 3339)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/test/tstShOpenGL.cpp	(revision 3339)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2006-2007 innotek GmbH
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation,
+ * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+ * distribution. VirtualBox OSE is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * If you received this file as part of a commercial VirtualBox
+ * distribution, then only the terms of your commercial VirtualBox
+ * license agreement apply instead of the previous paragraph.
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <windows.h>
+#include <GL/gl.h>
+#include <stdio.h>
+
+int main(int argc, char **argv)
+{
+    printf("GL_VENDOR       %s\n", glGetString(GL_VENDOR));
+    printf("GL_RENDERER     %s\n", glGetString(GL_RENDERER));
+    printf("GL_VERSION      %s\n", glGetString(GL_VERSION));
+    printf("GL_EXTENSIONS   %s\n", glGetString(GL_EXTENSIONS));
+
+    glEnable(GL_BLEND);
+    glFlush();
+    return 0;
+}
+
