Browse Source

*** empty log message ***

Dave Schuyler 24 years ago
parent
commit
27af61d92f

+ 26 - 0
panda/metalibs/pandacr/Sources.pp

@@ -0,0 +1,26 @@
+// DIR_TYPE "metalib" indicates we are building a shared library that
+// consists mostly of references to other shared libraries.  Under
+// Windows, this directly produces a DLL (as opposed to the regular
+// src libraries, which don't produce anything but a pile of OBJ files
+// under Windows).
+
+#define DIR_TYPE metalib
+#define BUILDING_DLL BUILDING_PANDACR
+#define DIRECTORY_IF_CHROMIUM yes
+
+//#define USE_CHROMIUM yes
+
+#define COMPONENT_LIBS \
+    crgsg wcrdisplay
+
+#define LOCAL_LIBS gsgbase display express
+#define OTHER_LIBS dtoolconfig dtool
+//#define WIN_SYS_LIBS $[WIN_SYS_LIBS] 
+
+#begin metalib_target
+  #define TARGET pandacr
+
+  #define SOURCES pandacr.cxx pandacr.h
+  #define INSTALL_HEADERS pandacr.h
+
+#end metalib_target

+ 27 - 0
panda/metalibs/pandacr/pandacr.cxx

@@ -0,0 +1,27 @@
+// Filename: pandacr.cxx
+// Created by:  skyler, baseed on pandagl
+// 
+////////////////////////////////////////////////////////////////////
+
+#include "pandacr.h"
+
+#include <config_crgsg.h>
+#ifdef HAVE_WCR
+#include <config_wcrdisplay.h>
+#endif
+
+////////////////////////////////////////////////////////////////////
+//     Function: init_libpandacr
+//  Description: Initializes the library.  This must be called at
+//               least once before any of the functions or classes in
+//               this library can be used.  Normally it will be
+//               called by the static initializers and need not be
+//               called explicitly, but special cases exist.
+////////////////////////////////////////////////////////////////////
+void
+init_libpandacr() {
+  init_libcrgsg();
+#ifdef HAVE_WCR
+  init_libwcrdisplay();
+#endif
+}

+ 14 - 0
panda/metalibs/pandacr/pandacr.h

@@ -0,0 +1,14 @@
+// Filename: pandacr.h
+// Created by:  skyler, baseed on pandagl
+// 
+////////////////////////////////////////////////////////////////////
+
+#ifndef PANDACR_H
+#define PANDACR_H
+
+#include <pandabase.h>
+
+EXPCL_PANDACR void init_libpandacr();
+
+#endif
+

+ 30 - 0
panda/src/crgsg/Sources.pp

@@ -0,0 +1,30 @@
+#define DIRECTORY_IF_CHROMIUM yes
+
+#define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \
+                   dtoolutil:c dtoolbase:c dtool:m
+#define USE_CHROMIUM yes
+
+#begin lib_target
+  #define TARGET crgsg
+  #define LOCAL_LIBS \
+    pandabase cull gsgmisc gsgbase gobj sgattrib sgraphutil graph display light \
+    putil linmath sgraph mathutil pnmimage
+
+  #define COMBINED_SOURCES $[TARGET]_composite1.cxx 
+
+  #define SOURCES \
+     crGraphicsStateGuardian.cxx \
+     config_crgsg.h crGraphicsStateGuardian.I \
+     crGraphicsStateGuardian.h crSavedFrameBuffer.I \
+     crSavedFrameBuffer.h crTextureContext.I crext.h \
+     crGeomNodeContext.I crGeomNodeContext.h  crTextureContext.h
+
+  #define INCLUDED_SOURCES \
+     config_crgsg.cxx crSavedFrameBuffer.cxx \
+     crGeomNodeContext.cxx crTextureContext.cxx 
+
+  #define INSTALL_HEADERS \
+    config_crgsg.h crGraphicsStateGuardian.I crGraphicsStateGuardian.h
+
+#end lib_target
+

+ 7 - 0
panda/src/crgsg/clean

@@ -0,0 +1,7 @@
+#!bash
+
+rm *.I
+rm *.cxx
+rm *.h
+rm pp.dep
+rm Makefile

+ 127 - 0
panda/src/crgsg/config_crgsg.cxx

@@ -0,0 +1,127 @@
+// Filename: config_crgsg.cxx
+// Created by:  drose (06Oct99)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://www.panda3d.org/license.txt .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+#include "config_crgsg.h"
+#include "crGraphicsStateGuardian.h"
+#include "crSavedFrameBuffer.h"
+#include "crTextureContext.h"
+#include "crGeomNodeContext.h"
+
+#include <dconfig.h>
+
+Configure(config_crgsg);
+NotifyCategoryDef(crgsg, ":display:gsg");
+
+// Configure this variable true to cause the CRGSG to show each
+// transform space it renders by drawing a little unit axis.  This
+// cannot be enabled when the player is compiled in NDEBUG mode.
+bool cr_show_transforms = config_crgsg.GetBool("cr-show-transforms", false);
+
+// Configure this true to chromium.Hint the textures into the cheapest
+// possible mode.
+bool cr_cheap_textures = config_crgsg.GetBool("cr-cheap-textures", false);
+
+// Configure this true to perform a cull traversal over the geometry
+// by default, false otherwise.  The cull traversal provides support
+// for state-sorting, z-sorting, and binning.
+bool cr_cull_traversal = config_crgsg.GetBool("cr-cull-traversal", true);
+
+// Configure this true to disable the use of mipmapping in the
+// renderer.
+bool cr_ignore_mipmaps = config_crgsg.GetBool("cr-ignore-mipmaps", false);
+
+// Configure this true to enable full trilinear mipmapping on every
+// texture, whether it asks for it or not.
+bool cr_force_mipmaps = config_crgsg.GetBool("cr-force-mipmaps", false);
+
+// Configure this true to cause mipmaps to be rendered with phony
+// colors, using mipmap_level_*.rgb if they are available.
+bool cr_show_mipmaps = config_crgsg.GetBool("cr-show-mipmaps", false);
+
+// Configure this true to cause the generated mipmap images to be
+// written out to image files on the disk as they are generated.
+bool cr_save_mipmaps = config_crgsg.GetBool("cr-save-mipmaps", false);
+
+// Configure this true to cause all lighting normals to automatically
+// be normalized by the graphics hardware before rendering.  This is
+// necessary if you intend to render things under scale transforms and
+// expect lighting to work correctly.  Maybe one day there will be
+// another way to set this at runtime, instead of only as a configure
+// variable.
+bool cr_auto_normalize_lighting = config_crgsg.GetBool("auto-normalize-lighting", false);
+
+// Configure this true to indicate the current version of GL fully
+// supports textures with B, G, R ordering; false if it only supports
+// R, G, B.  false will always work, but true might be faster if the
+// implementation supports it.
+#ifdef GL_BGR
+bool cr_supports_bgr = config_crgsg.GetBool("cr-supports-bgr", false);
+#else
+// If it's not even defined, we can't use it.
+bool cr_supports_bgr = false;
+#endif  // GL_BGR
+
+CRDecalType cr_decal_type = GDT_offset;
+
+static CRDecalType
+parse_decal_type(const string &type) {
+  if (type == "mask") {
+    return GDT_mask;
+  } else if (type == "blend") {
+    return GDT_blend;
+  } else if (type == "offset") {
+    return GDT_offset;
+  }
+  crgsg_cat.error() << "Invalid cr-decal-type: " << type << "\n";
+  return GDT_offset;
+}
+
+ConfigureFn(config_crgsg) {
+  init_libcrgsg();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: init_libcrgsg
+//  Description: Initializes the library.  This must be called at
+//               least once before any of the functions or classes in
+//               this library can be used.  Normally it will be
+//               called by the static initializers and need not be
+//               called explicitly, but special cases exist.
+////////////////////////////////////////////////////////////////////
+void
+init_libcrgsg() {
+  static bool initialized = false;
+  if (initialized) {
+    return;
+  }
+  initialized = true;
+
+  string decal_type = config_crgsg.GetString("cr-decal-type", "");
+  if (!decal_type.empty()) {
+    cr_decal_type = parse_decal_type(decal_type);
+  }
+
+  CRGraphicsStateGuardian::init_type();
+  CRSavedFrameBuffer::init_type();
+  CRTextureContext::init_type();
+  CRGeomNodeContext::init_type();
+
+  GraphicsStateGuardian::get_factory().register_factory
+    (CRGraphicsStateGuardian::get_class_type(),
+     CRGraphicsStateGuardian::make_GlGraphicsStateGuardian);
+}

+ 48 - 0
panda/src/crgsg/config_crgsg.h

@@ -0,0 +1,48 @@
+// Filename: config_crgsg.h
+// Created by:  drose (06Oct99)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://www.panda3d.org/license.txt .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+#ifndef CONFIG_GLGSG_H
+#define CONFIG_GLGSG_H
+
+#include <pandabase.h>
+#include <notifyCategoryProxy.h>
+
+NotifyCategoryDecl(crgsg, EXPCL_PANDACR, EXPTP_PANDACR);
+
+extern bool cr_show_transforms;
+extern bool cr_cheap_textures;
+extern bool cr_cull_traversal;
+extern bool cr_ignore_mipmaps;
+extern bool cr_force_mipmaps;
+extern bool cr_show_mipmaps;
+extern bool cr_save_mipmaps;
+extern bool cr_auto_normalize_lighting;
+extern bool cr_supports_bgr;
+
+// Ways to implement decals.
+enum CRDecalType {
+  GDT_mask,   // GL 1.0 style, involving three steps
+  GDT_blend,  // As above, but slower; a hack for broken nVidia driver
+  GDT_offset  // The fastest, using GL 1.1 style chromium.PolygonOffset
+};
+extern CRDecalType cr_decal_type;
+
+
+extern EXPCL_PANDACR void init_libcrgsg();
+
+#endif

+ 31 - 0
panda/src/crgsg/crGeomNodeContext.I

@@ -0,0 +1,31 @@
+// Filename: chromium.GeomNodeContext.I
+// Created by:  drose (12Jun01)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://www.panda3d.org/license.txt .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGeomNodeContext::Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE CRGeomNodeContext::
+CRGeomNodeContext(GeomNode *node) :
+  GeomNodeContext(node)
+{
+  _index = 0;
+  DO_PSTATS_STUFF(_num_verts = 0;)
+}

+ 21 - 0
panda/src/crgsg/crGeomNodeContext.cxx

@@ -0,0 +1,21 @@
+// Filename: chromium.GeomNodeContext.cxx
+// Created by:  drose (12Jun01)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://www.panda3d.org/license.txt .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+#include "crGeomNodeContext.h"
+
+TypeHandle CRGeomNodeContext::_type_handle;

+ 89 - 0
panda/src/crgsg/crGeomNodeContext.h

@@ -0,0 +1,89 @@
+// Filename: chromium.GeomNodeContext.h
+// Created by:  drose (12Jun01)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://www.panda3d.org/license.txt .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+#ifndef CRGEOMNODECONTEXT_H
+#define CRGEOMNODECONTEXT_H
+
+#include <pandabase.h>
+
+#ifdef WIN32_VC
+// Must include windows.h before gl.h on NT
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#undef WIN32_LEAN_AND_MEAN
+#endif
+
+
+#include <GL/gl.h>
+// Chromium specific
+#ifdef WIN32_VC // [
+#define WINDOWS 1
+#endif //]
+#include "cr_glwrapper.h"
+#include "cr_applications.h"
+#include "cr_spu.h"
+///////#include "cr_glstate.h"
+extern SPUDispatchTable chromium;
+
+#include <geomNodeContext.h>
+#include <geomNode.h>
+#include "pvector.h"
+
+////////////////////////////////////////////////////////////////////
+//       Class : CRGeomNodeContext
+// Description :
+////////////////////////////////////////////////////////////////////
+class EXPCL_PANDACR CRGeomNodeContext : public GeomNodeContext {
+public:
+  INLINE CRGeomNodeContext(GeomNode *node);
+
+  // The GL display list index that draws the contents of this
+  // GeomNode.
+  GLuint _index;
+
+  // A list of the dynamic Geoms within the GeomNode; these aren't
+  // part of the above display list.
+  typedef pvector<PT(dDrawable) > Geoms;
+  Geoms _dynamic_geoms;
+
+  // The number of vertices represented by the display list.  This is
+  // strictly for the benefit of PStats reporting.
+  DO_PSTATS_STUFF(int _num_verts;)
+
+public:
+  static TypeHandle get_class_type() {
+    return _type_handle;
+  }
+  static void init_type() {
+    GeomNodeContext::init_type();
+    register_type(_type_handle, "CRGeomNodeContext",
+                  GeomNodeContext::get_class_type());
+  }
+  virtual TypeHandle get_type() const {
+    return get_class_type();
+  }
+  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
+
+private:
+  static TypeHandle _type_handle;
+};
+
+#include "crGeomNodeContext.I"
+
+#endif
+

+ 1200 - 0
panda/src/crgsg/crGraphicsStateGuardian.I

@@ -0,0 +1,1200 @@
+// Filename: chromium.GraphicsStateGuardian.I
+// Created by:  drose (02Feb99)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://www.panda3d.org/license.txt .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+#include "config_crgsg.h"
+
+#include <graphicsWindow.h>
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::LightInfo::Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE CRGraphicsStateGuardian::LightInfo::
+LightInfo() {
+  _light = (Light *)NULL;
+  _enabled = false;
+  _next_enabled = false;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::activate
+//       Access: Public
+//  Description: Sets this context to be the active context for future
+//               GL commands.
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+activate() {
+  // This operation seems to be incredibly expensive on some
+  // platforms--particularly for the NVidia drivers under Linux.  It
+  // doesn't seem to check if we already had the context current
+  // before we switch contexts.  For now, we'll limit our use of this
+  // function.
+
+  _win->make_current();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::call_glClearColor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+call_glClearColor(GLclampf red, GLclampf green, GLclampf blue,
+                  GLclampf alpha) {
+  if (red != _clear_color_red ||
+      green != _clear_color_green ||
+      blue != _clear_color_blue ||
+      alpha != _clear_color_alpha) {
+    chromium.ClearColor(red, green, blue, alpha);
+    _clear_color_red = red;
+    _clear_color_green = green;
+    _clear_color_blue = blue;
+    _clear_color_alpha = alpha;
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::call_glClearDepth
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+call_glClearDepth(GLclampd depth) {
+  if (depth != _clear_depth) {
+#ifdef GSG_VERBOSE
+    crgsg_cat.debug()
+      << "crClearDepth(" << (double)depth << ")" << endl;
+#endif
+    chromium.ClearDepth(depth);
+    _clear_depth = depth;
+  }
+}
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::call_glClearStencil
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+call_glClearStencil(GLint s) {
+  if (s != _clear_stencil) {
+    chromium.ClearStencil(s);
+    _clear_stencil = s;
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::call_glClearAccum
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+call_glClearAccum(GLclampf red, GLclampf green, GLclampf blue,
+                  GLclampf alpha) {
+  if (red != _clear_accum_red ||
+      green != _clear_accum_green ||
+      blue != _clear_accum_blue ||
+      alpha != _clear_accum_alpha) {
+    chromium.ClearAccum(red, green, blue, alpha);
+    _clear_accum_red = red;
+    _clear_accum_green = green;
+    _clear_accum_blue = blue;
+    _clear_accum_alpha = alpha;
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::call_glDrawBuffer
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+call_glDrawBuffer(GLenum mode) {
+  if (mode != _draw_buffer_mode) {
+#ifdef GSG_VERBOSE
+    crgsg_cat.debug() << "crDrawBuffer(";
+    switch (mode) {
+    case GL_FRONT:
+      crgsg_cat.debug(false) << "GL_FRONT)";
+      break;
+    case GL_BACK:
+      crgsg_cat.debug(false) << "GL_BACK)";
+      break;
+    case GL_RIGHT:
+      crgsg_cat.debug(false) << "GL_RIGHT)";
+      break;
+    case GL_LEFT:
+      crgsg_cat.debug(false) << "GL_LEFT)";
+      break;
+    case GL_FRONT_RIGHT:
+      crgsg_cat.debug(false) << "GL_FRONT_RIGHT)";
+      break;
+    case GL_FRONT_LEFT:
+      crgsg_cat.debug(false) << "GL_FRONT_LEFT)";
+      break;
+    case GL_BACK_RIGHT:
+      crgsg_cat.debug(false) << "GL_BACK_RIGHT)";
+      break;
+    case GL_BACK_LEFT:
+      crgsg_cat.debug(false) << "GL_BACK_LEFT)";
+      break;
+    case GL_FRONT_AND_BACK:
+      crgsg_cat.debug(false) << "GL_FRONT_AND_BACK)";
+      break;
+    }
+    crgsg_cat.debug(false) << endl;
+#endif
+    chromium.DrawBuffer(mode);
+    _draw_buffer_mode = mode;
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::call_glReadBuffer
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+call_glReadBuffer(GLenum mode) {
+  if (mode != _read_buffer_mode) {
+    chromium.ReadBuffer(mode);
+    _read_buffer_mode = mode;
+  }
+}
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::call_glShadeModel
+//       Access:
+//  Description: Set the shading model to be either GL_FLAT or GL_SMOOTH
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+call_glShadeModel(GLenum mode) {
+  if (_shade_model_mode != mode) {
+    chromium.ShadeModel(mode);
+    _shade_model_mode = mode;
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::call_glScissor
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+call_glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+    if ( _scissor_x != x || _scissor_y != y ||
+        _scissor_width != width || _scissor_height != height )
+    {
+        _scissor_x = x; _scissor_y = y;
+        _scissor_width = width; _scissor_height = height;
+        chromium.Scissor( x, y, width, height );
+    }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::call_glViewport
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+call_glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+    if ( _viewport_x != x || _viewport_y != y ||
+        _viewport_width != width || _viewport_height != height )
+    {
+        _viewport_x = x; _viewport_y = y;
+        _viewport_width = width; _viewport_height = height;
+        chromium.Viewport( x, y, width, height );
+    }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::call_glLightModelAmbient
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+call_glLightModelAmbient( const Colorf& color )
+{
+  if (_lmodel_ambient != color) {
+    _lmodel_ambient = color;
+#ifdef GSG_VERBOSE
+    crgsg_cat.debug()
+      << "crLightModel(GL_LIGHT_MODEL_AMBIENT, " << color << ")" << endl;
+#endif
+    chromium.LightModelfv(GL_LIGHT_MODEL_AMBIENT, color.get_data());
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::call_glLightModelLocal
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+call_glLightModelLocal(GLboolean local)
+{
+    if ( _lmodel_local != local )
+    {
+        _lmodel_local = local;
+        chromium.LightModeli( GL_LIGHT_MODEL_LOCAL_VIEWER, local );
+    }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::call_glLightModelLocal
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+call_glLightModelTwoSide(GLboolean twoside)
+{
+  if (_lmodel_twoside != twoside) {
+    _lmodel_twoside = twoside;
+#ifdef GSG_VERBOSE
+    crgsg_cat.debug()
+      << "crLightModel(GL_LIGHT_MODEL_TWO_SIDE, " << (int)twoside << ")" << endl;
+#endif
+    chromium.LightModeli(GL_LIGHT_MODEL_TWO_SIDE, twoside);
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::call_glStencilFunc
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+call_glStencilFunc(GLenum func,GLint ref,GLuint mask) {
+
+#ifdef GSG_VERBOSE
+    crgsg_cat.debug() << "crStencilFunc(";
+    switch (func) {
+    case GL_NEVER:
+      crgsg_cat.debug(false) << "GL_NEVER, ";
+      break;
+    case GL_LESS:
+      crgsg_cat.debug(false) << "GL_LESS, ";
+      break;
+    case GL_EQUAL:
+      crgsg_cat.debug(false) << "GL_EQUAL, ";
+      break;
+    case GL_LEQUAL:
+      crgsg_cat.debug(false) << "GL_LEQUAL, ";
+      break;
+    case GL_GREATER:
+      crgsg_cat.debug(false) << "GL_GREATER, ";
+      break;
+    case GL_NOTEQUAL:
+      crgsg_cat.debug(false) << "GL_NOTEQUAL, ";
+      break;
+    case GL_GEQUAL:
+      crgsg_cat.debug(false) << "GL_GEQUAL, ";
+      break;
+    case GL_ALWAYS:
+      crgsg_cat.debug(false) << "GL_ALWAYS, ";
+      break;
+    default:
+      crgsg_cat.debug(false) << "unknown, ";
+      break;
+    }
+    crgsg_cat.debug(false) << ref << mask << ")\n";
+#endif
+    chromium.StencilFunc(func, ref, mask);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::call_glStencilOp
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+call_glStencilOp(GLenum fail,GLenum zfail,GLenum zpass) {
+#ifdef GSG_VERBOSE
+    crgsg_cat.debug() << "crStencilOp(fail, zfail, ";
+    switch (op) {
+    case GL_KEEP:
+      crgsg_cat.debug(false) << "GL_KEEP)";
+      break;
+    case GL_ZERO:
+      crgsg_cat.debug(false) << "GL_ZERO)";
+      break;
+    case GL_REPLACE:
+      crgsg_cat.debug(false) << "GL_REPLACE)";
+      break;
+    case GL_INCR:
+      crgsg_cat.debug(false) << "GL_INCR)";
+      break;
+    case GL_DECR:
+      crgsg_cat.debug(false) << "GL_DECR)";
+      break;
+    case GL_INVERT:
+      crgsg_cat.debug(false) << "GL_INVERT)";
+      break;
+    default:
+      crgsg_cat.debug(false) << "unknown)";
+      break;
+    }
+    crgsg_cat.debug(false) << endl;
+#endif
+    chromium.StencilOp(fail,zfail,zpass);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::call_glLineWidth
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+call_glLineWidth(GLfloat width) {
+  if (_line_width != width) {
+    _line_width = width;
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug()
+    << "crLineWidth(" << width << ")" << endl;
+#endif
+    chromium.LineWidth(width);
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::call_glPointSize
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+call_glPointSize(GLfloat size) {
+  if (_point_size != size) {
+    _point_size = size;
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug()
+    << "crPointSize(" << size << ")" << endl;
+#endif
+    chromium.PointSize(size);
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::call_glBlendFunc
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+call_glBlendFunc(GLenum sfunc, GLenum dfunc) {
+  if (_blend_source_func != sfunc || _blend_dest_func != dfunc) {
+    _blend_source_func = sfunc;
+    _blend_dest_func = dfunc;
+#ifdef GSG_VERBOSE
+    crgsg_cat.debug() << "crBlendFunc(";
+    switch (sfunc) {
+    case GL_ZERO:
+      crgsg_cat.debug(false) << "GL_ZERO, ";
+      break;
+    case GL_ONE:
+      crgsg_cat.debug(false) << "GL_ONE, ";
+      break;
+    case GL_DST_COLOR:
+      crgsg_cat.debug(false) << "GL_DST_COLOR, ";
+      break;
+    case GL_ONE_MINUS_DST_COLOR:
+      crgsg_cat.debug(false) << "GL_ONE_MINUS_DST_COLOR, ";
+      break;
+    case GL_SRC_ALPHA:
+      crgsg_cat.debug(false) << "GL_SRC_ALPHA, ";
+      break;
+    case GL_ONE_MINUS_SRC_ALPHA:
+      crgsg_cat.debug(false) << "GL_ONE_MINUS_SRC_ALPHA, ";
+      break;
+    case GL_DST_ALPHA:
+      crgsg_cat.debug(false) << "GL_DST_ALPHA, ";
+      break;
+    case GL_ONE_MINUS_DST_ALPHA:
+      crgsg_cat.debug(false) << "GL_ONE_MINUS_DST_ALPHA, ";
+      break;
+    case GL_SRC_ALPHA_SATURATE:
+
+      crgsg_cat.debug(false) << "GL_SRC_ALPHA_SATURATE, ";
+      break;
+    default:
+      crgsg_cat.debug(false) << "unknown, ";
+      break;
+    }
+    switch (dfunc) {
+    case GL_ZERO:
+      crgsg_cat.debug(false) << "GL_ZERO)";
+      break;
+    case GL_ONE:
+      crgsg_cat.debug(false) << "GL_ONE)";
+      break;
+    case GL_SRC_COLOR:
+      crgsg_cat.debug(false) << "GL_SRC_COLOR)";
+      break;
+    case GL_ONE_MINUS_SRC_COLOR:
+      crgsg_cat.debug(false) << "GL_ONE_MINUS_SRC_COLOR)";
+      break;
+    case GL_SRC_ALPHA:
+      crgsg_cat.debug(false) << "GL_SRC_ALPHA)";
+      break;
+    case GL_ONE_MINUS_SRC_ALPHA:
+      crgsg_cat.debug(false) << "GL_ONE_MINUS_SRC_ALPHA)";
+      break;
+    case GL_DST_ALPHA:
+      crgsg_cat.debug(false) << "GL_DST_ALPHA)";
+      break;
+    case GL_ONE_MINUS_DST_ALPHA:
+      crgsg_cat.debug(false) << "GL_ONE_MINUS_DST_ALPHA)";
+      break;
+    default:
+      crgsg_cat.debug(false) << "unknown)";
+      break;
+    }
+    crgsg_cat.debug(false) << endl;
+#endif
+    chromium.BlendFunc(sfunc, dfunc);
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::call_glFogMode
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+call_glFogMode(GLint mode) {
+  if (_fog_mode != mode) {
+    _fog_mode = mode;
+#ifdef GSG_VERBOSE
+    crgsg_cat.debug() << "crFog(GL_FOG_MODE, ";
+    switch(mode) {
+    case GL_LINEAR:
+      crgsg_cat.debug(false) << "GL_LINEAR)" << endl;
+      break;
+    case GL_EXP:
+      crgsg_cat.debug(false) << "GL_EXP)" << endl;
+      break;
+    case GL_EXP2:
+      crgsg_cat.debug(false) << "GL_EXP2)" << endl;
+      break;
+#ifdef GL_FOG_FUNC_SGIS
+    case GL_FOG_FUNC_SGIS:
+      crgsg_cat.debug(false) << "GL_FOG_FUNC_SGIS)" << endl;
+      break;
+#endif
+    default:
+      crgsg_cat.debug(false) << "unknown)" << endl;
+      break;
+    }
+#endif
+    chromium.Fogi(GL_FOG_MODE, mode);
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::call_glFogStart
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+call_glFogStart(GLfloat start) {
+  if (_fog_start != start) {
+    _fog_start = start;
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug()
+    << "crFog(GL_FOG_START, " << start << ")" << endl;
+#endif
+    chromium.Fogf(GL_FOG_START, start);
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::call_glFogEnd
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+call_glFogEnd(GLfloat end) {
+  if (_fog_end != end) {
+    _fog_end = end;
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug()
+    << "crFog(GL_FOG_END, " << end << ")" << endl;
+#endif
+    chromium.Fogf(GL_FOG_END, end);
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::call_glFogDensity
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+call_glFogDensity(GLfloat density) {
+  if (_fog_density != density) {
+    _fog_density = density;
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug()
+    << "crFog(GL_FOG_DENSITY, " << density << ")" << endl;
+#endif
+    chromium.Fogf(GL_FOG_DENSITY, density);
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::call_glFogColor
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+call_glFogColor(const Colorf &color) {
+  if (_fog_color != color) {
+    _fog_color = color;
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug()
+    << "crFog(GL_FOG_COLOR, " << color << ")" << endl;
+#endif
+    chromium.Fogfv(GL_FOG_COLOR, color.get_data());
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::call_glAlphaFunc
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+call_glAlphaFunc(GLenum func, GLclampf ref) {
+  if (_alpha_func != func || _alpha_func_ref != ref) {
+    _alpha_func = func;
+    _alpha_func_ref = ref;
+#ifdef GSG_VERBOSE
+    crgsg_cat.debug() << "crAlphaFunc(";
+    switch (func) {
+    case GL_NEVER:
+      crgsg_cat.debug(false) << "GL_NEVER, ";
+      break;
+    case GL_LESS:
+      crgsg_cat.debug(false) << "GL_LESS, ";
+      break;
+    case GL_EQUAL:
+      crgsg_cat.debug(false) << "GL_EQUAL, ";
+      break;
+    case GL_LEQUAL:
+      crgsg_cat.debug(false) << "GL_LEQUAL, ";
+      break;
+    case GL_GREATER:
+      crgsg_cat.debug(false) << "GL_GREATER, ";
+      break;
+    case GL_NOTEQUAL:
+      crgsg_cat.debug(false) << "GL_NOTEQUAL, ";
+      break;
+    case GL_GEQUAL:
+      crgsg_cat.debug(false) << "GL_GEQUAL, ";
+      break;
+    case GL_ALWAYS:
+      crgsg_cat.debug(false) << "GL_ALWAYS, ";
+      break;
+    }
+    crgsg_cat.debug() << ref << ")" << endl;
+#endif
+    chromium.AlphaFunc(func, ref);
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::call_glPolygonMode
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+call_glPolygonMode(GLenum mode) {
+  if (_polygon_mode != mode) {
+    _polygon_mode = mode;
+#ifdef GSG_VERBOSE
+    crgsg_cat.debug() << "crPolygonMode(GL_BACK_AND_FRONT, ";
+    switch (mode) {
+    case GL_POINT:
+      crgsg_cat.debug(false) << "GL_POINT)" << endl;
+      break;
+    case GL_LINE:
+      crgsg_cat.debug(false) << "GL_LINE)" << endl;
+      break;
+    case GL_FILL:
+      crgsg_cat.debug(false) << "GL_FILL)" << endl;
+      break;
+    }
+#endif
+    chromium.PolygonMode(GL_FRONT_AND_BACK, mode);
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::set_pack_alignment
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+set_pack_alignment(GLint alignment) {
+  if (_pack_alignment != alignment) {
+    chromium.PixelStorei(GL_PACK_ALIGNMENT, alignment);
+    _pack_alignment = alignment;
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::set_unpack_alignment
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+set_unpack_alignment(GLint alignment) {
+  if (_unpack_alignment != alignment) {
+    chromium.PixelStorei(GL_UNPACK_ALIGNMENT, alignment);
+    _unpack_alignment = alignment;
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::enable_multisample
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+enable_multisample(bool val) {
+  if (_multisample_enabled != val) {
+    _multisample_enabled = val;
+    if (val) {
+#ifdef GL_MULTISAMPLE_SGIS
+      chromium.Enable(GL_MULTISAMPLE_SGIS);
+#endif
+      chromium.Hint(GL_POINT_SMOOTH_HINT, GL_NICEST);
+    } else {
+#ifdef GL_MULTISAMPLE_SGIS
+      chromium.Disable(GL_MULTISAMPLE_SGIS);
+#endif
+      chromium.Hint(GL_POINT_SMOOTH_HINT, GL_FASTEST);
+    }
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::enable_line_smooth
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+enable_line_smooth(bool val) {
+  if (_line_smooth_enabled != val) {
+    _line_smooth_enabled = val;
+    if (val) {
+      chromium.Enable(GL_LINE_SMOOTH);
+      chromium.Hint(GL_LINE_SMOOTH_HINT, GL_FASTEST);
+    } else {
+      chromium.Disable(GL_LINE_SMOOTH);
+    }
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::enable_point_smooth
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+enable_point_smooth(bool val) {
+  if (_point_smooth_enabled != val) {
+    _point_smooth_enabled = val;
+    if (val) {
+      chromium.Enable(GL_POINT_SMOOTH);
+      chromium.Hint(GL_POINT_SMOOTH_HINT, GL_NICEST);
+    } else {
+      chromium.Disable(GL_POINT_SMOOTH);
+      chromium.Hint(GL_POINT_SMOOTH_HINT, GL_FASTEST);
+    }
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::enable_lighting
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+enable_lighting(bool val) {
+  if (_lighting_enabled != val) {
+    _lighting_enabled = val;
+    if (val) {
+#ifdef GSG_VERBOSE
+      crgsg_cat.debug()
+        << "crEnable(GL_LIGHTING)" << endl;
+#endif
+      chromium.Enable(GL_LIGHTING);
+      _lighting_enabled_this_frame = true;
+    } else {
+#ifdef GSG_VERBOSE
+      crgsg_cat.debug()
+        << "crDisable(GL_LIGHTING)" << endl;
+#endif
+      chromium.Disable(GL_LIGHTING);
+    }
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::enable_dither
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+enable_dither(bool val) {
+  if (_dither_enabled != val) {
+    _dither_enabled = val;
+    if (val) {
+#ifdef GSG_VERBOSE
+      crgsg_cat.debug()
+        << "crEnable(GL_DITHER)" << endl;
+#endif
+      chromium.Enable(GL_DITHER);
+    } else {
+#ifdef GSG_VERBOSE
+      crgsg_cat.debug()
+        << "crDisable(GL_DITHER)" << endl;
+#endif
+      chromium.Disable(GL_DITHER);
+    }
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::enable_stencil_test
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+enable_stencil_test(bool val) {
+  if (_stencil_test_enabled != val) {
+    _stencil_test_enabled = val;
+    if (val) {
+#ifdef GSG_VERBOSE
+      crgsg_cat.debug()
+        << "crEnable(GL_STENCIL_TEST)" << endl;
+#endif
+      chromium.Enable(GL_STENCIL_TEST);
+    } else {
+#ifdef GSG_VERBOSE
+      crgsg_cat.debug()
+        << "crDisable(GL_STENCIL_TEST)" << endl;
+#endif
+      chromium.Disable(GL_STENCIL_TEST);
+    }
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::enable_light
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::enable_light(int light, bool val)
+{
+    if ( _light_info[light]._enabled != val )
+    {
+        _light_info[light]._enabled = val;
+        if ( val )
+        {
+#ifdef GSG_VERBOSE
+          crgsg_cat.debug()
+            << "crEnable(GL_LIGHT" << light << ")" << endl;
+#endif
+            chromium.Enable( get_light_id( light ) );
+        }
+        else
+        {
+#ifdef GSG_VERBOSE
+          crgsg_cat.debug()
+            << "crDisable(GL_LIGHT" << light << ")" << endl;
+#endif
+            chromium.Disable( get_light_id( light ) );
+        }
+    }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::enable_texturing
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+enable_texturing(bool val) {
+  if (_texturing_enabled != val) {
+    _texturing_enabled = val;
+    if (val) {
+#ifdef GSG_VERBOSE
+      crgsg_cat.debug()
+        << "crEnable(GL_TEXTURE_2D)" << endl;
+#endif
+      chromium.Enable(GL_TEXTURE_2D);
+    } else {
+#ifdef GSG_VERBOSE
+      crgsg_cat.debug()
+        << "crDisable(GL_TEXTURE_2D)" << endl;
+#endif
+      chromium.Disable(GL_TEXTURE_2D);
+    }
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::enable_scissor
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+enable_scissor(bool val)
+{
+    if ( _scissor_enabled != val ) {
+        _scissor_enabled = val;
+        if ( val )
+            chromium.Enable( GL_SCISSOR_TEST );
+        else
+            chromium.Disable( GL_SCISSOR_TEST );
+    }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::enable_clip_plane
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+enable_clip_plane(int clip_plane, bool val) {
+  if (_clip_plane_enabled[clip_plane] != val) {
+    _clip_plane_enabled[clip_plane] = val;
+    if (val) {
+#ifdef GSG_VERBOSE
+      crgsg_cat.debug()
+        << "crEnable(GL_CLIP_PLANE_" << clip_plane << ")" << endl;
+#endif
+      chromium.Enable(get_clip_plane_id(clip_plane));
+    } else {
+#ifdef GSG_VERBOSE
+      crgsg_cat.debug()
+        << "crDisable(GL_CLIP_PLANE_" << clip_plane << ")" << endl;
+#endif
+      chromium.Disable(get_clip_plane_id(clip_plane));
+    }
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::enable_multisample_alpha_one
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+enable_multisample_alpha_one(bool val) {
+  if (_multisample_alpha_one_enabled != val) {
+    _multisample_alpha_one_enabled = val;
+#ifdef GL_SAMPLE_ALPHA_TO_ONE_SGIS
+    if (val) {
+#ifdef GSG_VERBOSE
+      crgsg_cat.debug()
+        << "crEnable(GL_SAMPLE_ALPHA_TO_ONE_SGIS)" << endl;
+#endif
+      chromium.Enable(GL_SAMPLE_ALPHA_TO_ONE_SGIS);
+    } else {
+#ifdef GSG_VERBOSE
+      crgsg_cat.debug()
+        << "crDisable(GL_SAMPLE_ALPHA_TO_ONE_SGIS)" << endl;
+#endif
+      chromium.Disable(GL_SAMPLE_ALPHA_TO_ONE_SGIS);
+    }
+#endif  // GL_SAMPLE_ALPHA_TO_ONE_SGIS
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::enable_multisample_alpha_mask
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+enable_multisample_alpha_mask(bool val) {
+  if (_multisample_alpha_mask_enabled != val) {
+    _multisample_alpha_mask_enabled = val;
+#ifdef GL_SAMPLE_ALPHA_TO_MASK_SGIS
+    if (val) {
+#ifdef GSG_VERBOSE
+      crgsg_cat.debug()
+        << "crEnable(GL_SAMPLE_ALPHA_TO_MASK_SGIS)" << endl;
+#endif
+      chromium.Enable(GL_SAMPLE_ALPHA_TO_MASK_SGIS);
+    } else {
+#ifdef GSG_VERBOSE
+      crgsg_cat.debug()
+        << "crDisable(GL_SAMPLE_ALPHA_TO_MASK_SGIS)" << endl;
+#endif
+      chromium.Disable(GL_SAMPLE_ALPHA_TO_MASK_SGIS);
+    }
+#endif  // GL_SAMPLE_ALPHA_TO_MASK_SGIS
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::enable_blend
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+enable_blend(bool val) {
+  if (_blend_enabled != val) {
+    _blend_enabled = val;
+    if (val) {
+#ifdef GSG_VERBOSE
+      crgsg_cat.debug()
+        << "crEnable(GL_BLEND)" << endl;
+#endif
+      chromium.Enable(GL_BLEND);
+    } else {
+#ifdef GSG_VERBOSE
+      crgsg_cat.debug()
+        << "crDisable(GL_BLEND)" << endl;
+#endif
+      chromium.Disable(GL_BLEND);
+    }
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::enable_depth_test
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+enable_depth_test(bool val) {
+  if (_depth_test_enabled != val) {
+    _depth_test_enabled = val;
+    if (val) {
+#ifdef GSG_VERBOSE
+      crgsg_cat.debug()
+        << "crEnable(GL_DEPTH_TEST)" << endl;
+#endif
+      chromium.Enable(GL_DEPTH_TEST);
+    } else {
+#ifdef GSG_VERBOSE
+      crgsg_cat.debug()
+        << "crDisable(GL_DEPTH_TEST)" << endl;
+#endif
+      chromium.Disable(GL_DEPTH_TEST);
+    }
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::enable_fog
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+enable_fog(bool val) {
+  if (_fog_enabled != val) {
+    _fog_enabled = val;
+    if (val) {
+#ifdef GSG_VERBOSE
+      crgsg_cat.debug()
+        << "crEnable(GL_FOG)" << endl;
+#endif
+      chromium.Enable(GL_FOG);
+    } else {
+#ifdef GSG_VERBOSE
+      crgsg_cat.debug()
+        << "crDisable(GL_FOG)" << endl;
+#endif
+      chromium.Disable(GL_FOG);
+    }
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::enable_alpha_test
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+enable_alpha_test(bool val) {
+  if (_alpha_test_enabled != val) {
+    _alpha_test_enabled = val;
+    if (val) {
+#ifdef GSG_VERBOSE
+      crgsg_cat.debug()
+        << "crEnable(GL_ALPHA_TEST)" << endl;
+#endif
+      chromium.Enable(GL_ALPHA_TEST);
+    } else {
+#ifdef GSG_VERBOSE
+      crgsg_cat.debug()
+        << "crDisable(GL_ALPHA_TEST)" << endl;
+#endif
+      chromium.Disable(GL_ALPHA_TEST);
+    }
+  }
+}
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::enable_polygon_offset
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+enable_polygon_offset(bool val) {
+  if (_polygon_offset_enabled != val) {
+    _polygon_offset_enabled = val;
+    if (val) {
+#ifdef GSG_VERBOSE
+      crgsg_cat.debug()
+        << "crEnable(GL_POLYGON_OFFSET_*)" << endl;
+#endif
+      chromium.Enable(GL_POLYGON_OFFSET_FILL);
+    } else {
+#ifdef GSG_VERBOSE
+      crgsg_cat.debug()
+        << "crDisable(GL_POLYGON_OFFSET_*)" << endl;
+#endif
+      chromium.Disable(GL_POLYGON_OFFSET_FILL);
+    }
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::get_current_color_mat
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE const LMatrix4f &CRGraphicsStateGuardian::
+get_current_color_mat() const {
+  return _current_color_mat;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::get_current_alpha_offset
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE const float &CRGraphicsStateGuardian::
+get_current_alpha_offset() const {
+  return _current_alpha_offset;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::get_current_alpha_scale
+//       Access:
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE const float &CRGraphicsStateGuardian::
+get_current_alpha_scale() const {
+  return _current_alpha_scale;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::get_light_id
+//       Access: Public
+//  Description: Convert index to gl light id
+////////////////////////////////////////////////////////////////////
+INLINE GLenum CRGraphicsStateGuardian::get_light_id(int index) const
+{
+    switch( index )
+    {
+        case 0: return GL_LIGHT0;
+        case 1: return GL_LIGHT1;
+        case 2: return GL_LIGHT2;
+        case 3: return GL_LIGHT3;
+        case 4: return GL_LIGHT4;
+        case 5: return GL_LIGHT5;
+        case 6: return GL_LIGHT6;
+        case 7: return GL_LIGHT7;
+        default:
+            crgsg_cat.error()
+              << "get_light_id() - we don't currently support ids "
+              << "> 8" << endl;
+            break;
+    }
+    return GL_LIGHT0;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::get_clip_plane_id
+//       Access: Public
+//  Description: Convert index to gl clip plane id
+////////////////////////////////////////////////////////////////////
+INLINE GLenum CRGraphicsStateGuardian::
+get_clip_plane_id(int index) const {
+  switch(index) {
+    case 0: return GL_CLIP_PLANE0;
+    case 1: return GL_CLIP_PLANE1;
+    case 2: return GL_CLIP_PLANE2;
+    case 3: return GL_CLIP_PLANE3;
+    case 4: return GL_CLIP_PLANE4;
+    case 5: return GL_CLIP_PLANE5;
+    default:
+      crgsg_cat.error()
+        << "get_clip_plane_id() - we don't currently support ids "
+        << "> 5" << endl;
+      break;
+  }
+  return GL_CLIP_PLANE0;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_scene_graph_color
+//       Access: Public
+//  Description: Checks whether the scene graph color needs to be
+//               issued, and sends the appropriate chromium.Color command if
+//               it does.
+////////////////////////////////////////////////////////////////////
+INLINE void CRGraphicsStateGuardian::
+issue_scene_graph_color() {
+  if (_issued_color_stale) {
+    issue_transformed_color(_scene_graph_color);
+    _issued_color_stale = false;
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::report_errors
+//       Access: Public
+//  Description: Checks for any outstanding error codes and outputs
+//               them, if found.  If NDEBUG is defined, this function
+//               does nothing.
+////////////////////////////////////////////////////////////////////
+INLINE void 
+report_errors() {
+    // pulling this out of gsg since I'd like to call it when there's no gsg ptr around
+#ifndef NDEBUG
+  extern void report_errors_loop(GLenum error_code);
+
+  GLenum error_code = chromium.GetError();
+  if (error_code != GL_NO_ERROR) {
+    report_errors_loop(error_code);
+  }
+#endif
+}

+ 6125 - 0
panda/src/crgsg/crGraphicsStateGuardian.cxx

@@ -0,0 +1,6125 @@
+// Filename: chromium.GraphicsStateGuardian.cxx
+// Created by:  drose (02Feb99)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://www.panda3d.org/license.txt .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+#include "crGraphicsStateGuardian.h"
+#include "crSavedFrameBuffer.h"
+#include "crTextureContext.h"
+#include "crGeomNodeContext.h"
+#include "config_crgsg.h"
+
+#include "config_util.h"
+#include "directRenderTraverser.h"
+#include "cullTraverser.h"
+#include "displayRegion.h"
+#include "lensNode.h"
+#include "camera.h"
+#include "renderBuffer.h"
+#include "geom.h"
+#include "geomIssuer.h"
+#include "graphicsWindow.h"
+#include "graphicsChannel.h"
+#include "lens.h"
+#include "get_rel_pos.h"
+#include "perspectiveLens.h"
+#include "ambientLight.h"
+#include "directionalLight.h"
+#include "pointLight.h"
+#include "spotlight.h"
+#include "GL/glu.h"
+#include "lensNode.h"
+#include "transformTransition.h"
+#include "colorMatrixTransition.h"
+#include "alphaTransformTransition.h"
+#include "colorTransition.h"
+#include "lightTransition.h"
+#include "textureTransition.h"
+#include "renderModeTransition.h"
+#include "materialTransition.h"
+#include "colorBlendTransition.h"
+#include "colorMaskTransition.h"
+#include "texMatrixTransition.h"
+#include "texGenTransition.h"
+#include "textureApplyTransition.h"
+#include "clipPlaneTransition.h"
+#include "transparencyTransition.h"
+#include "fogTransition.h"
+#include "linesmoothTransition.h"
+#include "depthTestTransition.h"
+#include "depthWriteTransition.h"
+#include "cullFaceTransition.h"
+#include "stencilTransition.h"
+#include "pointShapeTransition.h"
+#include "polygonOffsetTransition.h"
+#include "textureAttrib.h"
+#include "cullFaceAttrib.h"
+#include "transparencyAttrib.h"
+#include "depthTestAttrib.h"
+#include "depthWriteAttrib.h"
+#include "colorWriteAttrib.h"
+#include "clockObject.h"
+#include "string_utils.h"
+#include "dcast.h"
+#include "pvector.h"
+
+#ifdef DO_PSTATS
+#include "pStatTimer.h"
+#endif
+
+#include <algorithm>
+
+#if 0
+#define chromium.GenTextures chromium.GenTexturesEXT
+#define chromium.PrioritizeTextures chromium.PrioritizeTexturesEXT
+#define chromium.BindTexture chromium.BindTextureEXT
+#define chromium.CopyTexImage2D chromium.CopyTexImage2DEXT
+#define chromium.DeleteTextures chromium.DeleteTexturesEXT
+#endif
+
+#if !defined(GL_BGR) && defined(GL_BGR_EXT)
+// These symbols are sometimes defined as _EXT variants.
+#define GL_BGR GL_BGR_EXT
+#define GL_BGRA GL_BGRA_EXT
+#endif
+
+TypeHandle CRGraphicsStateGuardian::_type_handle;
+SPUDispatchTable chromium;
+
+#if !defined(CPPPARSER) && defined(DO_PSTATS)
+PStatCollector CRGraphicsStateGuardian::_vertices_display_list_pcollector("Vertices:Display lists");
+#endif
+
+static void
+issue_vertex_gl(const Geom *geom, Geom::VertexIterator &viterator, 
+                GraphicsStateGuardianBase *) {
+  const Vertexf &vertex = geom->get_next_vertex(viterator);
+  // crgsg_cat.debug() << "Issuing vertex " << vertex << "\n";
+  chromium.Vertex3fv(vertex.get_data());
+}
+
+static void
+issue_normal_gl(const Geom *geom, Geom::NormalIterator &niterator, 
+                GraphicsStateGuardianBase *) {
+  const Normalf &normal = geom->get_next_normal(niterator);
+  // crgsg_cat.debug() << "Issuing normal " << normal << "\n";
+  chromium.Normal3fv(normal.get_data());
+}
+
+static void
+issue_texcoord_gl(const Geom *geom, Geom::TexCoordIterator &tciterator, 
+                GraphicsStateGuardianBase *) {
+  const TexCoordf &texcoord = geom->get_next_texcoord(tciterator);
+  //  crgsg_cat.debug() << "Issuing texcoord " << texcoord << "\n";
+  chromium.TexCoord2fv(texcoord.get_data());
+}
+
+static void
+issue_color_gl(const Geom *geom, Geom::ColorIterator &citerator,
+               GraphicsStateGuardianBase *) {
+  const Colorf &color = geom->get_next_color(citerator);
+  //  crgsg_cat.debug() << "Issuing color " << color << "\n";
+  chromium.Color4fv(color.get_data());
+}
+
+static void
+issue_transformed_color_gl(const Geom *geom, Geom::ColorIterator &citerator,
+                           GraphicsStateGuardianBase *gsg) {
+  const CRGraphicsStateGuardian *crgsg = DCAST(CRGraphicsStateGuardian, gsg);
+  const Colorf &color = geom->get_next_color(citerator);
+  crgsg->issue_transformed_color(color);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+CRGraphicsStateGuardian::
+CRGraphicsStateGuardian(GraphicsWindow *win) : GraphicsStateGuardian(win) {
+  _light_info = (LightInfo *)NULL;
+  _clip_plane_enabled = (bool *)NULL;
+  _cur_clip_plane_enabled = (bool *)NULL;
+
+  // Create a default RenderTraverser.
+  if (cr_cull_traversal) {
+    _render_traverser =
+      new CullTraverser(this, RenderRelation::get_class_type());
+  } else {
+    _render_traverser =
+      new DirectRenderTraverser(this, RenderRelation::get_class_type());
+  }
+
+  reset();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::Destructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+CRGraphicsStateGuardian::
+~CRGraphicsStateGuardian() {
+  free_pointers();
+  release_all_textures();
+  release_all_geoms();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::reset
+//       Access: Public, Virtual
+//  Description: Resets all internal state as if the gsg were newly
+//               created.
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+reset() {
+  free_pointers();
+  activate();
+  GraphicsStateGuardian::reset();
+
+  _buffer_mask = 0;
+
+  // All GL implementations have the following buffers. (?)
+  _buffer_mask = (RenderBuffer::T_color |
+                  RenderBuffer::T_depth |
+                  RenderBuffer::T_stencil |
+                  RenderBuffer::T_accum);
+
+  // Check to see if we have double-buffering.
+  GLboolean has_back;
+  chromium.GetBooleanv(GL_DOUBLEBUFFER, &has_back);
+  if (!has_back) {
+    _buffer_mask &= ~RenderBuffer::T_back;
+  }
+
+#if 0
+  //Note 8/01: This is incorrect for mono displays, if stereo is not in use, we need
+  //           to use the GL_BACK constants and not the GL_BACK_LEFT ones, which
+  //           under the RenderBuffer flag schemes require both left and right flags set.
+
+  // Check to see if we have stereo (and therefore a right buffer).
+  GLboolean has_stereo;
+  chromium.GetBooleanv(GL_STEREO, &has_stereo);
+  if (!has_stereo) {
+    _buffer_mask &= ~RenderBuffer::T_right;
+  }
+#endif
+
+  // Set up our clear values to invalid values, so the chromium.Clear* calls
+  // will be made initially.
+  _clear_color_red = -1.0f;
+  _clear_color_green = -1.0f;
+  _clear_color_blue = -1.0f;
+  _clear_color_alpha = -1.0f;
+  _clear_depth = -1.0f;
+  _clear_stencil = -1;
+  _clear_accum_red = -1.0f;
+  _clear_accum_green = -1.0f;
+  _clear_accum_blue = -1.0f;
+  _clear_accum_alpha = -1.0f;
+
+  // Set up the specific state values to GL's known initial values.
+  _draw_buffer_mode = (has_back) ? GL_BACK : GL_FRONT;
+  _read_buffer_mode = (has_back) ? GL_BACK : GL_FRONT;
+  _shade_model_mode = GL_SMOOTH;
+  chromium.FrontFace(GL_CCW);
+
+  _line_width = 1.0f;
+  _point_size = 1.0f;
+  _depth_mask = false;
+  _fog_mode = GL_EXP;
+  _alpha_func = GL_ALWAYS;
+  _alpha_func_ref = 0;
+  _polygon_mode = GL_FILL;
+
+  _pack_alignment = 4;
+  _unpack_alignment = 4;
+
+  // Set up all the enabled/disabled flags to GL's known initial
+  // values: everything off.
+  _multisample_enabled = false;
+  _line_smooth_enabled = false;
+  _point_smooth_enabled = false;
+  _scissor_enabled = false;
+  _lighting_enabled = false;
+  _lighting_enabled_this_frame = false;
+  _normals_enabled = false;
+  _texturing_enabled = false;
+  _multisample_alpha_one_enabled = false;
+  _multisample_alpha_mask_enabled = false;
+  _blend_enabled = false;
+  _depth_test_enabled = false;
+  _fog_enabled = false;
+  _alpha_test_enabled = false;
+  _polygon_offset_enabled = false;
+  _decal_level = 0;
+
+  // Dither is on by default in GL, let's turn it off
+  _dither_enabled = true;
+  enable_dither(false);
+
+  // Stencil test is off by default
+  _stencil_test_enabled = false;
+  _stencil_func = GL_NOTEQUAL;
+  _stencil_op = GL_REPLACE;
+
+  // Antialiasing.
+  enable_line_smooth(false);
+  enable_multisample(true);
+
+  // Should we normalize lighting normals?
+  if (cr_auto_normalize_lighting) {
+    chromium.Enable(GL_NORMALIZE);
+  }
+
+  // Set up the light id map
+  GLint max_lights;
+  chromium.GetIntegerv( GL_MAX_LIGHTS, &max_lights );
+  _max_lights = max_lights;
+  _light_info = new LightInfo[_max_lights];
+
+  // Set up the clip plane id map
+  GLint max_clip_planes;
+  chromium.GetIntegerv(GL_MAX_CLIP_PLANES, &max_clip_planes);
+  _max_clip_planes = max_clip_planes;
+  _available_clip_plane_ids = PTA(PlaneNode*)::empty_array(_max_clip_planes);
+  _clip_plane_enabled = new bool[_max_clip_planes];
+  _cur_clip_plane_enabled = new bool[_max_clip_planes];
+  int i;
+  for (i = 0; i < _max_clip_planes; i++) {
+    _available_clip_plane_ids[i] = NULL;
+    _clip_plane_enabled[i] = false;
+  }
+
+  _current_projection_mat = LMatrix4f::ident_mat();
+  _projection_mat_stack_count = 0;
+
+  // Make sure the GL state matches all of our initial attribute
+  // states.
+  PT(DepthTestTransition) dta = new DepthTestTransition;
+  PT(DepthWriteTransition) dwa = new DepthWriteTransition;
+  PT(CullFaceTransition) cfa = new CullFaceTransition;
+  PT(LightTransition) la = new LightTransition;
+  PT(TextureTransition) ta = new TextureTransition;
+
+  dta->issue(this);
+  dwa->issue(this);
+  cfa->issue(this);
+  la->issue(this);
+  ta->issue(this);
+
+  if (cr_cheap_textures) {
+    crgsg_cat.info()
+      << "Setting chromium.Hint() for fastest textures.\n";
+    chromium.Hint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
+  }
+
+  // use per-vertex fog if per-pixel fog requires SW renderer
+  chromium.Hint(GL_FOG_HINT,GL_DONT_CARE);
+
+  _dithering_enabled = false;
+
+  GLint iRedBits;
+  chromium.GetIntegerv(GL_RED_BITS,&iRedBits);
+  if(iRedBits<24) {
+    chromium.Enable(GL_DITHER);
+    _dithering_enabled = true;
+    if(crgsg_cat.is_debug())
+        crgsg_cat.debug() << "frame buffer depth < 8bits channel, enabling dithering\n";
+  }
+}
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::clear
+//       Access: Public, Virtual
+//  Description: Clears all of the indicated buffers to their assigned
+//               colors.
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+clear(const RenderBuffer &buffer) {
+  DO_PSTATS_STUFF(PStatTimer timer(_win->_clear_pcollector);)
+  //  activate();
+
+  nassertv(buffer._gsg == this);
+  int buffer_type = buffer._buffer_type;
+  GLbitfield mask = 0;
+  NodeTransitions state;
+
+  if (buffer_type & RenderBuffer::T_color) {
+    call_glClearColor(_color_clear_value[0],
+                      _color_clear_value[1],
+                      _color_clear_value[2],
+                      _color_clear_value[3]);
+    state.set_transition(new ColorMaskTransition);
+    mask |= GL_COLOR_BUFFER_BIT;
+
+    set_draw_buffer(buffer);
+  }
+
+  if (buffer_type & RenderBuffer::T_depth) {
+    call_glClearDepth(_depth_clear_value);
+    mask |= GL_DEPTH_BUFFER_BIT;
+
+    // In order to clear the depth buffer, the depth mask must enable
+    // writing to the depth buffer.
+    if (!_depth_mask) {
+      state.set_transition(new DepthWriteTransition);
+    }
+  }
+
+  if (buffer_type & RenderBuffer::T_stencil) {
+    call_glClearStencil(_stencil_clear_value != false);
+    mask |= GL_STENCIL_BUFFER_BIT;
+  }
+
+  if (buffer_type & RenderBuffer::T_accum) {
+    call_glClearAccum(_accum_clear_value[0],
+                      _accum_clear_value[1],
+                      _accum_clear_value[2],
+                      _accum_clear_value[3]);
+    mask |= GL_ACCUM_BUFFER_BIT;
+  }
+
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug() << "crClear(";
+  if (mask & GL_COLOR_BUFFER_BIT) {
+    crgsg_cat.debug(false) << "GL_COLOR_BUFFER_BIT|";
+  }
+  if (mask & GL_DEPTH_BUFFER_BIT) {
+    crgsg_cat.debug(false) << "GL_DEPTH_BUFFER_BIT|";
+  }
+  if (mask & GL_STENCIL_BUFFER_BIT) {
+    crgsg_cat.debug(false) << "GL_STENCIL_BUFFER_BIT|";
+  }
+  if (mask & GL_ACCUM_BUFFER_BIT) {
+    crgsg_cat.debug(false) << "GL_ACCUM_BUFFER_BIT|";
+  }
+  crgsg_cat.debug(false) << ")" << endl;
+#endif
+
+  modify_state(state);
+  chromium.Clear(mask);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::clear
+//       Access: Public, Virtual
+//  Description: Clears all of the indicated buffers to their assigned
+//               colors.
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+clear(const RenderBuffer &buffer, const DisplayRegion *region) {
+  DisplayRegionStack old_dr = push_display_region(region);
+  prepare_display_region();
+  clear(buffer);
+  pop_display_region(old_dr);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::prepare_display_region
+//       Access: Public, Virtual
+//  Description: Prepare a display region for rendering (set up
+//       scissor region and viewport)
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+prepare_display_region() {
+  if (_current_display_region == (DisplayRegion*)0L) {
+    crgsg_cat.error()
+      << "Invalid NULL display region in prepare_display_region()\n";
+    enable_scissor(false);
+
+  } else if (_current_display_region != _actual_display_region) {
+    _actual_display_region = _current_display_region;
+
+    int l, b, w, h;
+    _actual_display_region->get_region_pixels(l, b, w, h);
+    GLint x = GLint(l);
+    GLint y = GLint(b);
+    GLsizei width = GLsizei(w);
+    GLsizei height = GLsizei(h);
+
+    enable_scissor( true );
+    call_glScissor( x, y, width, height );
+    call_glViewport( x, y, width, height );
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::prepare_lens
+//       Access: Public, Virtual
+//  Description: Makes the current lens (whichever lens was most
+//               recently specified with push_lens()) active, so that
+//               it will transform future rendered geometry.  Normally
+//               this is only called from the draw process, and
+//               usually it is called immediately after a call to
+//               push_lens().
+//
+//               The return value is true if the lens is acceptable,
+//               false if it is not.
+////////////////////////////////////////////////////////////////////
+bool CRGraphicsStateGuardian::
+prepare_lens() {
+  if (_current_lens == (Lens *)NULL) {
+    return false;
+  }
+
+  if (!_current_lens->is_linear()) {
+    return false;
+  }
+
+  const LMatrix4f &projection_mat = _current_lens->get_projection_mat();
+
+  // The projection matrix must always be right-handed Y-up, even if
+  // our coordinate system of choice is otherwise, because certain GL
+  // calls (specifically chromium.TexGen(GL_SPHERE_MAP)) assume this kind of
+  // a coordinate system.  Sigh.  In order to implement a Z-up (or
+  // other arbitrary) coordinate system, we'll use a Y-up projection
+  // matrix, and store the conversion to our coordinate system of
+  // choice in the modelview matrix.
+  LMatrix4f new_projection_mat =
+    LMatrix4f::convert_mat(CS_yup_right, _current_lens->get_coordinate_system()) *
+    projection_mat;
+
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug()
+    << "crMatrixMode(GL_PROJECTION): " << new_projection_mat << endl;
+#endif
+  chromium.MatrixMode(GL_PROJECTION);
+  chromium.LoadMatrixf(new_projection_mat.get_data());
+
+  return true;
+}
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::render_frame
+//       Access: Public, Virtual
+//  Description: Renders an entire frame, including all display
+//               regions within the frame, and includes any necessary
+//               pre- and post-processing like swapping buffers.
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+render_frame() {
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug()
+    << "begin frame " << ClockObject::get_global_clock()->get_frame_count()
+    << " --------------------------------------------" << endl;
+#endif
+
+  activate();
+  _win->begin_frame();
+  report_errors();
+  _decal_level = 0;
+  _lighting_enabled_this_frame = false;
+
+#ifdef DO_PSTATS
+  // For Pstats to track our current texture memory usage, we have to
+  // reset the set of current textures each frame.
+  init_frame_pstats();
+  _vertices_display_list_pcollector.clear_level();
+
+  // But since we don't get sent a new issue_texture() unless our
+  // texture state has changed, we have to be sure to clear the
+  // current texture state now.  A bit unfortunate, but probably not
+  // measurably expensive.
+  clear_attribute(TextureTransition::get_class_type());
+#endif
+
+  // First, clear the entire window.
+  clear_framebuffer();
+
+  // Now render each of our layers in order.
+  int max_channel_index = _win->get_max_channel_index();
+  for (int c = 0; c < max_channel_index; c++) {
+    if (_win->is_channel_defined(c)) {
+      GraphicsChannel *chan = _win->get_channel(c);
+      if (chan->is_active()) {
+        int num_layers = chan->get_num_layers();
+        for (int l = 0; l < num_layers; l++) {
+          GraphicsLayer *layer = chan->get_layer(l);
+          if (layer->is_active()) {
+            int num_drs = layer->get_num_drs();
+            for (int d = 0; d < num_drs; d++) {
+              DisplayRegion *dr = layer->get_dr(d);
+              nassertv(dr != (DisplayRegion *)NULL);
+              Camera *cam = dr->get_camera();
+
+              // For each display region, render from the camera's view.
+              if (dr->is_active() && cam != (Camera *)NULL &&
+                  cam->is_active() && cam->get_scene() != (Node *)NULL) {
+                DisplayRegionStack old_dr = push_display_region(dr);
+                prepare_display_region();
+                render_scene(cam->get_scene(), cam);
+                pop_display_region(old_dr);
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+
+  // Now we're done with the frame processing.  Clean up.
+
+  if (_lighting_enabled_this_frame) {
+
+    // Let's turn off all the lights we had on, and clear the light
+    // cache--to force the lights to be reissued next frame, in case
+    // their parameters or positions have changed between frames.
+
+    for (int i = 0; i < _max_lights; i++) {
+      enable_light(i, false);
+      _light_info[i]._light = (Light *)NULL;
+    }
+
+    // Also force the lighting state to unlit, so that issue_light()
+    // will be guaranteed to be called next frame even if we have the
+    // same set of light pointers we had this frame.
+    clear_attribute(LightTransition::get_class_type());
+
+    // All this work to undo the lighting state each frame doesn't seem
+    // ideal--there may be a better way.  Maybe if the lights were just
+    // more aware of whether their parameters or positions have changed
+    // at all?
+  }
+
+#ifndef NDEBUG
+  report_errors();
+#endif
+
+  _win->end_frame();
+
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug()
+    << "end frame ----------------------------------------------" << endl;
+#endif
+}
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::render_scene
+//       Access: Public, Virtual
+//  Description: Renders an entire scene, from the root node of the
+//               scene graph, as seen from a particular LensNode
+//               and with a given initial state.  This initial state
+//               may be modified during rendering.
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+render_scene(Node *root, LensNode *projnode) {
+#ifdef GSG_VERBOSE
+  _pass_number = 0;
+  crgsg_cat.debug()
+    << "begin scene - - - - - - - - - - - - - - - - - - - - - - - - -"
+    << endl;
+#endif
+  _current_root_node = root;
+
+  render_subgraph(_render_traverser, root, projnode,
+                  AllTransitionsWrapper());
+
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug()
+    << "done scene  - - - - - - - - - - - - - - - - - - - - - - - - -"
+    << endl;
+#endif
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::render_subgraph
+//       Access: Public, Virtual
+//  Description: Renders a subgraph of the scene graph as seen from a
+//               given lens node, and with a particular initial
+//               state.  This state may be modified by the render
+//               process.
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+render_subgraph(RenderTraverser *traverser,
+                Node *subgraph, LensNode *projnode,
+                const AllTransitionsWrapper &net_trans) {
+  // Calling activate() frequently seems to be intolerably expensive
+  // on some platforms.  We'll limit ourselves for now to calling it
+  // only in render_frame().
+
+  //  activate();
+
+  Lens *lens = projnode->get_lens();
+  LensNode *old_camera = _current_camera;
+  _current_camera = projnode;
+
+  LensStack lens_stack = push_lens(lens);
+  if (!prepare_lens()) {
+    crgsg_cat.error()
+      << "Cannot render with a nonlinear lens!\n";
+    return;
+  }
+
+  // We infer the modelview matrix by doing a wrt on the lens
+  // node.
+  LMatrix4f modelview_mat;
+  get_rel_mat(subgraph, _current_camera, modelview_mat);
+
+  if (_coordinate_system != CS_yup_right) {
+    // Now we build the coordinate system conversion into the
+    // modelview matrix (as described in the paragraph above).
+    modelview_mat = modelview_mat *
+      LMatrix4f::convert_mat(_coordinate_system, CS_yup_right);
+  }
+
+  // The modelview matrix will be loaded as each geometry is
+  // encountered.  So we set the supplied modelview matrix as an
+  // initial value instead of loading it now.
+  AllTransitionsWrapper sub_trans = net_trans;
+  sub_trans.set_transition(new TransformTransition(modelview_mat));
+
+  render_subgraph(traverser, subgraph, sub_trans);
+
+  _current_camera = old_camera;
+
+  pop_lens(lens_stack);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::render_subgraph
+//       Access: Public, Virtual
+//  Description: Renders a subgraph of the scene graph as seen from the
+//               current lens node, and with a particular
+//               initial state.  This state may be modified during the
+//               render process.
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+render_subgraph(RenderTraverser *traverser, Node *subgraph,
+                const AllTransitionsWrapper &net_trans) {
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug()
+    << "begin subgraph (pass " << ++_pass_number
+    << ") - - - - - - - - - - - - - - - - - - - - - - - - -" << endl;
+#endif
+  //  activate();
+
+  nassertv(traverser != (RenderTraverser *)NULL);
+  traverser->traverse(subgraph, net_trans);
+
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug()
+    << "end subgraph (pass " << _pass_number
+    << ") - - - - - - - - - - - - - - - - - - - - - - - - -"
+    << endl;
+#endif
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::draw_point
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+draw_point(GeomPoint *geom, GeomContext *) {
+  //  activate();
+
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug() << "draw_point()" << endl;
+#endif
+#ifdef DO_PSTATS
+  PStatTimer timer(_draw_primitive_pcollector);
+  _vertices_other_pcollector.add_level(geom->get_num_vertices());
+#endif
+
+  call_glPointSize(geom->get_size());
+  issue_scene_graph_color();
+
+  int nprims = geom->get_num_prims();
+  Geom::VertexIterator vi = geom->make_vertex_iterator();
+  Geom::NormalIterator ni = geom->make_normal_iterator();
+  Geom::TexCoordIterator ti = geom->make_texcoord_iterator();
+  Geom::ColorIterator ci = geom->make_color_iterator();
+
+  GeomIssuer::IssueColor *issue_color;
+
+  if (!_color_transform_enabled && !_alpha_transform_enabled) {
+    issue_color = issue_color_gl;
+  }
+  else {
+    issue_color = issue_transformed_color_gl;
+  }
+
+  GeomIssuer issuer(geom, this,
+                    issue_vertex_gl,
+                    issue_normal_gl,
+                    issue_texcoord_gl,
+                    issue_color);
+
+  // Draw overall
+  issuer.issue_color(G_OVERALL, ci);
+  issuer.issue_normal(G_OVERALL, ni);
+
+  chromium.Begin(GL_POINTS);
+
+  for (int i = 0; i < nprims; i++) {
+    // Draw per primitive
+    issuer.issue_color(G_PER_PRIM, ci);
+    issuer.issue_normal(G_PER_PRIM, ni);
+
+    // Draw per vertex, same thing.
+    issuer.issue_color(G_PER_VERTEX, ci);
+    issuer.issue_normal(G_PER_VERTEX, ni);
+    issuer.issue_texcoord(G_PER_VERTEX, ti);
+    issuer.issue_vertex(G_PER_VERTEX, vi);
+  }
+
+  chromium.End();
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::draw_line
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+draw_line(GeomLine *geom, GeomContext *) {
+  //  activate();
+
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug() << "draw_line()" << endl;
+#endif
+#ifdef DO_PSTATS
+  PStatTimer timer(_draw_primitive_pcollector);
+  _vertices_other_pcollector.add_level(geom->get_num_vertices());
+#endif
+
+  call_glLineWidth(geom->get_width());
+  issue_scene_graph_color();
+
+  int nprims = geom->get_num_prims();
+  Geom::VertexIterator vi = geom->make_vertex_iterator();
+  Geom::ColorIterator ci = geom->make_color_iterator();
+
+  GeomIssuer::IssueColor *issue_color;
+
+  if (!_color_transform_enabled && !_alpha_transform_enabled) {
+    issue_color = issue_color_gl;
+  }
+  else {
+    issue_color = issue_transformed_color_gl;
+  }
+
+  GeomIssuer issuer(geom, this,
+                    issue_vertex_gl,
+                    issue_normal_gl,
+                    issue_texcoord_gl,
+                    issue_color);
+
+  if (geom->get_binding(G_COLOR) == G_PER_VERTEX) {
+    call_glShadeModel(GL_SMOOTH);
+  } else {
+    call_glShadeModel(GL_FLAT);
+  }
+
+  // Draw overall
+  issuer.issue_color(G_OVERALL, ci);
+
+  chromium.Begin(GL_LINES);
+
+  for (int i = 0; i < nprims; i++) {
+    // Draw per primitive
+    issuer.issue_color(G_PER_PRIM, ci);
+
+    for (int j = 0; j < 2; j++) {
+      // Draw per vertex
+      issuer.issue_color(G_PER_VERTEX, ci);
+      issuer.issue_vertex(G_PER_VERTEX, vi);
+    }
+  }
+
+  chromium.End();
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::draw_linestrip
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+draw_linestrip(GeomLinestrip *geom, GeomContext *) {
+  //  activate();
+
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug() << "draw_linestrip()" << endl;
+#endif
+
+#ifdef DO_PSTATS
+  //  PStatTimer timer(_draw_primitive_pcollector);
+  // Using PStatTimer may cause a compiler crash.
+  _draw_primitive_pcollector.start();
+  _vertices_other_pcollector.add_level(geom->get_num_vertices());
+#endif
+
+  call_glLineWidth(geom->get_width());
+  issue_scene_graph_color();
+
+  int nprims = geom->get_num_prims();
+  const int *plen = geom->get_lengths();
+  Geom::VertexIterator vi = geom->make_vertex_iterator();
+  Geom::ColorIterator ci = geom->make_color_iterator();
+
+  GeomIssuer::IssueColor *issue_color;
+
+  if (!_color_transform_enabled && !_alpha_transform_enabled) {
+    issue_color = issue_color_gl;
+  }
+  else {
+    issue_color = issue_transformed_color_gl;
+  }
+
+  GeomIssuer issuer(geom, this,
+                    issue_vertex_gl,
+                    issue_normal_gl,
+                    issue_texcoord_gl,
+                    issue_color);
+
+  if (geom->get_binding(G_COLOR) == G_PER_VERTEX) {
+    call_glShadeModel(GL_SMOOTH);
+  } else {
+    call_glShadeModel(GL_FLAT);
+  }
+
+  // Draw overall
+  issuer.issue_color(G_OVERALL, ci);
+
+  for (int i = 0; i < nprims; i++) {
+    // Draw per primitive
+    issuer.issue_color(G_PER_PRIM, ci);
+
+    int num_verts = *(plen++);
+    nassertv(num_verts >= 2);
+
+    chromium.Begin(GL_LINE_STRIP);
+
+    // Per-component attributes for the first line segment?
+    issuer.issue_color(G_PER_COMPONENT, ci);
+
+    // Draw the first 2 vertices
+    int v;
+    for (v = 0; v < 2; v++) {
+      issuer.issue_color(G_PER_VERTEX, ci);
+      issuer.issue_vertex(G_PER_VERTEX, vi);
+    }
+
+    // Now draw each of the remaining vertices.  Each vertex from
+    // this point on defines a new line segment.
+    for (v = 2; v < num_verts; v++) {
+      // Per-component attributes?
+      issuer.issue_color(G_PER_COMPONENT, ci);
+
+      // Per-vertex attributes
+      issuer.issue_color(G_PER_VERTEX, ci);
+      issuer.issue_vertex(G_PER_VERTEX, vi);
+    }
+    chromium.End();
+  }
+  report_errors();
+  DO_PSTATS_STUFF(_draw_primitive_pcollector.stop());
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::draw_sprite
+//       Access: Public, Virtual
+//  Description: CSN, 7/11/00
+////////////////////////////////////////////////////////////////////
+
+// this class exists because an alpha sort is necessary for correct
+// sprite rendering, and we can't simply sort the vertex arrays as
+// each vertex may or may not have corresponding information in the
+// x/y texel-world-ratio and rotation arrays.
+class WrappedSprite {
+public:
+  Vertexf _v;
+  Colorf _c;
+  float _x_ratio;
+  float _y_ratio;
+  float _theta;
+};
+
+// this struct exists because the STL can sort faster than i can.
+struct draw_sprite_vertex_less {
+  INLINE bool operator ()(const WrappedSprite& v0,
+                          const WrappedSprite& v1) const {
+    return v0._v[2] < v1._v[2]; }
+};
+
+void CRGraphicsStateGuardian::
+draw_sprite(GeomSprite *geom, GeomContext *) {
+  // this is a little bit of a mess, but it's ok.  Here's the deal:
+  // we want to draw, and draw quickly, an arbitrarily large number
+  // of sprites all facing the screen.  Performing the billboard math
+  // for ~1000 sprites is way too slow.  Ideally, we want one
+  // matrix transformation that will handle everything, and this is
+  // just about what ends up happening. We're getting the front-facing
+  // effect by setting up a new frustum (of the same z-depth as the
+  // current one) that is very small in x and y.  This way regularly
+  // rendered triangles that might not be EXACTLY facing the camera
+  // will certainly look close enough.  Then, we transform to camera-space
+  // by hand and apply the inverse frustum to the transformed point.
+  // For some cracked out reason, this actually works.
+
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug() << "draw_sprite()" << endl;
+#endif
+
+  // get the array traversal set up.
+  int nprims = geom->get_num_prims();
+  if (nprims==0) {
+      return;
+  }
+
+#ifdef DO_PSTATS
+  //  PStatTimer timer(_draw_primitive_pcollector);
+  // Using PStatTimer may cause a compiler crash.
+  _draw_primitive_pcollector.start();
+  _vertices_other_pcollector.add_level(geom->get_num_vertices());
+#endif
+
+  Geom::VertexIterator vi = geom->make_vertex_iterator();
+  Geom::ColorIterator ci = geom->make_color_iterator();
+
+  // need some interface so user can set 2d dimensions if no texture specified
+  float tex_xsize = 1.0f;  
+  float tex_ysize = 1.0f;
+
+  Texture *tex = geom->get_texture();
+  if(tex != NULL) {
+      // set up the texture-rendering state
+      NodeTransitions state;
+
+      TextureTransition *ta = new TextureTransition;
+      ta->set_on(tex);
+      state.set_transition(ta);
+
+      TextureApplyTransition *taa = new TextureApplyTransition;
+      taa->set_mode(TextureApplyProperty::M_modulate);
+      state.set_transition(taa);
+
+      modify_state(state);
+
+      tex_xsize = tex->_pbuffer->get_xsize();
+      tex_ysize = tex->_pbuffer->get_ysize();
+  }
+
+  // save the modelview matrix
+  LMatrix4f modelview_mat;
+
+  const TransformTransition *ctatt;
+  if (!get_attribute_into(ctatt, this))
+    modelview_mat = LMatrix4f::ident_mat();
+  else
+    modelview_mat = ctatt->get_matrix();
+
+  // get the camera information
+  float aspect_ratio = 
+    get_current_camera()->get_lens()->get_aspect_ratio();
+
+  // load up our own matrices
+  chromium.MatrixMode(GL_MODELVIEW);
+  chromium.LoadIdentity();
+
+  // precomputation stuff
+  float tex_left = geom->get_ll_uv()[0];
+  float tex_right = geom->get_ur_uv()[0];
+  float tex_bottom = geom->get_ll_uv()[1];
+  float tex_top = geom->get_ur_uv()[1];
+
+  float half_width =  0.5f * tex_xsize * fabs(tex_right - tex_left);
+  float half_height = 0.5f * tex_ysize * fabs(tex_top - tex_bottom);
+  float scaled_width = 0.0f;
+  float scaled_height = 0.0f;
+
+  // the user can override alpha sorting if they want
+  bool alpha = false;
+
+  if (geom->get_alpha_disable() == false) {
+    // figure out if alpha's enabled (if not, no reason to sort)
+    const TransparencyTransition *ctratt;
+    if (get_attribute_into(ctratt, this))
+      alpha = (ctratt->get_mode() != TransparencyProperty::M_none);
+  }
+
+  // sort container and iterator
+  pvector< WrappedSprite > cameraspace_vector;
+  pvector< WrappedSprite >::iterator vec_iter;
+
+  // inner loop vars
+  int i;
+  Vertexf source_vert, cameraspace_vert;
+  float *x_walk = (float *)NULL;
+  float *y_walk = (float *)NULL;
+  float *theta_walk = (float *)NULL;
+  float theta = 0.0f;
+
+  nassertv(geom->get_x_bind_type() != G_PER_VERTEX);
+  nassertv(geom->get_y_bind_type() != G_PER_VERTEX);
+
+  // set up the non-built-in bindings
+  bool x_overall = (geom->get_x_bind_type() == G_OVERALL);
+  bool y_overall = (geom->get_y_bind_type() == G_OVERALL);
+  bool theta_overall = (geom->get_theta_bind_type() == G_OVERALL);
+  bool color_overall = (geom->get_binding(G_COLOR) == G_OVERALL);
+  bool theta_on = !(geom->get_theta_bind_type() == G_OFF);
+
+  // x direction
+  if (x_overall == true)
+    scaled_width = geom->_x_texel_ratio[0] * half_width;
+  else {
+    nassertv(((int)geom->_x_texel_ratio.size() >= geom->get_num_prims()));
+    x_walk = &geom->_x_texel_ratio[0];
+  }
+
+  // y direction
+  if (y_overall == true)
+    scaled_height = geom->_y_texel_ratio[0] * half_height * aspect_ratio;
+  else {
+    nassertv(((int)geom->_y_texel_ratio.size() >= geom->get_num_prims()));
+    y_walk = &geom->_y_texel_ratio[0];
+  }
+
+  // theta
+  if (theta_on) {
+    if (theta_overall == true)
+      theta = geom->_theta[0];
+    else {
+      nassertv(((int)geom->_theta.size() >= geom->get_num_prims()));
+      theta_walk = &geom->_theta[0];
+    }
+  }
+
+  /////////////////////////////////////////////////////////////////////
+  // INNER LOOP PART 1 STARTS HERE
+  // Here we transform each point to cameraspace and fill our sort
+  // vector with the final geometric information.
+  /////////////////////////////////////////////////////////////////////
+
+  cameraspace_vector.reserve(nprims);   //pre-alloc space for nprims
+
+  // the state is set, start running the prims
+  for (i = 0; i < nprims; i++) {
+    WrappedSprite ws;
+
+    source_vert = geom->get_next_vertex(vi);
+
+    // this mult converts to y-up cameraspace.
+    cameraspace_vert = source_vert * modelview_mat;
+    // build the final object that will go into the vector.
+    ws._v.set(cameraspace_vert[0],cameraspace_vert[1],cameraspace_vert[2]);
+
+    if (color_overall == false)
+      ws._c = geom->get_next_color(ci);
+    if (x_overall == false)
+      ws._x_ratio = *x_walk++;
+    if (y_overall == false)
+      ws._y_ratio = *y_walk++;
+    if (theta_on) {
+      if (theta_overall == false)
+        ws._theta = *theta_walk++;
+    }
+
+    cameraspace_vector.push_back(ws);
+  }
+
+  // now the verts are properly sorted by alpha (if necessary).  Of course,
+  // the sort is only local, not scene-global, so if you look closely you'll
+  // notice that alphas may be screwy.  It's ok though, because this is fast.
+  // if you want accuracy, use billboards and take the speed hit.
+  if (alpha) {
+    sort(cameraspace_vector.begin(), cameraspace_vector.end(),
+         draw_sprite_vertex_less());
+
+     if(_dithering_enabled)
+         chromium.Disable(GL_DITHER);
+  }
+
+  Vertexf ul, ur, ll, lr;
+
+  if (color_overall == true)
+    chromium.Color4fv(geom->get_next_color(ci).get_data());
+
+  ////////////////////////////////////////////////////////////////////////////
+  // INNER LOOP PART 2 STARTS HERE
+  // Now we run through the cameraspace vector and compute the geometry for each
+  // tristrip.  This includes scaling as per the ratio arrays, as well as
+  // rotating in the z.
+  ////////////////////////////////////////////////////////////////////////////
+
+  vec_iter = cameraspace_vector.begin();
+  for (; vec_iter != cameraspace_vector.end(); vec_iter++) {
+    WrappedSprite& cur_image = *vec_iter;
+
+    // if not G_OVERALL, calculate the scale factors
+    if (x_overall == false)
+      scaled_width = cur_image._x_ratio * half_width;
+
+    if (y_overall == false)
+      scaled_height = cur_image._y_ratio * half_height * aspect_ratio;
+
+    // if not G_OVERALL, do some trig for this z rotate
+    if (theta_on) {
+      if (theta_overall == false)
+        theta = cur_image._theta;
+
+      // create the rotated points
+      LMatrix3f xform_mat = LMatrix3f::rotate_mat(theta) * LMatrix3f::scale_mat(scaled_width, scaled_height);
+
+      ur = (LVector3f( 1,  1, 0) * xform_mat) + cur_image._v;
+      ul = (LVector3f(-1,  1, 0) * xform_mat) + cur_image._v;
+      lr = (LVector3f( 1, -1, 0) * xform_mat) + cur_image._v;
+      ll = (LVector3f(-1, -1, 0) * xform_mat) + cur_image._v;
+    }
+    else {
+      // create the normal points
+      ur.set(scaled_width, scaled_height, 0);
+      ul.set(-scaled_width, scaled_height, 0);
+      lr.set(scaled_width, -scaled_height, 0);
+      ll.set(-scaled_width, -scaled_height, 0);
+
+      ur += cur_image._v;
+      ul += cur_image._v;
+      lr += cur_image._v;
+      ll += cur_image._v;
+    }
+
+    // set the color
+    if (color_overall == false)
+      chromium.Color4fv(cur_image._c.get_data());
+
+    // draw each one as a 2-element tri-strip
+    chromium.Begin(GL_TRIANGLE_STRIP);
+    chromium.Normal3f(0.0f, 0.0f, 1.0f);
+    chromium.TexCoord2f(tex_left, tex_bottom);  chromium.Vertex3fv(ll.get_data());
+    chromium.TexCoord2f(tex_right, tex_bottom); chromium.Vertex3fv(lr.get_data());
+    chromium.TexCoord2f(tex_left, tex_top);     chromium.Vertex3fv(ul.get_data());
+    chromium.TexCoord2f(tex_right, tex_top);    chromium.Vertex3fv(ur.get_data());
+    chromium.End();
+  }
+
+  // restore the matrices
+  chromium.LoadMatrixf(modelview_mat.get_data());
+
+  if(alpha && _dithering_enabled)
+     chromium.Enable(GL_DITHER);
+
+  report_errors();
+  DO_PSTATS_STUFF(_draw_primitive_pcollector.stop());
+}
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::draw_polygon
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+draw_polygon(GeomPolygon *geom, GeomContext *) {
+  //  activate();
+
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug() << "draw_polygon()" << endl;
+#endif
+
+#ifdef DO_PSTATS
+  //  PStatTimer timer(_draw_primitive_pcollector);
+  // Using PStatTimer may cause a compiler crash.
+  _draw_primitive_pcollector.start();
+  _vertices_other_pcollector.add_level(geom->get_num_vertices());
+#endif
+
+  issue_scene_graph_color();
+
+  int nprims = geom->get_num_prims();
+  const int *plen = geom->get_lengths();
+  Geom::VertexIterator vi = geom->make_vertex_iterator();
+  Geom::NormalIterator ni = geom->make_normal_iterator();
+  Geom::TexCoordIterator ti = geom->make_texcoord_iterator();
+  Geom::ColorIterator ci = geom->make_color_iterator();
+
+  GeomIssuer::IssueColor *issue_color;
+
+  if (!_color_transform_enabled && !_alpha_transform_enabled) {
+    issue_color = issue_color_gl;
+  }
+  else {
+    issue_color = issue_transformed_color_gl;
+  }
+
+  GeomIssuer issuer(geom, this,
+                    issue_vertex_gl,
+                    issue_normal_gl,
+                    issue_texcoord_gl,
+                    issue_color);
+
+  // If we have per-vertex colors or normals, we need smooth shading.
+  // Otherwise we want flat shading for performance reasons.
+  if ((geom->get_binding(G_COLOR) == G_PER_VERTEX && wants_colors()) ||
+      (geom->get_binding(G_NORMAL) == G_PER_VERTEX && wants_normals())) {
+    call_glShadeModel(GL_SMOOTH);
+  } else {
+    call_glShadeModel(GL_FLAT);
+  }
+
+  // Draw overall
+  issuer.issue_color(G_OVERALL, ci);
+  issuer.issue_normal(G_OVERALL, ni);
+
+  for (int i = 0; i < nprims; i++) {
+    // Draw per primitive
+    issuer.issue_color(G_PER_PRIM, ci);
+    issuer.issue_normal(G_PER_PRIM, ni);
+
+    int num_verts = *(plen++);
+    nassertv(num_verts >= 3);
+
+    chromium.Begin(GL_POLYGON);
+
+    // Draw the vertices.
+    int v;
+    for (v = 0; v < num_verts; v++) {
+      // Per-vertex attributes.
+      issuer.issue_color(G_PER_VERTEX, ci);
+      issuer.issue_normal(G_PER_VERTEX, ni);
+      issuer.issue_texcoord(G_PER_VERTEX, ti);
+      issuer.issue_vertex(G_PER_VERTEX, vi);
+    }
+    chromium.End();
+  }
+  report_errors();
+  DO_PSTATS_STUFF(_draw_primitive_pcollector.stop());
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::draw_tri
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+draw_tri(GeomTri *geom, GeomContext *) {
+  //  activate();
+
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug() << "draw_tri()" << endl;
+#endif
+
+#ifdef DO_PSTATS
+  //  PStatTimer timer(_draw_primitive_pcollector);
+  // Using PStatTimer may cause a compiler crash.
+  _draw_primitive_pcollector.start();
+  _vertices_tri_pcollector.add_level(geom->get_num_vertices());
+#endif
+
+  issue_scene_graph_color();
+
+  int nprims = geom->get_num_prims();
+  Geom::VertexIterator vi = geom->make_vertex_iterator();
+  Geom::NormalIterator ni = geom->make_normal_iterator();
+  Geom::TexCoordIterator ti = geom->make_texcoord_iterator();
+  Geom::ColorIterator ci = geom->make_color_iterator();
+
+  GeomIssuer::IssueColor *issue_color;
+
+  if (!_color_transform_enabled && !_alpha_transform_enabled) {
+    issue_color = issue_color_gl;
+  }
+  else {
+    issue_color = issue_transformed_color_gl;
+  }
+
+  GeomIssuer issuer(geom, this,
+                    issue_vertex_gl,
+                    issue_normal_gl,
+                    issue_texcoord_gl,
+                    issue_color);
+
+  // If we have per-vertex colors or normals, we need smooth shading.
+  // Otherwise we want flat shading for performance reasons.
+  if ((geom->get_binding(G_COLOR) == G_PER_VERTEX && wants_colors()) ||
+      (geom->get_binding(G_NORMAL) == G_PER_VERTEX && wants_normals())) {
+    call_glShadeModel(GL_SMOOTH);
+  } else {
+    call_glShadeModel(GL_FLAT);
+  }
+
+  // Draw overall
+  issuer.issue_color(G_OVERALL, ci);
+  issuer.issue_normal(G_OVERALL, ni);
+
+  chromium.Begin(GL_TRIANGLES);
+
+  for (int i = 0; i < nprims; i++) {
+    // Draw per primitive
+    issuer.issue_color(G_PER_PRIM, ci);
+    issuer.issue_normal(G_PER_PRIM, ni);
+
+    for (int j = 0; j < 3; j++) {
+      // Draw per vertex
+      issuer.issue_color(G_PER_VERTEX, ci);
+      issuer.issue_normal(G_PER_VERTEX, ni);
+      issuer.issue_texcoord(G_PER_VERTEX, ti);
+      issuer.issue_vertex(G_PER_VERTEX, vi);
+    }
+  }
+
+  chromium.End();
+  report_errors();
+#ifdef DO_PSTATS
+  _draw_primitive_pcollector.stop();
+#endif
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::draw_quad
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+draw_quad(GeomQuad *geom, GeomContext *) {
+  //  activate();
+
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug() << "draw_quad()" << endl;
+#endif
+
+#ifdef DO_PSTATS
+  //  PStatTimer timer(_draw_primitive_pcollector);
+  // Using PStatTimer may cause a compiler crash.
+  _draw_primitive_pcollector.start();
+  _vertices_other_pcollector.add_level(geom->get_num_vertices());
+#endif
+
+  issue_scene_graph_color();
+
+  int nprims = geom->get_num_prims();
+  Geom::VertexIterator vi = geom->make_vertex_iterator();
+  Geom::NormalIterator ni = geom->make_normal_iterator();
+  Geom::TexCoordIterator ti = geom->make_texcoord_iterator();
+  Geom::ColorIterator ci = geom->make_color_iterator();
+
+  GeomIssuer::IssueColor *issue_color;
+
+  if (!_color_transform_enabled && !_alpha_transform_enabled) {
+    issue_color = issue_color_gl;
+  }
+  else {
+    issue_color = issue_transformed_color_gl;
+  }
+
+  GeomIssuer issuer(geom, this,
+                    issue_vertex_gl,
+                    issue_normal_gl,
+                    issue_texcoord_gl,
+                    issue_color);
+
+  // If we have per-vertex colors or normals, we need smooth shading.
+  // Otherwise we want flat shading for performance reasons.
+  if ((geom->get_binding(G_COLOR) == G_PER_VERTEX && wants_colors()) ||
+      (geom->get_binding(G_NORMAL) == G_PER_VERTEX && wants_normals())) {
+    call_glShadeModel(GL_SMOOTH);
+  } else {
+    call_glShadeModel(GL_FLAT);
+  }
+
+  // Draw overall
+  issuer.issue_color(G_OVERALL, ci);
+  issuer.issue_normal(G_OVERALL, ni);
+
+  chromium.Begin(GL_QUADS);
+
+  for (int i = 0; i < nprims; i++) {
+    // Draw per primitive
+    issuer.issue_color(G_PER_PRIM, ci);
+    issuer.issue_normal(G_PER_PRIM, ni);
+
+    for (int j = 0; j < 4; j++) {
+      // Draw per vertex
+      issuer.issue_color(G_PER_VERTEX, ci);
+      issuer.issue_normal(G_PER_VERTEX, ni);
+      issuer.issue_texcoord(G_PER_VERTEX, ti);
+      issuer.issue_vertex(G_PER_VERTEX, vi);
+    }
+  }
+
+  chromium.End();
+  report_errors();
+  DO_PSTATS_STUFF(_draw_primitive_pcollector.stop());
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::draw_tristrip
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+draw_tristrip(GeomTristrip *geom, GeomContext *) {
+  //  activate();
+
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug() << "draw_tristrip()" << endl;
+#endif
+
+#ifdef DO_PSTATS
+  //  PStatTimer timer(_draw_primitive_pcollector);
+  // Using PStatTimer may cause a compiler crash.
+  _draw_primitive_pcollector.start();
+  _vertices_tristrip_pcollector.add_level(geom->get_num_vertices());
+#endif
+
+  issue_scene_graph_color();
+
+  int nprims = geom->get_num_prims();
+  const int *plen = geom->get_lengths();
+  Geom::VertexIterator vi = geom->make_vertex_iterator();
+  Geom::NormalIterator ni = geom->make_normal_iterator();
+  Geom::TexCoordIterator ti = geom->make_texcoord_iterator();
+  Geom::ColorIterator ci = geom->make_color_iterator();
+
+  GeomIssuer::IssueColor *issue_color;
+
+  if (!_color_transform_enabled && !_alpha_transform_enabled) {
+    issue_color = issue_color_gl;
+  }
+  else {
+    issue_color = issue_transformed_color_gl;
+  }
+
+  GeomIssuer issuer(geom, this,
+                    issue_vertex_gl,
+                    issue_normal_gl,
+                    issue_texcoord_gl,
+                    issue_color);
+
+  // If we have per-vertex colors or normals, we need smooth shading.
+  // Otherwise we want flat shading for performance reasons.
+  if ((geom->get_binding(G_COLOR) == G_PER_VERTEX && wants_colors()) ||
+      (geom->get_binding(G_NORMAL) == G_PER_VERTEX && wants_normals())) {
+    call_glShadeModel(GL_SMOOTH);
+  } else {
+    call_glShadeModel(GL_FLAT);
+  }
+
+  // Draw overall
+  issuer.issue_color(G_OVERALL, ci);
+  issuer.issue_normal(G_OVERALL, ni);
+
+  for (int i = 0; i < nprims; i++) {
+    // Draw per primitive
+    issuer.issue_color(G_PER_PRIM, ci);
+    issuer.issue_normal(G_PER_PRIM, ni);
+
+    int num_verts = *(plen++);
+    nassertv(num_verts >= 3);
+
+    chromium.Begin(GL_TRIANGLE_STRIP);
+
+    // Per-component attributes for the first triangle?
+    issuer.issue_color(G_PER_COMPONENT, ci);
+    issuer.issue_normal(G_PER_COMPONENT, ni);
+
+    // Draw the first three vertices.
+    int v;
+    for (v = 0; v < 3; v++) {
+      issuer.issue_color(G_PER_VERTEX, ci);
+      issuer.issue_normal(G_PER_VERTEX, ni);
+      issuer.issue_texcoord(G_PER_VERTEX, ti);
+      issuer.issue_vertex(G_PER_VERTEX, vi);
+    }
+
+    // Now draw each of the remaining vertices.  Each vertex from
+    // this point on defines a new triangle.
+    for (v = 3; v < num_verts; v++) {
+      // Per-component attributes?
+      issuer.issue_color(G_PER_COMPONENT, ci);
+      issuer.issue_normal(G_PER_COMPONENT, ni);
+
+      // Per-vertex attributes.
+      issuer.issue_color(G_PER_VERTEX, ci);
+      issuer.issue_normal(G_PER_VERTEX, ni);
+      issuer.issue_texcoord(G_PER_VERTEX, ti);
+      issuer.issue_vertex(G_PER_VERTEX, vi);
+    }
+    chromium.End();
+  }
+  report_errors();
+  DO_PSTATS_STUFF(_draw_primitive_pcollector.stop());
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::draw_trifan
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+draw_trifan(GeomTrifan *geom, GeomContext *) {
+  //  activate();
+
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug() << "draw_trifan()" << endl;
+#endif
+
+#ifdef DO_PSTATS
+  //  PStatTimer timer(_draw_primitive_pcollector);
+  // Using PStatTimer may cause a compiler crash.
+  _draw_primitive_pcollector.start();
+  _vertices_trifan_pcollector.add_level(geom->get_num_vertices());
+#endif
+
+  issue_scene_graph_color();
+
+  int nprims = geom->get_num_prims();
+  const int *plen = geom->get_lengths();
+  Geom::VertexIterator vi = geom->make_vertex_iterator();
+  Geom::NormalIterator ni = geom->make_normal_iterator();
+  Geom::TexCoordIterator ti = geom->make_texcoord_iterator();
+  Geom::ColorIterator ci = geom->make_color_iterator();
+
+  GeomIssuer::IssueColor *issue_color;
+
+  if (!_color_transform_enabled && !_alpha_transform_enabled) {
+    issue_color = issue_color_gl;
+  }
+  else {
+    issue_color = issue_transformed_color_gl;
+  }
+
+  GeomIssuer issuer(geom, this,
+                    issue_vertex_gl,
+                    issue_normal_gl,
+                    issue_texcoord_gl,
+                    issue_color);
+
+  // If we have per-vertex colors or normals, we need smooth shading.
+  // Otherwise we want flat shading for performance reasons.
+  if ((geom->get_binding(G_COLOR) == G_PER_VERTEX && wants_colors()) ||
+      (geom->get_binding(G_NORMAL) == G_PER_VERTEX && wants_normals())) {
+    call_glShadeModel(GL_SMOOTH);
+  } else {
+    call_glShadeModel(GL_FLAT);
+  }
+
+  // Draw overall
+  issuer.issue_color(G_OVERALL, ci);
+  issuer.issue_normal(G_OVERALL, ni);
+
+  for (int i = 0; i < nprims; i++) {
+    // Draw per primitive
+    issuer.issue_color(G_PER_PRIM, ci);
+    issuer.issue_normal(G_PER_PRIM, ni);
+
+    int num_verts = *(plen++);
+    nassertv(num_verts >= 3);
+
+    chromium.Begin(GL_TRIANGLE_FAN);
+
+    // Per-component attributes for the first triangle?
+    issuer.issue_color(G_PER_COMPONENT, ci);
+    issuer.issue_normal(G_PER_COMPONENT, ni);
+
+    // Draw the first three vertices.
+    int v;
+    for (v = 0; v < 3; v++) {
+      issuer.issue_color(G_PER_VERTEX, ci);
+      issuer.issue_normal(G_PER_VERTEX, ni);
+      issuer.issue_texcoord(G_PER_VERTEX, ti);
+      issuer.issue_vertex(G_PER_VERTEX, vi);
+    }
+
+    // Now draw each of the remaining vertices.  Each vertex from
+    // this point on defines a new triangle.
+    for (v = 3; v < num_verts; v++) {
+      // Per-component attributes?
+      issuer.issue_color(G_PER_COMPONENT, ci);
+      issuer.issue_normal(G_PER_COMPONENT, ni);
+
+      // Per-vertex attributes.
+      issuer.issue_color(G_PER_VERTEX, ci);
+      issuer.issue_normal(G_PER_VERTEX, ni);
+      issuer.issue_texcoord(G_PER_VERTEX, ti);
+      issuer.issue_vertex(G_PER_VERTEX, vi);
+    }
+    chromium.End();
+  }
+  report_errors();
+  DO_PSTATS_STUFF(_draw_primitive_pcollector.stop());
+}
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::draw_sphere
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+draw_sphere(GeomSphere *geom, GeomContext *) {
+  //  activate();
+
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug() << "draw_sphere()" << endl;
+#endif
+
+#ifdef DO_PSTATS
+  //  PStatTimer timer(_draw_primitive_pcollector);
+  // Using PStatTimer may cause a compiler crash.
+  _draw_primitive_pcollector.start();
+  _vertices_other_pcollector.add_level(geom->get_num_vertices());
+#endif
+
+  issue_scene_graph_color();
+
+  int nprims = geom->get_num_prims();
+  Geom::VertexIterator vi = geom->make_vertex_iterator();
+  Geom::ColorIterator ci = geom->make_color_iterator();
+
+  GeomIssuer::IssueColor *issue_color;
+
+  if (!_color_transform_enabled && !_alpha_transform_enabled) {
+    issue_color = issue_color_gl;
+  }
+  else {
+    issue_color = issue_transformed_color_gl;
+  }
+
+  GeomIssuer issuer(geom, this,
+                    issue_vertex_gl,
+                    issue_normal_gl,
+                    issue_texcoord_gl,
+                    issue_color);
+
+  if (wants_normals()) {
+    call_glShadeModel(GL_SMOOTH);
+  } else {
+    call_glShadeModel(GL_FLAT);
+  }
+
+  // Draw overall
+  issuer.issue_color(G_OVERALL, ci);
+
+  GLUquadricObj *sph = gluNewQuadric();
+  gluQuadricNormals(sph, wants_normals() ? (GLenum)GLU_SMOOTH : (GLenum)GLU_NONE);
+  gluQuadricTexture(sph, wants_texcoords() ? (GLenum)GL_TRUE : (GLenum)GL_FALSE);
+  gluQuadricOrientation(sph, (GLenum)GLU_OUTSIDE);
+  gluQuadricDrawStyle(sph, (GLenum)GLU_FILL);
+  //gluQuadricDrawStyle(sph, (GLenum)GLU_LINE);
+
+  for (int i = 0; i < nprims; i++) {
+    // Draw per primitive
+    issuer.issue_color(G_PER_PRIM, ci);
+
+    for (int j = 0; j < 2; j++) {
+      // Draw per vertex
+      issuer.issue_color(G_PER_VERTEX, ci);
+    }
+    Vertexf center = geom->get_next_vertex(vi);
+    Vertexf edge = geom->get_next_vertex(vi);
+    LVector3f v = edge - center;
+    float r = sqrt(dot(v, v));
+
+    // Since gluSphere doesn't have a center parameter, we have to use
+    // a matrix transform.
+
+    chromium.MatrixMode(GL_MODELVIEW);
+    chromium.PushMatrix();
+    chromium.MultMatrixf(LMatrix4f::translate_mat(center).get_data());
+
+    // Now render the sphere using GLU calls.
+    gluSphere(sph, r, 16, 10);
+
+    chromium.MatrixMode(GL_MODELVIEW);
+    chromium.PopMatrix();
+  }
+
+  gluDeleteQuadric(sph);
+  report_errors();
+  DO_PSTATS_STUFF(_draw_primitive_pcollector.stop());
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::prepare_texture
+//       Access: Public, Virtual
+//  Description: Creates a new retained-mode representation of the
+//               given texture, and returns a newly-allocated
+//               TextureContext pointer to reference it.  It is the
+//               responsibility of the calling function to later
+//               call release_texture() with this same pointer (which
+//               will also delete the pointer).
+////////////////////////////////////////////////////////////////////
+TextureContext *CRGraphicsStateGuardian::
+prepare_texture(Texture *tex) {
+  //  activate();
+  CRTextureContext *gtc = new CRTextureContext(tex);
+  chromium.GenTextures(1, &gtc->_index);
+
+  bind_texture(gtc);
+  chromium.PrioritizeTextures(1, &gtc->_index, &gtc->_priority);
+  specify_texture(tex);
+  apply_texture_immediate(tex);
+
+  bool inserted = mark_prepared_texture(gtc);
+
+  // If this assertion fails, the same texture was prepared twice,
+  // which shouldn't be possible, since the texture itself should
+  // detect this.
+  nassertr(inserted, NULL);
+
+  report_errors();
+  return gtc;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::apply_texture
+//       Access: Public, Virtual
+//  Description: Makes the texture the currently available texture for
+//               rendering.
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+apply_texture(TextureContext *tc) {
+  //  activate();
+  add_to_texture_record(tc);
+  bind_texture(tc);
+
+  int dirty = tc->get_dirty_flags();
+  if ((dirty & (Texture::DF_wrap | Texture::DF_filter)) != 0) {
+    // We need to re-specify the texture properties.
+    specify_texture(tc->_texture);
+  }
+  if ((dirty & (Texture::DF_image | Texture::DF_mipmap)) != 0) {
+    // We need to re-apply the image.
+    apply_texture_immediate(tc->_texture);
+  }
+
+  tc->clear_dirty_flags();
+
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::release_texture
+//       Access: Public, Virtual
+//  Description: Frees the GL resources previously allocated for the
+//               texture.
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+release_texture(TextureContext *tc) {
+  //  activate();
+  CRTextureContext *gtc = DCAST(CRTextureContext, tc);
+  Texture *tex = tc->_texture;
+
+  if (!is_closed()) {
+    chromium.DeleteTextures(1, &gtc->_index);
+  }
+  gtc->_index = 0;
+
+  bool erased = unmark_prepared_texture(gtc);
+
+  // If this assertion fails, a texture was released that hadn't been
+  // prepared (or a texture was released twice).
+  nassertv(erased);
+
+  tex->clear_gsg(this);
+
+  delete gtc;
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::prepare_geom_node
+//       Access: Public, Virtual
+//  Description: Prepares the indicated GeomNode for retained-mode
+//               rendering.  If this function returns non-NULL, the
+//               value returned will be passed back to a future call
+//               to draw_geom_node(), which is expected to draw the
+//               contents of the node.
+////////////////////////////////////////////////////////////////////
+GeomNodeContext *CRGraphicsStateGuardian::
+prepare_geom_node(GeomNode *node) {
+  // Make sure we have at least some static Geoms in the GeomNode;
+  // otherwise there's no point in building a display list.
+  int num_geoms = node->get_num_geoms();
+  bool all_dynamic = true;
+  int i;
+
+  for (i = 0; (i < num_geoms) && all_dynamic; i++) {
+    dDrawable *geom = node->get_geom(i);
+    all_dynamic = geom->is_dynamic();
+  }
+  if (all_dynamic) {
+    // Never mind.
+    return (GeomNodeContext *)NULL;
+  }
+
+  // Ok, we've got something; use it.
+  CRGeomNodeContext *ggnc = new CRGeomNodeContext(node);
+  ggnc->_index = chromium.GenLists(1);
+  if (ggnc->_index == 0) {
+    crgsg_cat.error()
+      << "Ran out of display list indices.\n";
+    delete ggnc;
+    return (GeomNodeContext *)NULL;
+  }
+
+  // We need to temporarily force normals and UV's on, so the display
+  // list will have them built in.
+  bool old_normals_enabled = _normals_enabled;
+  bool old_texturing_enabled = _texturing_enabled;
+  bool old_vertex_colors_enabled = _vertex_colors_enabled;
+  _normals_enabled = true;
+  _texturing_enabled = true;
+  _vertex_colors_enabled = true;
+
+#ifdef DO_PSTATS
+  // Count up the number of vertices we're about to render, by
+  // checking the PStats vertex counters now, and at the end.  This is
+  // kind of hacky, but this is debug code.
+  float num_verts_before = 
+    _vertices_tristrip_pcollector.get_level() +
+    _vertices_trifan_pcollector.get_level() +
+    _vertices_tri_pcollector.get_level() +
+    _vertices_other_pcollector.get_level();
+#endif
+
+  // Now define the display list.
+  chromium.NewList(ggnc->_index, GL_COMPILE);
+  for (i = 0; i < num_geoms; i++) {
+    dDrawable *geom = node->get_geom(i);
+    if (geom->is_dynamic()) {
+      // Wait, this is a dynamic Geom.  We can't safely put it in the
+      // display list, because it may change from one frame to the
+      // next; instead, we'll keep it out.
+      ggnc->_dynamic_geoms.push_back(geom);
+    } else {
+      // A static Geom becomes part of the display list.
+      geom->draw(this);
+    }
+  }
+  chromium.EndList();
+
+#ifdef DO_PSTATS
+  float num_verts_after = 
+    _vertices_tristrip_pcollector.get_level() +
+    _vertices_trifan_pcollector.get_level() +
+    _vertices_tri_pcollector.get_level() +
+    _vertices_other_pcollector.get_level();
+  float num_verts = num_verts_after - num_verts_before;
+  ggnc->_num_verts = (int)(num_verts + 0.5);
+#endif
+
+  _normals_enabled = old_normals_enabled;
+  _texturing_enabled = old_texturing_enabled;
+  _vertex_colors_enabled = old_vertex_colors_enabled;
+
+  bool inserted = mark_prepared_geom_node(ggnc);
+
+  // If this assertion fails, the same GeomNode was prepared twice,
+  // which shouldn't be possible, since the GeomNode itself should
+  // detect this.
+  nassertr(inserted, NULL);
+
+  return ggnc;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::draw_geom_node
+//       Access: Public, Virtual
+//  Description: Draws a GeomNode previously indicated by a call to
+//               prepare_geom_node().
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+draw_geom_node(GeomNode *node, GeomNodeContext *gnc) {
+  if (gnc == (GeomNodeContext *)NULL) {
+    // We don't have a saved context; just draw the GeomNode in
+    // immediate mode.
+    int num_geoms = node->get_num_geoms();
+    for (int i = 0; i < num_geoms; i++) {
+      node->get_geom(i)->draw(this);
+    }
+
+  } else {
+    // We do have a saved context; use it.
+    add_to_geom_node_record(gnc);
+    CRGeomNodeContext *ggnc = DCAST(CRGeomNodeContext, gnc);
+    chromium.CallList(ggnc->_index);
+
+#ifdef DO_PSTATS 
+    PStatTimer timer(_draw_primitive_pcollector);
+    _vertices_display_list_pcollector.add_level(ggnc->_num_verts);
+#endif
+
+    // Also draw all the dynamic Geoms.
+    int num_geoms = ggnc->_dynamic_geoms.size();
+    for (int i = 0; i < num_geoms; i++) {
+      ggnc->_dynamic_geoms[i]->draw(this);
+    }
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::release_geom_node
+//       Access: Public, Virtual
+//  Description: Frees the resources previously allocated via a call
+//               to prepare_geom_node(), including deleting the
+//               GeomNodeContext itself, if necessary.
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+release_geom_node(GeomNodeContext *gnc) {
+  if (gnc != (GeomNodeContext *)NULL) {
+    CRGeomNodeContext *ggnc = DCAST(CRGeomNodeContext, gnc);
+    chromium.DeleteLists(ggnc->_index, 1);
+
+    bool erased = unmark_prepared_geom_node(ggnc);
+
+    // If this assertion fails, a GeomNode was released that hadn't
+    // been prepared (or a GeomNode was released twice).
+    nassertv(erased);
+    
+    ggnc->_node->clear_gsg(this);
+    delete ggnc;
+  }
+}
+
+static int logs[] = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048,
+                      4096, 0 };
+
+// This function returns the smallest power of two greater than or
+// equal to x.
+static int binary_log_cap(const int x) {
+  int i = 0;
+  for (; (x > logs[i]) && (logs[i] != 0); ++i);
+  if (logs[i] == 0)
+    return 4096;
+  return logs[i];
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::copy_texture
+//       Access: Public, Virtual
+//  Description: Copy the pixel region indicated by the display
+//               region from the framebuffer into texture memory
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+copy_texture(TextureContext *tc, const DisplayRegion *dr) {
+  nassertv(tc != NULL && dr != NULL);
+  //  activate();
+
+  Texture *tex = tc->_texture;
+
+  // Determine the size of the grab from the given display region
+  // If the requested region is not a power of two, grab a region that is
+  // a power of two that contains the requested region
+  int xo, yo, req_w, req_h;
+  dr->get_region_pixels(xo, yo, req_w, req_h);
+  int w = binary_log_cap(req_w);
+  int h = binary_log_cap(req_h);
+  if (w != req_w || h != req_h) {
+    tex->_requested_w = req_w;
+    tex->_requested_h = req_h;
+    tex->_has_requested_size = true;
+  }
+
+  PixelBuffer *pb = tex->_pbuffer;
+
+  pb->set_xorg(xo);
+  pb->set_yorg(yo);
+  pb->set_xsize(w);
+  pb->set_ysize(h);
+
+  bind_texture(tc);
+
+  chromium.CopyTexImage2D(GL_TEXTURE_2D, 0,
+                   get_internal_image_format(pb->get_format()),
+                   pb->get_xorg(), pb->get_yorg(),
+                   pb->get_xsize(), pb->get_ysize(), pb->get_border());
+  clear_attribute(TextureTransition::get_class_type());
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::copy_texture
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+copy_texture(TextureContext *tc, const DisplayRegion *dr, const RenderBuffer &rb) {
+  //  activate();
+  set_read_buffer(rb);
+  copy_texture(tc, dr);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::draw_texture
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+draw_texture(TextureContext *tc, const DisplayRegion *dr) {
+  nassertv(tc != NULL && dr != NULL);
+  //  activate();
+
+  Texture *tex = tc->_texture;
+
+  DisplayRegionStack old_dr = push_display_region(dr);
+  prepare_display_region();
+
+  NodeTransitions state;
+  CullFaceTransition *cfa = new CullFaceTransition;
+  cfa->set_mode(CullFaceProperty::M_cull_none);
+  DepthTestTransition *dta = new DepthTestTransition;
+  dta->set_mode(DepthTestProperty::M_none);
+  DepthWriteTransition *dwa = new DepthWriteTransition;
+  dwa->set_off();
+  TextureTransition *ta = new TextureTransition;
+  ta->set_on(tex);
+  TextureApplyTransition *taa = new TextureApplyTransition;
+  taa->set_mode(TextureApplyProperty::M_decal);
+
+  state.set_transition(new LightTransition);
+  state.set_transition(new ColorMaskTransition);
+  state.set_transition(new RenderModeTransition);
+  state.set_transition(new TexMatrixTransition);
+  state.set_transition(new TransformTransition);
+  state.set_transition(new ColorBlendTransition);
+  state.set_transition(cfa);
+  state.set_transition(dta);
+  state.set_transition(dwa);
+  state.set_transition(ta);
+  state.set_transition(taa);
+  modify_state(state);
+
+  // We set up an orthographic projection that defines our entire
+  // viewport to the range [0..1] in both dimensions.  Then, when we
+  // create a unit square polygon below, it will exactly fill the
+  // viewport (and thus exactly fill the display region).
+  chromium.MatrixMode(GL_PROJECTION);
+  chromium.PushMatrix();
+  chromium.LoadIdentity();
+  gluOrtho2D(0, 1, 0, 1);
+
+  float txl, txr, tyt, tyb;
+  txl = tyb = 0.;
+  if (tex->_has_requested_size) {
+    txr = ((float)(tex->_requested_w)) / ((float)(tex->_pbuffer->get_xsize()));
+    tyt = ((float)(tex->_requested_h)) / ((float)(tex->_pbuffer->get_ysize()));
+  } else {
+    txr = tyt = 1.;
+  }
+
+  // This two-triangle strip is actually a quad.  But it's usually
+  // better to render quads as tristrips anyway.
+  chromium.Begin(GL_TRIANGLE_STRIP);
+  chromium.TexCoord2f(txl, tyb);   chromium.Vertex2i(0, 0);
+  chromium.TexCoord2f(txr, tyb);   chromium.Vertex2i(1, 0);
+  chromium.TexCoord2f(txl, tyt);   chromium.Vertex2i(0, 1);
+  chromium.TexCoord2f(txr, tyt);   chromium.Vertex2i(1, 1);
+  chromium.End();
+
+  chromium.MatrixMode(GL_PROJECTION);
+  chromium.PopMatrix();
+
+  pop_display_region(old_dr);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::draw_texture
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+draw_texture(TextureContext *tc, const DisplayRegion *dr, const RenderBuffer &rb) {
+  //  activate();
+  set_draw_buffer(rb);
+  draw_texture(tc, dr);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::texture_to_pixel_buffer
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+texture_to_pixel_buffer(TextureContext *tc, PixelBuffer *pb) {
+  nassertv(tc != NULL && pb != NULL);
+  //  activate();
+
+  Texture *tex = tc->_texture;
+
+  int w = tex->_pbuffer->get_xsize();
+  int h = tex->_pbuffer->get_ysize();
+
+  PT(DisplayRegion) dr = _win->make_scratch_display_region(w, h);
+
+  FrameBufferStack old_fb = push_frame_buffer
+    (get_render_buffer(RenderBuffer::T_back | RenderBuffer::T_depth),
+     dr);
+
+  texture_to_pixel_buffer(tc, pb, dr);
+
+  pop_frame_buffer(old_fb);
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::texture_to_pixel_buffer
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+texture_to_pixel_buffer(TextureContext *tc, PixelBuffer *pb,
+                        const DisplayRegion *dr) {
+  nassertv(tc != NULL && pb != NULL && dr != NULL);
+  //  activate();
+
+  Texture *tex = tc->_texture;
+
+  // Do a deep copy to initialize the pixel buffer
+  pb->copy(tex->_pbuffer);
+
+  // If the image was empty, we need to render the texture into the frame
+  // buffer and then copy the results into the pixel buffer's image
+  if (pb->_image.empty()) {
+    int w = pb->get_xsize();
+    int h = pb->get_ysize();
+    draw_texture(tc, dr);
+    pb->_image = PTA_uchar::empty_array(w * h * pb->get_num_components());
+    copy_pixel_buffer(pb, dr);
+  }
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::copy_pixel_buffer
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+copy_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr) {
+  nassertv(pb != NULL && dr != NULL);
+  //  activate();
+  set_pack_alignment(1);
+
+  // Bug fix for RE, RE2, and VTX - need to disable texturing in order
+  // for chromium.ReadPixels() to work
+  // NOTE: reading the depth buffer is *much* slower than reading the
+  // color buffer
+  clear_attribute(TextureTransition::get_class_type());
+
+  int xo, yo, w, h;
+  dr->get_region_pixels(xo, yo, w, h);
+
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug()
+    << "crReadPixels(" << pb->get_xorg() << ", " << pb->get_yorg()
+    << ", " << pb->get_xsize() << ", " << pb->get_ysize()
+    << ", ";
+  switch (get_external_image_format(pb->get_format())) {
+  case GL_DEPTH_COMPONENT:
+    crgsg_cat.debug(false) << "GL_DEPTH_COMPONENT, ";
+    break;
+  case GL_RGB:
+    crgsg_cat.debug(false) << "GL_RGB, ";
+    break;
+  case GL_RGBA:
+    crgsg_cat.debug(false) << "GL_RGBA, ";
+    break;
+#ifdef GL_BGR
+  case GL_BGR:
+    crgsg_cat.debug(false) << "GL_BGR, ";
+    break;
+  case GL_BGRA:
+    crgsg_cat.debug(false) << "GL_BGRA, ";
+    break;
+#endif  // GL_BGR
+  default:
+    crgsg_cat.debug(false) << "unknown, ";
+    break;
+  }
+  switch (get_image_type(pb->get_image_type())) {
+  case GL_UNSIGNED_BYTE:
+    crgsg_cat.debug(false) << "GL_UNSIGNED_BYTE, ";
+    break;
+  case GL_FLOAT:
+    crgsg_cat.debug(false) << "GL_FLOAT, ";
+    break;
+  default:
+    crgsg_cat.debug(false) << "unknown, ";
+    break;
+  }
+  crgsg_cat.debug(false)
+    << (void *)pb->_image.p() << ")" << endl;
+#endif
+
+  // pixelbuffer "origin" represents upper left screen point at which
+  // pixelbuffer should be drawn using draw_pixel_buffer
+  nassertv(!pb->_image.empty());
+  chromium.ReadPixels(pb->get_xorg() + xo, pb->get_yorg() + yo,
+               pb->get_xsize(), pb->get_ysize(),
+               get_external_image_format(pb->get_format()),
+               get_image_type(pb->get_image_type()),
+               pb->_image.p());
+
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::copy_pixel_buffer
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+copy_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr,
+                  const RenderBuffer &rb) {
+  //  activate();
+  set_read_buffer(rb);
+  copy_pixel_buffer(pb, dr);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::draw_pixel_buffer
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+draw_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr,
+                  const NodeTransitions& na) {
+  nassertv(pb != NULL && dr != NULL);
+  nassertv(!pb->_image.empty());
+  //  activate();
+
+  DisplayRegionStack old_dr = push_display_region(dr);
+  prepare_display_region();
+
+  NodeTransitions state(na);
+  state.set_transition(new LightTransition);
+  state.set_transition(new TextureTransition);
+  state.set_transition(new TransformTransition);
+  //state.set_transition(new ColorBlendTransition);
+  state.set_transition(new StencilTransition);
+
+  switch (pb->get_format()) {
+  case PixelBuffer::F_depth_component:
+    {
+      ColorMaskTransition *cma = new ColorMaskTransition(0);
+      DepthTestTransition *dta = new DepthTestTransition(DepthTestProperty::M_always);
+      DepthWriteTransition *dwa = new DepthWriteTransition;
+      state.set_transition(cma);
+      state.set_transition(dta);
+      state.set_transition(dwa);
+    }
+    break;
+
+  case PixelBuffer::F_rgb:
+  case PixelBuffer::F_rgb5:
+  case PixelBuffer::F_rgb8:
+  case PixelBuffer::F_rgb12:
+  case PixelBuffer::F_rgba:
+  case PixelBuffer::F_rgbm:
+  case PixelBuffer::F_rgba4:
+  case PixelBuffer::F_rgba5:
+  case PixelBuffer::F_rgba8:
+  case PixelBuffer::F_rgba12:
+    {
+      ColorMaskTransition *cma = new ColorMaskTransition;
+      DepthTestTransition *dta = new DepthTestTransition(DepthTestProperty::M_none);
+      DepthWriteTransition *dwa = new DepthWriteTransition(DepthWriteTransition::off());
+      state.set_transition(cma);
+      state.set_transition(dta);
+      state.set_transition(dwa);
+    }
+    break;
+  default:
+    crgsg_cat.error()
+      << "draw_pixel_buffer(): unknown buffer format" << endl;
+    break;
+  }
+
+  modify_state(state);
+
+  set_unpack_alignment(1);
+
+  chromium.MatrixMode( GL_PROJECTION );
+  chromium.PushMatrix();
+  chromium.LoadIdentity();
+  gluOrtho2D(0, _win->get_width(),
+             0, _win->get_height());
+
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug()
+    << "crDrawPixels(" << pb->get_xsize() << ", " << pb->get_ysize()
+    << ", ";
+  switch (get_external_image_format(pb->get_format())) {
+  case GL_DEPTH_COMPONENT:
+    crgsg_cat.debug(false) << "GL_DEPTH_COMPONENT, ";
+    break;
+  case GL_RGB:
+    crgsg_cat.debug(false) << "GL_RGB, ";
+    break;
+  case GL_RGBA:
+    crgsg_cat.debug(false) << "GL_RGBA, ";
+    break;
+#ifdef GL_BGR
+  case GL_BGR:
+    crgsg_cat.debug(false) << "GL_BGR, ";
+    break;
+  case GL_BGRA:
+    crgsg_cat.debug(false) << "GL_BGRA, ";
+    break;
+#endif  // GL_BGR
+  default:
+    crgsg_cat.debug(false) << "unknown, ";
+    break;
+  }
+  switch (get_image_type(pb->get_image_type())) {
+  case GL_UNSIGNED_BYTE:
+    crgsg_cat.debug(false) << "GL_UNSIGNED_BYTE, ";
+    break;
+  case GL_FLOAT:
+    crgsg_cat.debug(false) << "GL_FLOAT, ";
+    break;
+  default:
+    crgsg_cat.debug(false) << "unknown, ";
+    break;
+  }
+  crgsg_cat.debug(false)
+    << (void *)pb->_image.p() << ")" << endl;
+#endif
+
+  chromium.RasterPos2i( pb->get_xorg(), pb->get_yorg() );
+  chromium.DrawPixels( pb->get_xsize(), pb->get_ysize(),
+                get_external_image_format(pb->get_format()),
+                get_image_type(pb->get_image_type()),
+                pb->_image.p() );
+
+  chromium.MatrixMode( GL_PROJECTION );
+  chromium.PopMatrix();
+
+  pop_display_region(old_dr);
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::draw_pixel_buffer
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+draw_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr,
+                  const RenderBuffer &rb, const NodeTransitions& na) {
+  //  activate();
+  set_draw_buffer(rb);
+  draw_pixel_buffer(pb, dr, na);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::apply_material
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::apply_material(const Material *material) {
+  GLenum face = material->get_twoside() ? GL_FRONT_AND_BACK : GL_FRONT;
+
+  chromium.Materialfv(face, GL_SPECULAR, material->get_specular().get_data());
+  chromium.Materialfv(face, GL_EMISSION, material->get_emission().get_data());
+  chromium.Materialf(face, GL_SHININESS, material->get_shininess());
+
+  if (material->has_ambient() && material->has_diffuse()) {
+    // The material has both an ambient and diffuse specified.  This
+    // means we do not need chromium.MaterialColor().
+    chromium.Disable(GL_COLOR_MATERIAL);
+    chromium.Materialfv(face, GL_AMBIENT, material->get_ambient().get_data());
+    chromium.Materialfv(face, GL_DIFFUSE, material->get_diffuse().get_data());
+
+  } else if (material->has_ambient()) {
+    // The material specifies an ambient, but not a diffuse component.
+    // The diffuse component comes from the object's color.
+    chromium.Materialfv(face, GL_AMBIENT, material->get_ambient().get_data());
+    chromium.ColorMaterial(face, GL_DIFFUSE);
+    chromium.Enable(GL_COLOR_MATERIAL);
+
+  } else if (material->has_diffuse()) {
+    // The material specifies a diffuse, but not an ambient component.
+    // The ambient component comes from the object's color.
+    chromium.Materialfv(face, GL_DIFFUSE, material->get_diffuse().get_data());
+    chromium.ColorMaterial(face, GL_AMBIENT);
+    chromium.Enable(GL_COLOR_MATERIAL);
+
+  } else {
+    // The material specifies neither a diffuse nor an ambient
+    // component.  Both components come from the object's color.
+    chromium.ColorMaterial(face, GL_AMBIENT_AND_DIFFUSE);
+    chromium.Enable(GL_COLOR_MATERIAL);
+  }
+
+  call_glLightModelLocal(material->get_local());
+  call_glLightModelTwoSide(material->get_twoside());
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::apply_fog
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+apply_fog(Fog *fog) {
+  Fog::Mode fmode = fog->get_mode();
+  call_glFogMode(get_fog_mode_type(fmode));
+
+  if (fmode == Fog::M_linear) {
+    // Linear fog may be world-relative or camera-relative.  The fog
+    // object knows how to decode its parameters into camera-relative
+    // properties.
+    float onset, opaque;
+    fog->compute_linear_range(onset, opaque, _current_camera,
+                              _coordinate_system);
+    call_glFogStart(onset);
+    call_glFogEnd(opaque);
+
+  } else {
+    // Exponential fog is always camera-relative.
+    call_glFogDensity(fog->get_exp_density());
+  }
+
+  call_glFogColor(fog->get_color());
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::apply_light
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::apply_light( PointLight* light )
+{
+  // The light position will be relative to the current matrix, so
+  // we have to know what the current matrix is.  Find a better
+  // solution later.
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug()
+    << "crMatrixMode(GL_MODELVIEW)" << endl;
+  crgsg_cat.debug()
+    << "crPushMatrix()" << endl;
+  crgsg_cat.debug()
+    << "crLoadIdentity()" << endl;
+#endif
+  chromium.MatrixMode(GL_MODELVIEW);
+  chromium.PushMatrix();
+
+  chromium.LoadMatrixf(LMatrix4f::convert_mat(_coordinate_system, CS_yup_right)
+                .get_data());
+
+  GLenum id = get_light_id( _cur_light_id );
+  Colorf black(0, 0, 0, 1);
+  chromium.Lightfv(id, GL_AMBIENT, black.get_data());
+  chromium.Lightfv(id, GL_DIFFUSE, light->get_color().get_data());
+  chromium.Lightfv(id, GL_SPECULAR, light->get_specular().get_data());
+
+    // Position needs to specify x, y, z, and w
+    // w == 1 implies non-infinite position
+  LPoint3f pos = get_rel_pos( light, _current_camera );
+  LPoint4f fpos( pos[0], pos[1], pos[2], 1 );
+  chromium.Lightfv( id, GL_POSITION, fpos.get_data() );
+
+  // GL_SPOT_DIRECTION is not significant when cutoff == 180
+
+    // Exponent == 0 implies uniform light distribution
+  chromium.Lightf( id, GL_SPOT_EXPONENT, 0 );
+
+  // Cutoff == 180 means uniform point light source
+  chromium.Lightf( id, GL_SPOT_CUTOFF, 180.0 );
+
+  chromium.Lightf( id, GL_CONSTANT_ATTENUATION,
+            light->get_constant_attenuation() );
+  chromium.Lightf( id, GL_LINEAR_ATTENUATION,
+            light->get_linear_attenuation() );
+  chromium.Lightf( id, GL_QUADRATIC_ATTENUATION,
+            light->get_quadratic_attenuation() );
+
+  chromium.PopMatrix();
+
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug()
+    << "crPopMatrix()" << endl;
+#endif
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::apply_light
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::apply_light( DirectionalLight* light )
+{
+  // The light position will be relative to the current matrix, so
+  // we have to know what the current matrix is.  Find a better
+  // solution later.
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug()
+    << "crMatrixMode(GL_MODELVIEW)" << endl;
+  crgsg_cat.debug()
+    << "crPushMatrix()" << endl;
+  crgsg_cat.debug()
+    << "crLoadIdentity()" << endl;
+#endif
+  chromium.MatrixMode(GL_MODELVIEW);
+  chromium.PushMatrix();
+  chromium.LoadMatrixf(LMatrix4f::convert_mat(_coordinate_system, CS_yup_right)
+                .get_data());
+
+  GLenum id = get_light_id( _cur_light_id );
+  Colorf black(0, 0, 0, 1);
+  chromium.Lightfv(id, GL_AMBIENT, black.get_data());
+  chromium.Lightfv(id, GL_DIFFUSE, light->get_color().get_data());
+  chromium.Lightfv(id, GL_SPECULAR, light->get_specular().get_data());
+
+    // Position needs to specify x, y, z, and w
+    // w == 0 implies light is at infinity
+  LPoint3f dir = get_rel_forward( light, _current_camera,
+                                  _coordinate_system );
+  LPoint4f pos( -dir[0], -dir[1], -dir[2], 0 );
+  chromium.Lightfv( id, GL_POSITION, pos.get_data() );
+
+  // GL_SPOT_DIRECTION is not significant when cutoff == 180
+  // In this case, position x, y, z specifies direction
+
+  // Exponent == 0 implies uniform light distribution
+  chromium.Lightf( id, GL_SPOT_EXPONENT, 0 );
+
+  // Cutoff == 180 means uniform point light source
+  chromium.Lightf( id, GL_SPOT_CUTOFF, 180.0 );
+
+  // Default attenuation values (only spotlight can modify these)
+  chromium.Lightf( id, GL_CONSTANT_ATTENUATION, 1 );
+  chromium.Lightf( id, GL_LINEAR_ATTENUATION, 0 );
+  chromium.Lightf( id, GL_QUADRATIC_ATTENUATION, 0 );
+
+  chromium.PopMatrix();
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug()
+    << "crPopMatrix()" << endl;
+#endif
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::apply_light
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::apply_light( Spotlight* light )
+{
+  // The light position will be relative to the current matrix, so
+  // we have to know what the current matrix is.  Find a better
+  // solution later.
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug()
+    << "crMatrixMode(GL_MODELVIEW)" << endl;
+  crgsg_cat.debug()
+    << "crPushMatrix()" << endl;
+  crgsg_cat.debug()
+    << "crLoadIdentity()" << endl;
+#endif
+  chromium.MatrixMode(GL_MODELVIEW);
+  chromium.PushMatrix();
+  chromium.LoadMatrixf(LMatrix4f::convert_mat(_coordinate_system, CS_yup_right)
+                .get_data());
+
+  GLenum id = get_light_id( _cur_light_id );
+  Colorf black(0, 0, 0, 1);
+  chromium.Lightfv(id, GL_AMBIENT, black.get_data());
+  chromium.Lightfv(id, GL_DIFFUSE, light->get_color().get_data());
+  chromium.Lightfv(id, GL_SPECULAR, light->get_specular().get_data());
+
+    // Position needs to specify x, y, z, and w
+    // w == 1 implies non-infinite position
+  LPoint3f pos = get_rel_pos( light, _current_camera );
+  LPoint4f fpos( pos[0], pos[1], pos[2], 1 );
+  chromium.Lightfv( id, GL_POSITION, fpos.get_data() );
+
+  chromium.Lightfv( id, GL_SPOT_DIRECTION,
+             get_rel_forward( light, _current_camera,
+                              _coordinate_system ).get_data() );
+  chromium.Lightf( id, GL_SPOT_EXPONENT, light->get_exponent() );
+  chromium.Lightf( id, GL_SPOT_CUTOFF,
+            light->get_cutoff_angle() );
+  chromium.Lightf( id, GL_CONSTANT_ATTENUATION,
+            light->get_constant_attenuation() );
+  chromium.Lightf( id, GL_LINEAR_ATTENUATION,
+            light->get_linear_attenuation() );
+  chromium.Lightf( id, GL_QUADRATIC_ATTENUATION,
+            light->get_quadratic_attenuation() );
+
+  chromium.PopMatrix();
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug()
+    << "crPopMatrix()" << endl;
+#endif
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::apply_light
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::apply_light( AmbientLight* )
+{
+  // Ambient lights are handled as a special case in issue_light().
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_transform
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_transform(const TransformTransition *attrib) {
+  //  activate();
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug()
+    << "crLoadMatrix(GL_MODELVIEW): " << attrib->get_matrix() << endl;
+#endif
+  chromium.MatrixMode(GL_MODELVIEW);
+  chromium.LoadMatrixf(attrib->get_matrix().get_data());
+
+#ifndef NDEBUG
+  if (cr_show_transforms) {
+    bool lighting_was_enabled = _lighting_enabled;
+    bool texturing_was_enabled = _texturing_enabled;
+    enable_lighting(false);
+    enable_texturing(false);
+
+    chromium.Begin(GL_LINES);
+
+    // X axis in red
+    chromium.Color3f(1.0f, 0.0f, 0.0f);
+    chromium.Vertex3f(0.0f, 0.0f, 0.0f);
+    chromium.Vertex3f(1.0f, 0.0f, 0.0f);
+
+    // Y axis in green
+    chromium.Color3f(0.0f, 1.0f, 0.0f);
+    chromium.Vertex3f(0.0f, 0.0f, 0.0f);
+    chromium.Vertex3f(0.0f, 1.0f, 0.0f);
+
+    // Z axis in blue
+    chromium.Color3f(0.0f, 0.0f, 1.0f);
+    chromium.Vertex3f(0.0f, 0.0f, 0.0f);
+    chromium.Vertex3f(0.0f, 0.0f, 1.0f);
+
+    chromium.End();
+    enable_lighting(lighting_was_enabled);
+    enable_texturing(texturing_was_enabled);
+  }
+#endif
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_color_transform
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_color_transform(const ColorMatrixTransition *attrib) {
+  _current_color_mat = attrib->get_matrix();
+
+  if (_current_color_mat == LMatrix4f::ident_mat()) {
+    _color_transform_enabled = false;
+  } else {
+    _color_transform_enabled = true;
+  }
+
+  _issued_color_stale = _has_scene_graph_color;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_alpha_transform
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_alpha_transform(const AlphaTransformTransition *attrib) {
+  _current_alpha_offset= attrib->get_offset();
+  _current_alpha_scale = attrib->get_scale();
+
+  if (_current_alpha_offset == 0 && _current_alpha_scale == 1) {
+    _alpha_transform_enabled = false;
+  } else {
+    _alpha_transform_enabled = true;
+  }
+
+  _issued_color_stale = _has_scene_graph_color;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_matrix
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_tex_matrix(const TexMatrixTransition *attrib) {
+  //  activate();
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug()
+    << "crLoadMatrix(GL_TEXTURE): " << attrib->get_matrix() << endl;
+#endif
+  chromium.MatrixMode(GL_TEXTURE);
+  chromium.LoadMatrixf(attrib->get_matrix().get_data());
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_color
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_color(const ColorTransition *attrib) {
+  if (attrib->is_on()) {
+    if (attrib->is_real()) {
+      // The color attribute is "on" and "real": it specifies a scene
+      // graph color that overrides the vertex color.
+      _scene_graph_color = attrib->get_color();
+      _has_scene_graph_color = true;
+      _vertex_colors_enabled = false;
+      _issued_color_stale = true;
+
+    } else {
+      // The color attribute is "on" but not "real": it specifies that
+      // no scene graph color is in effect, but vertex color is not
+      // important either.
+      _has_scene_graph_color = false;
+      _issued_color_stale = false;
+      _vertex_colors_enabled = false;
+    }
+  } else {
+    // The color attribute is "off": it specifies that vertex color
+    // should be revealed.
+    _has_scene_graph_color = false;
+    _issued_color_stale = false;
+    _vertex_colors_enabled = true;
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_texture
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_texture(const TextureTransition *attrib) {
+  //  activate();
+
+  if (attrib->is_on()) {
+    enable_texturing(true);
+    Texture *tex = attrib->get_texture();
+    nassertv(tex != (Texture *)NULL);
+    tex->apply(this);
+  } else {
+    enable_texturing(false);
+  }
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_tex_gen
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_tex_gen(const TexGenTransition *attrib) {
+  //  activate();
+  TexGenProperty::Mode mode = attrib->get_mode();
+
+  switch (mode) {
+  case TexGenProperty::M_none:
+    chromium.Disable(GL_TEXTURE_GEN_S);
+    chromium.Disable(GL_TEXTURE_GEN_T);
+    chromium.Disable(GL_TEXTURE_GEN_Q);
+    chromium.Disable(GL_TEXTURE_GEN_R);
+    break;
+
+  case TexGenProperty::M_texture_projector:
+    {
+      chromium.Enable(GL_TEXTURE_GEN_S);
+      chromium.Enable(GL_TEXTURE_GEN_T);
+      chromium.Enable(GL_TEXTURE_GEN_Q);
+      chromium.Enable(GL_TEXTURE_GEN_R);
+      const LMatrix4f &plane = attrib->get_plane();
+      chromium.TexGenfv(GL_S, GL_OBJECT_PLANE, plane.get_row(0).get_data());
+      chromium.TexGenfv(GL_T, GL_OBJECT_PLANE, plane.get_row(1).get_data());
+      chromium.TexGenfv(GL_R, GL_OBJECT_PLANE, plane.get_row(2).get_data());
+      chromium.TexGenfv(GL_Q, GL_OBJECT_PLANE, plane.get_row(3).get_data());
+      chromium.TexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+      chromium.TexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+      chromium.TexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+      chromium.TexGeni(GL_Q, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+    }
+    break;
+
+  case TexGenProperty::M_sphere_map:
+    chromium.Enable(GL_TEXTURE_GEN_S);
+    chromium.Enable(GL_TEXTURE_GEN_T);
+    chromium.Disable(GL_TEXTURE_GEN_Q);
+    chromium.Disable(GL_TEXTURE_GEN_R);
+    chromium.TexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
+    chromium.TexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
+    break;
+
+  default:
+    crgsg_cat.error()
+      << "Unknown texgen mode " << (int)mode << endl;
+    break;
+  }
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_material
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_material(const MaterialTransition *attrib) {
+  //  activate();
+  if (attrib->is_on()) {
+    const Material *material = attrib->get_material();
+    nassertv(material != (const Material *)NULL);
+    apply_material(material);
+  }
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_fog
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_fog(const FogTransition *attrib) {
+  //  activate();
+
+  if (attrib->is_on()) {
+    enable_fog(true);
+    Fog *fog = attrib->get_fog();
+    nassertv(fog != (Fog *)NULL);
+    fog->apply(this);
+  } else {
+    enable_fog(false);
+  }
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_render_mode
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_render_mode(const RenderModeTransition *attrib) {
+  //  activate();
+
+  RenderModeProperty::Mode mode = attrib->get_mode();
+
+  switch (mode) {
+  case RenderModeProperty::M_filled:
+    call_glPolygonMode(GL_FILL);
+    break;
+
+  case RenderModeProperty::M_wireframe:
+    // Make sure line width is back to default (1 pixel)
+    call_glLineWidth(attrib->get_line_width());
+    call_glPolygonMode(GL_LINE);
+    break;
+
+  default:
+    crgsg_cat.error()
+      << "Unknown render mode " << (int)mode << endl;
+  }
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_light
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::issue_light(const LightTransition *attrib )
+{
+  nassertv(attrib->get_default_dir() != TD_on);
+  //  activate();
+
+  // Initialize the current ambient light total and newly enabled
+  // light list
+  Colorf cur_ambient_light(0.0f, 0.0f, 0.0f, 1.0f);
+  int i;
+  for (i = 0; i < _max_lights; i++) {
+    _light_info[i]._next_enabled = false;
+  }
+
+  int num_enabled = 0;
+  LightTransition::const_iterator li;
+  for (li = attrib->begin(); li != attrib->end(); ++li) {
+    Light *light = (*li).first;
+    nassertv(light != (Light *)NULL);
+    TransitionDirection dir = (*li).second;
+
+    if (dir == TD_on) {
+      num_enabled++;
+      enable_lighting(true);
+
+      if (light->get_light_type() == AmbientLight::get_class_type()) {
+        // Ambient lights don't require specific light ids; simply add
+        // in the ambient contribution to the current total
+        cur_ambient_light += light->get_color();
+        
+      } else {
+        // Check to see if this light has already been bound to an id
+        _cur_light_id = -1;
+        for (i = 0; i < _max_lights; i++) {
+          if (_light_info[i]._light == light) {
+            // Light has already been bound to an id, we only need
+            // to enable the light, not apply it
+            _cur_light_id = -2;
+            enable_light(i, true);
+            _light_info[i]._next_enabled = true;
+            break;
+          }
+        }
+        
+        // See if there are any unbound light ids
+        if (_cur_light_id == -1) {
+          for (i = 0; i < _max_lights; i++) {
+            if (_light_info[i]._light == (Light *)NULL) {
+              _light_info[i]._light = light;
+              _cur_light_id = i;
+              break;
+            }
+          }
+        }
+        
+        // If there were no unbound light ids, see if we can replace
+        // a currently unused but previously bound id
+        if (_cur_light_id == -1) {
+          for (i = 0; i < _max_lights; i++) {
+            if (attrib->is_off(_light_info[i]._light)) {
+              _light_info[i]._light = light;
+              _cur_light_id = i;
+              break;
+            }
+          }
+        }
+        
+        if (_cur_light_id >= 0) {
+          enable_light(_cur_light_id, true);
+          _light_info[i]._next_enabled = true;
+          
+          // We need to do something different for each type of light
+          light->apply(this);
+        } else if (_cur_light_id == -1) {
+          crgsg_cat.error()
+            << "issue_light() - failed to bind light to id" << endl;
+        }
+      }
+    }
+  }
+
+  // Disable all unused lights
+  for (i = 0; i < _max_lights; i++) {
+    if (!_light_info[i]._next_enabled)
+      enable_light(i, false);
+  }
+
+  // If no lights were enabled, disable lighting
+  if (num_enabled == 0) {
+    enable_lighting(false);
+  } else {
+    call_glLightModelAmbient(cur_ambient_light);
+  }
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_color_blend
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_color_blend(const ColorBlendTransition *attrib) {
+  //  activate();
+  ColorBlendProperty::Mode mode = attrib->get_mode();
+
+  switch (mode) {
+  case ColorBlendProperty::M_none:
+    enable_blend(false);
+    break;
+  case ColorBlendProperty::M_multiply:
+    enable_blend(true);
+    call_glBlendFunc(GL_DST_COLOR, GL_ZERO);
+    break;
+  case ColorBlendProperty::M_add:
+    enable_blend(true);
+    call_glBlendFunc(GL_ONE, GL_ONE);
+    break;
+  case ColorBlendProperty::M_multiply_add:
+    enable_blend(true);
+    call_glBlendFunc(GL_DST_COLOR, GL_ONE);
+    break;
+  case ColorBlendProperty::M_alpha:
+    enable_blend(true);
+    call_glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+    break;
+  default:
+    crgsg_cat.error()
+      << "Unknown color blend mode " << (int)mode << endl;
+    break;
+  }
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_texture_apply
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_texture_apply(const TextureApplyTransition *attrib) {
+  //  activate();
+  GLint glmode = get_texture_apply_mode_type(attrib->get_mode());
+  chromium.TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, glmode);
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_color_mask
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_color_mask(const ColorMaskTransition *attrib) {
+  //  activate();
+  chromium.ColorMask(attrib->is_write_r(),
+              attrib->is_write_g(),
+              attrib->is_write_b(),
+              attrib->is_write_a());
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_depth_test
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_depth_test(const DepthTestTransition *attrib) {
+  //  activate();
+
+  DepthTestProperty::Mode mode = attrib->get_mode();
+  if (mode == DepthTestProperty::M_none) {
+    enable_depth_test(false);
+  } else {
+    enable_depth_test(true);
+    chromium.DepthFunc(get_depth_func_type(mode));
+  }
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_depth_write
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_depth_write(const DepthWriteTransition *attrib) {
+  //  activate();
+  chromium.DepthMask(attrib->is_on());
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_stencil
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_stencil(const StencilTransition *attrib) {
+  StencilProperty::Mode mode = attrib->get_mode();
+  if (mode == StencilProperty::M_none) {
+    enable_stencil_test(false);
+
+  } else {
+    enable_stencil_test(true);
+    call_glStencilFunc(get_stencil_func_type(mode),attrib->get_reference_value(),attrib->get_func_mask());
+    call_glStencilOp(get_stencil_action_type(attrib->get_fail_action()),
+                     get_stencil_action_type(attrib->get_zfail_action()),
+                     get_stencil_action_type(attrib->get_pass_action()));
+    #ifdef _DEBUG
+      if (attrib->get_write_mask() != 0xFFFFFFFF)
+          crgsg_cat.warning() << "OpenGL doesnt support stencil writemasks!\n";
+    #endif
+  }
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_cull_transition
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_cull_face(const CullFaceTransition *attrib) {
+  //  activate();
+  CullFaceProperty::Mode mode = attrib->get_mode();
+
+  switch (mode) {
+  case CullFaceProperty::M_cull_none:
+    chromium.Disable(GL_CULL_FACE);
+    break;
+  case CullFaceProperty::M_cull_clockwise:
+    chromium.Enable(GL_CULL_FACE);
+    chromium.CullFace(GL_BACK);
+    break;
+  case CullFaceProperty::M_cull_counter_clockwise:
+    chromium.Enable(GL_CULL_FACE);
+    chromium.CullFace(GL_FRONT);
+    break;
+  case CullFaceProperty::M_cull_all:
+    chromium.Enable(GL_CULL_FACE);
+    chromium.CullFace(GL_FRONT_AND_BACK);
+    break;
+  default:
+    crgsg_cat.error()
+      << "invalid cull face mode " << (int)mode << endl;
+    break;
+  }
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_clip_plane
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_clip_plane(const ClipPlaneTransition *attrib)
+{
+  nassertv(attrib->get_default_dir() != TD_on);
+  //  activate();
+
+  // Initialize the currently enabled clip plane list
+  int i;
+  for (i = 0; i < _max_clip_planes; i++)
+    _cur_clip_plane_enabled[i] = false;
+
+  int num_enabled = 0;
+  ClipPlaneTransition::const_iterator pi;
+  for (pi = attrib->begin(); pi != attrib->end(); ++pi) {
+    PlaneNode *plane_node;
+    DCAST_INTO_V(plane_node, (*pi).first);
+    nassertv(plane_node != (PlaneNode *)NULL);
+    TransitionDirection dir = (*pi).second;
+
+    if (dir == TD_on) {
+      _cur_clip_plane_id = -1;
+      num_enabled++;
+
+      // Check to see if this clip plane has already been bound to an id
+      for (i = 0; i < _max_clip_planes; i++) {
+        if (_available_clip_plane_ids[i] == plane_node) {
+          // Clip plane has already been bound to an id, we only need
+          // to enable the clip plane, not apply it
+          _cur_clip_plane_id = -2;
+          enable_clip_plane(i, true);
+          _cur_clip_plane_enabled[i] = true;
+          break;
+        }
+      }
+
+      // See if there are any unbound clip plane ids
+      if (_cur_clip_plane_id == -1) {
+        for (i = 0; i < _max_clip_planes; i++) {
+          if (_available_clip_plane_ids[i] == NULL) {
+            _available_clip_plane_ids[i] = plane_node;
+            _cur_clip_plane_id = i;
+            break;
+          }
+        }
+      }
+      
+      // If there were no unbound clip plane ids, see if we can replace
+      // a currently unused but previously bound id
+      if (_cur_clip_plane_id == -1) {
+        for (i = 0; i < _max_clip_planes; i++) {
+          if (attrib->is_off(_available_clip_plane_ids[i])) {
+            _available_clip_plane_ids[i] = plane_node;
+            _cur_clip_plane_id = i;
+            break;
+          }
+        }
+      }
+      
+      if (_cur_clip_plane_id >= 0) {
+        enable_clip_plane(_cur_clip_plane_id, true);
+        _cur_clip_plane_enabled[_cur_clip_plane_id] = true;
+        double equation[4];
+        const Planef clip_plane = plane_node->get_plane();
+        // Move us into the coordinate space of the plane
+        chromium.MatrixMode(GL_MODELVIEW);
+        chromium.PushMatrix();
+        chromium.LoadMatrixf(clip_plane.get_reflection_mat().get_data());
+        equation[0] = clip_plane._a;
+        equation[1] = clip_plane._b;
+        equation[2] = clip_plane._c;
+        equation[3] = clip_plane._d;
+        chromium.ClipPlane(get_clip_plane_id(_cur_clip_plane_id), equation);
+        chromium.PopMatrix();
+      } else if (_cur_clip_plane_id == -1) {
+        crgsg_cat.error()
+          << "issue_clip_plane() - failed to bind clip plane to id" << endl;
+      }
+    }
+  }
+
+  // Disable all unused clip planes
+  for (i = 0; i < _max_clip_planes; i++) {
+    if (_cur_clip_plane_enabled[i] == false)
+      enable_clip_plane(i, false);
+  }
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_transparency
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_transparency(const TransparencyTransition *attrib )
+{
+  //  activate();
+
+  TransparencyProperty::Mode mode = attrib->get_mode();
+
+  switch (mode) {
+  case TransparencyProperty::M_none:
+    enable_multisample_alpha_one(false);
+    enable_multisample_alpha_mask(false);
+    enable_blend(false);
+    enable_alpha_test(false);
+    break;
+  case TransparencyProperty::M_alpha:
+  case TransparencyProperty::M_alpha_sorted:
+    // Should we really have an "alpha" and an "alpha_sorted" mode,
+    // like Performer does?  (The difference is that "alpha" is with
+    // the write to the depth buffer disabled.)  Or should we just use
+    // the separate depth write transition to control this?  Doing it
+    // implicitly requires a bit more logic here and in the state
+    // management; for now we require the user to explicitly turn off
+    // the depth write.
+    enable_multisample_alpha_one(false);
+    enable_multisample_alpha_mask(false);
+    enable_blend(true);
+    enable_alpha_test(false);
+    call_glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+    break;
+  case TransparencyProperty::M_multisample:
+    enable_multisample_alpha_one(true);
+    enable_multisample_alpha_mask(true);
+    enable_blend(false);
+    enable_alpha_test(false);
+    break;
+  case TransparencyProperty::M_multisample_mask:
+    enable_multisample_alpha_one(false);
+    enable_multisample_alpha_mask(true);
+    enable_blend(false);
+    enable_alpha_test(false);
+    break;
+  case TransparencyProperty::M_binary:
+    enable_multisample_alpha_one(false);
+    enable_multisample_alpha_mask(false);
+    enable_blend(false);
+    enable_alpha_test(true);
+    call_glAlphaFunc(GL_EQUAL, 1);
+    break;
+  default:
+    crgsg_cat.error()
+      << "invalid transparency mode " << (int)mode << endl;
+    break;
+  }
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_linesmooth
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_linesmooth(const LinesmoothTransition *attrib) {
+  //  activate();
+  enable_line_smooth(attrib->is_on());
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_point_shape
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_point_shape(const PointShapeTransition *attrib) {
+  //  activate();
+
+  if (attrib->get_mode() == PointShapeProperty::M_square)
+    chromium.Disable(GL_POINT_SMOOTH);
+  else
+    chromium.Enable(GL_POINT_SMOOTH);
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_polygon_offset
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_polygon_offset(const PolygonOffsetTransition *attrib) {
+  //  activate();
+  //GL really wants to do a enable/disable of PolygonOffset, but it
+  //seems more intuitive to have a PolygonOffset "on" all the time,
+  //and have zero mean nothing is being done.  So check for a zero
+  //offset to decide whether to enable or disable PolygonOffset
+  if(attrib->get_units() != 0 || attrib->get_factor() != 0)
+    {
+      //    GLfloat newfactor=attrib->get_factor();
+      GLfloat newfactor= 1.0f;
+
+      GLfloat newunits=attrib->get_units();
+      chromium.PolygonOffset(newfactor,newunits);
+      enable_polygon_offset(true);
+    }
+  else
+    {
+      enable_polygon_offset(false);
+    }
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_transform
+//       Access: Public, Virtual
+//  Description: Sends the indicated transform matrix to the graphics
+//               API to be applied to future vertices.
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_transform(const TransformState *transform) {
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug()
+    << "crLoadMatrix(GL_MODELVIEW): " << transform->get_mat() << endl;
+#endif
+  chromium.MatrixMode(GL_MODELVIEW);
+  chromium.LoadMatrixf(transform->get_mat().get_data());
+
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_texture
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_texture(const TextureAttrib *attrib) {
+  if (attrib->is_off()) {
+    enable_texturing(false);
+  } else {
+    enable_texturing(true);
+    Texture *tex = attrib->get_texture();
+    nassertv(tex != (Texture *)NULL);
+    tex->apply(this);
+  }
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_texture_apply
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_texture_apply(const TextureApplyAttrib *attrib) {
+  GLint glmode = get_texture_apply_mode_type(attrib->get_mode());
+  chromium.TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, glmode);
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_cull_face
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_cull_face(const CullFaceAttrib *attrib) {
+  CullFaceAttrib::Mode mode = attrib->get_mode();
+
+  switch (mode) {
+  case CullFaceAttrib::M_cull_none:
+    chromium.Disable(GL_CULL_FACE);
+    break;
+  case CullFaceAttrib::M_cull_clockwise:
+    chromium.Enable(GL_CULL_FACE);
+    chromium.CullFace(GL_BACK);
+    break;
+  case CullFaceAttrib::M_cull_counter_clockwise:
+    chromium.Enable(GL_CULL_FACE);
+    chromium.CullFace(GL_FRONT);
+    break;
+  case CullFaceAttrib::M_cull_all:
+    chromium.Enable(GL_CULL_FACE);
+    chromium.CullFace(GL_FRONT_AND_BACK);
+    break;
+  default:
+    crgsg_cat.error()
+      << "invalid cull face mode " << (int)mode << endl;
+    break;
+  }
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_transparency
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_transparency(const TransparencyAttrib *attrib) {
+  TransparencyAttrib::Mode mode = attrib->get_mode();
+
+  switch (mode) {
+  case TransparencyAttrib::M_none:
+    enable_multisample_alpha_one(false);
+    enable_multisample_alpha_mask(false);
+    enable_blend(false);
+    enable_alpha_test(false);
+    break;
+  case TransparencyAttrib::M_alpha:
+  case TransparencyAttrib::M_alpha_sorted:
+    // Should we really have an "alpha" and an "alpha_sorted" mode,
+    // like Performer does?  (The difference is that "alpha" is with
+    // the write to the depth buffer disabled.)  Or should we just use
+    // the separate depth write transition to control this?  Doing it
+    // implicitly requires a bit more logic here and in the state
+    // management; for now we require the user to explicitly turn off
+    // the depth write.
+    enable_multisample_alpha_one(false);
+    enable_multisample_alpha_mask(false);
+    enable_blend(true);
+    enable_alpha_test(false);
+    call_glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+    break;
+  case TransparencyAttrib::M_multisample:
+    enable_multisample_alpha_one(true);
+    enable_multisample_alpha_mask(true);
+    enable_blend(false);
+    enable_alpha_test(false);
+    break;
+  case TransparencyAttrib::M_multisample_mask:
+    enable_multisample_alpha_one(false);
+    enable_multisample_alpha_mask(true);
+    enable_blend(false);
+    enable_alpha_test(false);
+    break;
+  case TransparencyAttrib::M_binary:
+    enable_multisample_alpha_one(false);
+    enable_multisample_alpha_mask(false);
+    enable_blend(false);
+    enable_alpha_test(true);
+    call_glAlphaFunc(GL_EQUAL, 1);
+    break;
+  default:
+    crgsg_cat.error()
+      << "invalid transparency mode " << (int)mode << endl;
+    break;
+  }
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_color_write
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_color_write(const ColorWriteAttrib *attrib) {
+  ColorWriteAttrib::Mode mode = attrib->get_mode();
+  if (mode == ColorWriteAttrib::M_off) {
+    chromium.ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
+  } else {
+    chromium.ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+  }
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_depth_test
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_depth_test(const DepthTestAttrib *attrib) {
+  DepthTestAttrib::Mode mode = attrib->get_mode();
+  if (mode == DepthTestAttrib::M_none) {
+    enable_depth_test(false);
+  } else {
+    enable_depth_test(true);
+    chromium.DepthFunc(get_depth_func_type(mode));
+  }
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_depth_write
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_depth_write(const DepthWriteAttrib *attrib) {
+  DepthWriteAttrib::Mode mode = attrib->get_mode();
+  if (mode == DepthWriteAttrib::M_off) {
+    chromium.DepthMask(GL_FALSE);
+  } else {
+    chromium.DepthMask(GL_TRUE);
+  }
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::wants_normals
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+bool CRGraphicsStateGuardian::
+wants_normals() const {
+  return (_lighting_enabled || _normals_enabled);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::wants_texcoords
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+bool CRGraphicsStateGuardian::
+wants_texcoords() const {
+  return _texturing_enabled;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::begin_decal
+//       Access: Public, Virtual
+//  Description: This will be called to initiate decaling mode.  It is
+//               passed the pointer to the GeomNode that will be the
+//               destination of the decals, which it is expected that
+//               the GSG will render normally; subsequent geometry
+//               rendered up until the next call of end_decal() should
+//               be rendered as decals of the base_geom.
+//
+//               The transitions wrapper is the current state as of the
+//               base geometry node.  It may or may not be modified by
+//               the GSG to reflect whatever rendering state is
+//               necessary to render the decals properly.
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+begin_decal(GeomNode *base_geom, AllTransitionsWrapper &attrib) {
+  nassertv(base_geom != (GeomNode *)NULL);
+  _decal_level++;
+
+#define POLYGON_OFFSET_MULTIPLIER -2
+
+  if (cr_decal_type == GDT_offset) {
+    // GL 1.1-style: use chromium.PolygonOffset to do decals.
+
+    // Just draw the base geometry normally.
+    base_geom->draw(this);
+    chromium.PolygonOffset(0.0f,POLYGON_OFFSET_MULTIPLIER * _decal_level);
+    chromium.Enable(GL_POLYGON_OFFSET_FILL);
+
+  } else {
+    // GL 1.0f-style: use three-step rendering to do decals.
+
+    if (_decal_level > 1) {
+      // If we're already decaling, just draw the geometry.
+      base_geom->draw(this);
+
+    } else {
+      // Turn off writing the depth buffer to render the base geometry.
+      chromium.DepthMask(false);
+      DepthWriteTransition *dwa = new DepthWriteTransition;
+      dwa->set_off();
+      attrib.set_transition(dwa);
+
+      // Now render the base geometry.
+      base_geom->draw(this);
+
+      // Render all of the decal geometry, too.  We'll keep the depth
+      // buffer write off during this.
+
+      // Save the current transform within the GL state so we can
+      // restore it when we come back to draw the base geometry again.
+      chromium.MatrixMode(GL_MODELVIEW);
+      chromium.PushMatrix();
+    }
+  }
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::end_decal
+//       Access: Public, Virtual
+//  Description: This will be called to terminate decaling mode.  It
+//               is passed the same base_geom that was passed to
+//               begin_decal().
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+end_decal(GeomNode *base_geom) {
+  nassertv(base_geom != (GeomNode *)NULL);
+
+  _decal_level--;
+
+  if (cr_decal_type == GDT_offset) {
+    // GL 1.1-style: use chromium.PolygonOffset to do decals.
+    chromium.PolygonOffset(0.0f,POLYGON_OFFSET_MULTIPLIER * _decal_level);
+    if (_decal_level == 0) {
+      chromium.Disable(GL_POLYGON_OFFSET_FILL);
+    }
+
+  } else {
+    // GL 1.0f-style: use three-step rendering to do decals.
+
+    if (_decal_level == 0) {
+      // Now we need to re-render the base geometry with the depth write
+      // on and the color mask off, so we update the depth buffer
+      // properly.
+      bool was_textured = _texturing_enabled;
+      bool was_blend = _blend_enabled;
+      GLenum old_blend_source_func = _blend_source_func;
+      GLenum old_blend_dest_func = _blend_dest_func;
+
+      // First, we'd better restore the transform matrix in case our
+      // decals screwed it up.
+      chromium.MatrixMode(GL_MODELVIEW);
+      chromium.PopMatrix();
+
+      // Enable the writing to the depth buffer.
+      chromium.DepthMask(true);
+
+      // Disable the writing to the color buffer, however we have to
+      // do this.
+      if (cr_decal_type == GDT_blend) {
+        // For the early nVidia Linux driver, at least, we don't seem
+        // to have a working chromium.ColorMask.  So we have to disable the
+        // color writes through the use of a blend function.
+        // Expensive.
+
+        enable_blend(true);
+        call_glBlendFunc(GL_ZERO, GL_ONE);
+      } else {
+        chromium.ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
+      }
+
+      // No need to have texturing on for this.
+      enable_texturing(false);
+
+      base_geom->draw(this);
+
+      // Finally, restore the depth write and color mask states to the
+      // way they're supposed to be.
+      DepthWriteTransition *depth_write;
+      if (get_attribute_into(depth_write, this)) {
+        issue_depth_write(depth_write);
+      }
+
+      if (cr_decal_type == GDT_blend) {
+        enable_blend(was_blend);
+        if (was_blend) {
+          call_glBlendFunc(old_blend_source_func, old_blend_dest_func);
+        }
+      } else {
+        ColorMaskTransition *color_mask;
+        if (get_attribute_into(color_mask, this)) {
+          issue_color_mask(color_mask);
+        } else {
+          chromium.ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+        }
+      }
+
+      enable_texturing(was_textured);
+    }
+  }
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::get_internal_coordinate_system
+//       Access: Public, Virtual
+//  Description: Should be overridden by derived classes to return the
+//               coordinate system used internally by the GSG, if any
+//               one particular coordinate system is used.  The
+//               default, CS_default, indicates that the GSG can use
+//               any coordinate system.
+//
+//               If this returns other than CS_default, the
+//               GraphicsEngine will automatically convert all
+//               transforms into the indicated coordinate system.
+////////////////////////////////////////////////////////////////////
+CoordinateSystem CRGraphicsStateGuardian::
+get_internal_coordinate_system() const {
+  return CS_yup_right;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::compute_distance_to
+//       Access: Public, Virtual
+//  Description: This function may only be called during a render
+//               traversal; it will compute the distance to the
+//               indicated point, assumed to be in modelview
+//               coordinates, from the camera plane.
+////////////////////////////////////////////////////////////////////
+float CRGraphicsStateGuardian::
+compute_distance_to(const LPoint3f &point) const {
+  // In the case of a CRGraphicsStateGuardian, we know that the
+  // modelview matrix already includes the relative transform from the
+  // camera, as well as a to-y-up conversion.  Thus, the distance to
+  // the camera plane is simply the -z distance.
+
+  return -point[2];
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: report_errors_loop
+//       Access: Protected
+//  Description: The internal implementation of report_errors().
+//               Don't call this function; use report_errors()
+//               instead.
+////////////////////////////////////////////////////////////////////
+
+void report_errors_loop(GLenum error_code) {
+#ifndef NDEBUG
+#define MAXGLERRORSREPORTED 20
+  int cnt=0;
+  while ((cnt<MAXGLERRORSREPORTED) && (error_code != GL_NO_ERROR)) {
+    crgsg_cat.error() << gluErrorString(error_code) << "\n";
+    error_code = chromium.GetError();
+    cnt++;
+  }
+#endif
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::set_draw_buffer
+//       Access: Protected
+//  Description: Sets up the chromium.DrawBuffer to render into the buffer
+//               indicated by the RenderBuffer object.  This only sets
+//               up the color bits; it does not affect the depth,
+//               stencil, accum layers.
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+set_draw_buffer(const RenderBuffer &rb) {
+  switch (rb._buffer_type & RenderBuffer::T_color) {
+  case RenderBuffer::T_front:
+    call_glDrawBuffer(GL_FRONT);
+    break;
+
+  case RenderBuffer::T_back:
+    call_glDrawBuffer(GL_BACK);
+    break;
+
+  case RenderBuffer::T_right:
+    call_glDrawBuffer(GL_RIGHT);
+    break;
+
+  case RenderBuffer::T_left:
+    call_glDrawBuffer(GL_LEFT);
+    break;
+
+  case RenderBuffer::T_front_right:
+    call_glDrawBuffer(GL_FRONT_RIGHT);
+    break;
+
+  case RenderBuffer::T_front_left:
+    call_glDrawBuffer(GL_FRONT_LEFT);
+    break;
+
+  case RenderBuffer::T_back_right:
+    call_glDrawBuffer(GL_BACK_RIGHT);
+    break;
+
+  case RenderBuffer::T_back_left:
+    call_glDrawBuffer(GL_BACK_LEFT);
+    break;
+
+  default:
+    call_glDrawBuffer(GL_FRONT_AND_BACK);
+  }
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::set_read_buffer
+//       Access: Protected
+//  Description: Sets up the chromium.ReadBuffer to render into the buffer
+//               indicated by the RenderBuffer object.  This only sets
+//               up the color bits; it does not affect the depth,
+//               stencil, accum layers.
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+set_read_buffer(const RenderBuffer &rb) {
+  switch (rb._buffer_type & RenderBuffer::T_color) {
+  case RenderBuffer::T_front:
+    call_glReadBuffer(GL_FRONT);
+    break;
+
+  case RenderBuffer::T_back:
+    call_glReadBuffer(GL_BACK);
+    break;
+
+  case RenderBuffer::T_right:
+    call_glReadBuffer(GL_RIGHT);
+    break;
+
+  case RenderBuffer::T_left:
+    call_glReadBuffer(GL_LEFT);
+    break;
+
+  case RenderBuffer::T_front_right:
+    call_glReadBuffer(GL_FRONT_RIGHT);
+    break;
+
+  case RenderBuffer::T_front_left:
+    call_glReadBuffer(GL_FRONT_LEFT);
+    break;
+
+  case RenderBuffer::T_back_right:
+    call_glReadBuffer(GL_BACK_RIGHT);
+    break;
+
+  case RenderBuffer::T_back_left:
+    call_glReadBuffer(GL_BACK_LEFT);
+    break;
+
+  default:
+    call_glReadBuffer(GL_FRONT_AND_BACK);
+  }
+  report_errors();
+}
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::bind_texture
+//       Access: Protected
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+bind_texture(TextureContext *tc) {
+  //  activate();
+  CRTextureContext *gtc = DCAST(CRTextureContext, tc);
+
+#ifdef GSG_VERBOSE
+  Texture *tex = tc->_texture;
+  crgsg_cat.debug()
+    << "crBindTexture(): " << tex->get_name() << "(" << (int)gtc->_index
+    << ")" << endl;
+#endif
+  chromium.BindTexture(GL_TEXTURE_2D, gtc->_index);
+  report_errors();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::specify_texture
+//       Access: Protected
+//  Description:
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+specify_texture(Texture *tex) {
+  chromium.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
+                  get_texture_wrap_mode(tex->get_wrapu()));
+  chromium.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
+                  get_texture_wrap_mode(tex->get_wrapv()));
+
+  if (cr_force_mipmaps) {
+    chromium.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
+                    GL_LINEAR_MIPMAP_LINEAR);
+    chromium.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+
+  } else {
+    chromium.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
+                    get_texture_filter_type(tex->get_minfilter()));
+    chromium.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
+                    get_texture_filter_type(tex->get_magfilter()));
+  }
+  report_errors();
+}
+
+#ifndef NDEBUG
+////////////////////////////////////////////////////////////////////
+//     Function: compute_cr_image_size
+//  Description: Calculates how many bytes GL will expect to read for
+//               a texture image, based on the number of pixels and
+//               the GL format and type.  This is only used for
+//               debugging.
+////////////////////////////////////////////////////////////////////
+static int
+compute_cr_image_size(int xsize, int ysize, int external_format, int type) {
+  int num_components = 0;
+  switch (external_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:
+    num_components = 1;
+    break;
+
+  case GL_LUMINANCE_ALPHA:
+    num_components = 2;
+    break;
+
+#ifdef GL_BGR
+  case GL_BGR:
+#endif
+  case GL_RGB:
+    num_components = 3;
+    break;
+
+#ifdef GL_BGR
+  case GL_BGRA:
+#endif
+  case GL_RGBA:
+    num_components = 4;
+    break;
+  }
+
+  int pixel_width = 0;
+  switch (type) {
+  case GL_UNSIGNED_BYTE:
+    pixel_width = 1 * num_components;
+    break;
+
+  case GL_UNSIGNED_SHORT:
+    pixel_width = 2 * num_components;
+    break;
+
+#ifdef GL_UNSIGNED_BYTE_3_3_2_EXT
+  case GL_UNSIGNED_BYTE_3_3_2_EXT:
+    nassertr(num_components == 3, 0);
+    pixel_width = 1;
+    break;
+#endif
+
+  case GL_FLOAT:
+    pixel_width = 4 * num_components;
+    break;
+  }
+
+  return xsize * ysize * pixel_width;
+}
+#endif  // NDEBUG
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::uchar_bgr_to_rgb
+//  Description: Recopies the given array of pixels, converting from
+//               BGR to RGB arrangement.
+////////////////////////////////////////////////////////////////////
+static void
+uchar_bgr_to_rgb(unsigned char *dest, const unsigned char *source, 
+                 int num_pixels) {
+  for (int i = 0; i < num_pixels; i++) {
+    dest[0] = source[2];
+    dest[1] = source[1];
+    dest[2] = source[0];
+    dest += 3;
+    source += 3;
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::uchar_bgra_to_rgba
+//  Description: Recopies the given array of pixels, converting from
+//               BGRA to RGBA arrangement.
+////////////////////////////////////////////////////////////////////
+static void
+uchar_bgra_to_rgba(unsigned char *dest, const unsigned char *source, 
+                   int num_pixels) {
+  for (int i = 0; i < num_pixels; i++) {
+    dest[0] = source[2];
+    dest[1] = source[1];
+    dest[2] = source[0];
+    dest[3] = source[3];
+    dest += 4;
+    source += 4;
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::apply_texture_immediate
+//       Access: Protected
+//  Description: Sends the texture image to GL.  This can be used to
+//               render a texture in immediate mode, or as part of the
+//               process of creating a GL texture object.
+//
+//               The return value is true if successful, or false if
+//               the texture has no image.
+////////////////////////////////////////////////////////////////////
+bool CRGraphicsStateGuardian::
+apply_texture_immediate(Texture *tex) {
+  PixelBuffer *pb = tex->get_ram_image();
+  if (pb == (PixelBuffer *)NULL) {
+    return false;
+  }
+
+  int xsize = pb->get_xsize();
+  int ysize = pb->get_ysize();
+  int num_pixels = xsize * ysize;
+
+  GLenum internal_format = get_internal_image_format(pb->get_format());
+  GLenum external_format = get_external_image_format(pb->get_format());
+  GLenum type = get_image_type(pb->get_image_type());
+
+  uchar *image = pb->_image;
+  uchar *locally_allocated_image = (uchar *)NULL;
+  if (!cr_supports_bgr) {
+    // If the GL doesn't claim to support BGR, we may have to reverse
+    // the byte ordering of the image.
+    if (external_format == GL_RGB && pb->get_image_type() == PixelBuffer::T_unsigned_byte) {
+      locally_allocated_image = new uchar[num_pixels * 3];
+      image = locally_allocated_image;
+      uchar_bgr_to_rgb(image, pb->_image, num_pixels);
+    } else if (external_format == GL_RGBA && pb->get_image_type() == PixelBuffer::T_unsigned_byte) {
+      locally_allocated_image = new uchar[num_pixels * 4];
+      image = locally_allocated_image;
+      uchar_bgra_to_rgba(image, pb->_image, num_pixels);
+    }
+  }
+
+#ifndef NDEBUG
+  int wanted_size = 
+    compute_cr_image_size(xsize, ysize,
+                          external_format, type);
+  nassertr(wanted_size == (int)pb->_image.size(), false);
+#endif  // NDEBUG
+
+  set_unpack_alignment(1);
+
+#ifdef GSG_VERBOSE
+  crgsg_cat.debug()
+    << "crTexImage2D(GL_TEXTURE_2D, "
+    << (int)internal_format << ", "
+    << xsize << ", " << ysize << ", "
+    << pb->get_border() << ", " << (int)external_format << ", "
+    << (int)type << ", " << tex->get_name() << ")\n";
+#endif
+
+  if (!cr_ignore_mipmaps || cr_force_mipmaps) {
+    if (tex->uses_mipmaps() || cr_force_mipmaps) {
+#ifndef NDEBUG
+      if (cr_show_mipmaps) {
+        build_phony_mipmaps(tex);
+      } else 
+#endif
+        {
+          gluBuild2DMipmaps(GL_TEXTURE_2D, internal_format,
+                            xsize, ysize,
+                            external_format, type, image);
+#ifndef NDEBUG
+          if (cr_save_mipmaps) {
+            save_mipmap_images(tex);
+          }
+#endif
+        }
+      report_errors();
+
+      if (locally_allocated_image != (uchar *)NULL) {
+        delete[] locally_allocated_image;
+      }
+      return true;
+    }
+  }
+
+  nassertr(!pb->_image.empty(), false);
+  chromium.TexImage2D(GL_TEXTURE_2D, 0, internal_format,
+               xsize, ysize, pb->get_border(),
+               external_format, type, image);
+  report_errors();
+
+  if (locally_allocated_image != (uchar *)NULL) {
+    delete[] locally_allocated_image;
+  }
+  return true;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::get_texture_wrap_mode
+//       Access: Protected
+//  Description: Maps from the Texture's internal wrap mode symbols to
+//               GL's.
+////////////////////////////////////////////////////////////////////
+GLenum CRGraphicsStateGuardian::
+get_texture_wrap_mode(Texture::WrapMode wm) {
+  switch (wm) {
+  case Texture::WM_clamp:
+    return GL_CLAMP;
+  case Texture::WM_repeat:
+    return GL_REPEAT;
+
+  case Texture::WM_mirror:
+  case Texture::WM_mirror_once:
+  case Texture::WM_border_color:
+    // These are unsupported for now.
+    return GL_REPEAT;
+
+  case Texture::WM_invalid:
+    break;
+  }
+  crgsg_cat.error() << "Invalid Texture::WrapMode value!\n";
+  return GL_CLAMP;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::get_texture_filter_type
+//       Access: Protected
+//  Description: Maps from the Texture's internal filter type symbols
+//               to GL's.
+////////////////////////////////////////////////////////////////////
+GLenum CRGraphicsStateGuardian::
+get_texture_filter_type(Texture::FilterType ft) {
+  if (cr_ignore_mipmaps) {
+    switch (ft) {
+    case Texture::FT_nearest_mipmap_nearest:
+    case Texture::FT_nearest:
+      return GL_NEAREST;
+    case Texture::FT_linear:
+    case Texture::FT_linear_mipmap_nearest:
+    case Texture::FT_nearest_mipmap_linear:
+    case Texture::FT_linear_mipmap_linear:
+      return GL_LINEAR;
+    case Texture::FT_invalid:
+      break;
+    }
+  } else {
+    switch (ft) {
+    case Texture::FT_nearest:
+      return GL_NEAREST;
+    case Texture::FT_linear:
+      return GL_LINEAR;
+    case Texture::FT_nearest_mipmap_nearest:
+      return GL_NEAREST_MIPMAP_NEAREST;
+    case Texture::FT_linear_mipmap_nearest:
+      return GL_LINEAR_MIPMAP_NEAREST;
+    case Texture::FT_nearest_mipmap_linear:
+      return GL_NEAREST_MIPMAP_LINEAR;
+    case Texture::FT_linear_mipmap_linear:
+      return GL_LINEAR_MIPMAP_LINEAR;
+    case Texture::FT_invalid:
+      break;
+    }
+  }
+  crgsg_cat.error() << "Invalid Texture::FilterType value!\n";
+  return GL_NEAREST;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::get_image_type
+//       Access: Protected
+//  Description: Maps from the PixelBuffer's internal Type symbols
+//               to GL's.
+////////////////////////////////////////////////////////////////////
+GLenum CRGraphicsStateGuardian::
+get_image_type(PixelBuffer::Type type) {
+  switch (type) {
+  case PixelBuffer::T_unsigned_byte:
+    return GL_UNSIGNED_BYTE;
+  case PixelBuffer::T_unsigned_short:
+    return GL_UNSIGNED_SHORT;
+#ifdef GL_UNSIGNED_BYTE_3_3_2_EXT
+  case PixelBuffer::T_unsigned_byte_332:
+    return GL_UNSIGNED_BYTE_3_3_2_EXT;
+#endif
+  case PixelBuffer::T_float:
+    return GL_FLOAT;
+
+  default:
+    crgsg_cat.error() << "Invalid PixelBuffer::Type value!\n";
+    return GL_UNSIGNED_BYTE;
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::get_external_image_format
+//       Access: Protected
+//  Description: Maps from the PixelBuffer's Format symbols
+//               to GL's.
+////////////////////////////////////////////////////////////////////
+GLenum CRGraphicsStateGuardian::
+get_external_image_format(PixelBuffer::Format format) {
+  switch (format) {
+  case PixelBuffer::F_color_index:
+    return GL_COLOR_INDEX;
+  case PixelBuffer::F_stencil_index:
+    return GL_STENCIL_INDEX;
+  case PixelBuffer::F_depth_component:
+    return GL_DEPTH_COMPONENT;
+  case PixelBuffer::F_red:
+    return GL_RED;
+  case PixelBuffer::F_green:
+    return GL_GREEN;
+  case PixelBuffer::F_blue:
+    return GL_BLUE;
+  case PixelBuffer::F_alpha:
+    return GL_ALPHA;
+  case PixelBuffer::F_rgb:
+  case PixelBuffer::F_rgb5:
+  case PixelBuffer::F_rgb8:
+  case PixelBuffer::F_rgb12:
+  case PixelBuffer::F_rgb332:
+#ifdef GL_BGR
+    return cr_supports_bgr ? GL_BGR : GL_RGB;
+#else
+    return GL_RGB;
+#endif  // GL_BGR
+  case PixelBuffer::F_rgba:
+  case PixelBuffer::F_rgbm:
+  case PixelBuffer::F_rgba4:
+  case PixelBuffer::F_rgba5:
+  case PixelBuffer::F_rgba8:
+  case PixelBuffer::F_rgba12:
+#ifdef GL_BGR
+    return cr_supports_bgr ? GL_BGRA : GL_RGBA;
+#else
+    return GL_RGBA;
+#endif  // GL_BGR
+  case PixelBuffer::F_luminance:
+    return GL_LUMINANCE;
+  case PixelBuffer::F_luminance_alphamask:
+  case PixelBuffer::F_luminance_alpha:
+    return GL_LUMINANCE_ALPHA;
+  }
+  crgsg_cat.error()
+    << "Invalid PixelBuffer::Format value in get_external_image_format(): "
+    << (int)format << "\n";
+  return GL_RGB;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::get_internal_image_format
+//       Access: Protected
+//  Description: Maps from the PixelBuffer's Format symbols to a
+//               suitable internal format for GL textures.
+////////////////////////////////////////////////////////////////////
+GLenum CRGraphicsStateGuardian::
+get_internal_image_format(PixelBuffer::Format format) {
+  switch (format) {
+  case PixelBuffer::F_rgba:
+  case PixelBuffer::F_rgbm:
+    return GL_RGBA;
+  case PixelBuffer::F_rgba4:
+    return GL_RGBA4;
+  case PixelBuffer::F_rgba8:
+    return GL_RGBA8;
+  case PixelBuffer::F_rgba12:
+    return GL_RGBA12;
+
+  case PixelBuffer::F_rgb:
+    return GL_RGB;
+  case PixelBuffer::F_rgb5:
+    return GL_RGB5;
+  case PixelBuffer::F_rgba5:
+    return GL_RGB5_A1;
+  case PixelBuffer::F_rgb8:
+    return GL_RGB8;
+  case PixelBuffer::F_rgb12:
+    return GL_RGB12;
+  case PixelBuffer::F_rgb332:
+    return GL_R3_G3_B2;
+
+  case PixelBuffer::F_alpha:
+    return GL_ALPHA;
+
+  case PixelBuffer::F_red:
+  case PixelBuffer::F_green:
+  case PixelBuffer::F_blue:
+  case PixelBuffer::F_luminance:
+    return GL_LUMINANCE;
+  case PixelBuffer::F_luminance_alpha:
+  case PixelBuffer::F_luminance_alphamask:
+    return GL_LUMINANCE_ALPHA;
+
+  default:
+    crgsg_cat.error()
+      << "Invalid image format in get_internal_image_format(): "
+      << (int)format << "\n";
+    return GL_RGB;
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::get_texture_apply_mode_type
+//       Access: Protected
+//  Description: Maps from the texture environment's mode types
+//       to the corresponding OpenGL ids
+////////////////////////////////////////////////////////////////////
+GLint CRGraphicsStateGuardian::
+get_texture_apply_mode_type( TextureApplyProperty::Mode am ) const
+{
+  switch( am ) {
+  case TextureApplyProperty::M_modulate: return GL_MODULATE;
+  case TextureApplyProperty::M_decal: return GL_DECAL;
+  case TextureApplyProperty::M_blend: return GL_BLEND;
+  case TextureApplyProperty::M_replace: return GL_REPLACE;
+  case TextureApplyProperty::M_add: return GL_ADD;
+  }
+  crgsg_cat.error()
+    << "Invalid TextureApplyProperty::Mode value" << endl;
+  return GL_MODULATE;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::get_texture_apply_mode_type
+//       Access: Protected
+//  Description: Maps from the texture environment's mode types
+//       to the corresponding OpenGL ids
+////////////////////////////////////////////////////////////////////
+GLint CRGraphicsStateGuardian::
+get_texture_apply_mode_type(TextureApplyAttrib::Mode am) const {
+  switch (am) {
+  case TextureApplyAttrib::M_modulate: return GL_MODULATE;
+  case TextureApplyAttrib::M_decal: return GL_DECAL;
+  case TextureApplyAttrib::M_blend: return GL_BLEND;
+  case TextureApplyAttrib::M_replace: return GL_REPLACE;
+  case TextureApplyAttrib::M_add: return GL_ADD;
+  }
+  crgsg_cat.error()
+    << "Invalid TextureApplyAttrib::Mode value" << endl;
+  return GL_MODULATE;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::get_depth_func_type
+//       Access: Protected
+//  Description: Maps from the depth func modes to gl version
+////////////////////////////////////////////////////////////////////
+GLenum CRGraphicsStateGuardian::
+get_depth_func_type(DepthTestProperty::Mode m) const
+{
+  switch(m) {
+  case DepthTestProperty::M_never: return GL_NEVER;
+  case DepthTestProperty::M_less: return GL_LESS;
+  case DepthTestProperty::M_equal: return GL_EQUAL;
+  case DepthTestProperty::M_less_equal: return GL_LEQUAL;
+  case DepthTestProperty::M_greater: return GL_GREATER;
+  case DepthTestProperty::M_not_equal: return GL_NOTEQUAL;
+  case DepthTestProperty::M_greater_equal: return GL_GEQUAL;
+  case DepthTestProperty::M_always: return GL_ALWAYS;
+
+  default:
+    crgsg_cat.error()
+      << "Invalid DepthTestProperty::Mode value" << endl;
+    return GL_LESS;
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::get_depth_func_type
+//       Access: Protected
+//  Description: Maps from the depth func modes to gl version
+////////////////////////////////////////////////////////////////////
+GLenum CRGraphicsStateGuardian::
+get_depth_func_type(DepthTestAttrib::Mode m) const
+{
+  switch(m) {
+  case DepthTestAttrib::M_never: return GL_NEVER;
+  case DepthTestAttrib::M_less: return GL_LESS;
+  case DepthTestAttrib::M_equal: return GL_EQUAL;
+  case DepthTestAttrib::M_less_equal: return GL_LEQUAL;
+  case DepthTestAttrib::M_greater: return GL_GREATER;
+  case DepthTestAttrib::M_not_equal: return GL_NOTEQUAL;
+  case DepthTestAttrib::M_greater_equal: return GL_GEQUAL;
+  case DepthTestAttrib::M_always: return GL_ALWAYS;
+
+  default:
+    crgsg_cat.error()
+      << "Invalid DepthTestAttrib::Mode value" << endl;
+    return GL_LESS;
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::get_stencil_func_type
+//       Access: Protected
+//  Description: Maps from the stencil func modes to gl version
+////////////////////////////////////////////////////////////////////
+GLenum CRGraphicsStateGuardian::
+get_stencil_func_type(StencilProperty::Mode m) const
+{
+  // TODO: should do this with a table, not a switch
+  switch(m) {
+  case StencilProperty::M_never: return GL_NEVER;
+  case StencilProperty::M_less: return GL_LESS;
+  case StencilProperty::M_equal: return GL_EQUAL;
+  case StencilProperty::M_less_equal: return GL_LEQUAL;
+  case StencilProperty::M_greater: return GL_GREATER;
+  case StencilProperty::M_not_equal: return GL_NOTEQUAL;
+  case StencilProperty::M_greater_equal: return GL_GEQUAL;
+  case StencilProperty::M_always: return GL_ALWAYS;
+
+  default:
+    crgsg_cat.error()
+      << "Invalid StencilProperty::Mode value" << endl;
+    return GL_LESS;
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::get_stencil_action_type
+//       Access: Protected
+//  Description: Maps from the stencil action modes to gl version
+////////////////////////////////////////////////////////////////////
+GLenum CRGraphicsStateGuardian::
+get_stencil_action_type(StencilProperty::Action a) const
+{
+  // TODO: should do this with a table, not a switch
+  switch(a) {
+  case StencilProperty::A_keep: return GL_KEEP;
+  case StencilProperty::A_zero: return GL_ZERO;
+  case StencilProperty::A_replace: return GL_REPLACE;
+  case StencilProperty::A_increment_clamp: return GL_INCR;
+  case StencilProperty::A_decrement_clamp: return GL_DECR;
+  case StencilProperty::A_invert: return GL_INVERT;
+
+  case StencilProperty::A_increment:
+  case StencilProperty::A_decrement:
+      crgsg_cat.error()
+             << "wraparound incr/decr StencilProperty::Action not supported by OpenGL\n";
+      return ((a == StencilProperty::A_increment) ? GL_INCR : GL_DECR);
+  }
+  crgsg_cat.error()
+    << "Invalid StencilProperty::Action value" << endl;
+  return GL_KEEP;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::get_fog_mode_type
+//       Access: Protected
+//  Description: Maps from the fog types to gl version
+////////////////////////////////////////////////////////////////////
+GLenum CRGraphicsStateGuardian::
+get_fog_mode_type(Fog::Mode m) const {
+  switch(m) {
+  case Fog::M_linear: return GL_LINEAR;
+  case Fog::M_exponential: return GL_EXP;
+  case Fog::M_exponential_squared: return GL_EXP2;
+    /*
+      #ifdef GL_FOG_FUNC_SGIS
+      case Fog::M_spline: return GL_FOG_FUNC_SGIS;
+      #endif
+    */
+
+  default:
+    crgsg_cat.error() << "Invalid Fog::Mode value" << endl;
+    return GL_EXP;
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::print_gfx_visual
+//       Access: Public
+//  Description: Prints a description of the current visual selected.
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+print_gfx_visual() {
+  GLint i;
+  GLboolean j;
+  //  activate();
+
+  cout << "Graphics Visual Info (# bits of each):" << endl;
+
+  cout << "RGBA: ";
+  chromium.GetIntegerv( GL_RED_BITS, &i ); cout << i << " ";
+  chromium.GetIntegerv( GL_GREEN_BITS, &i ); cout << i << " ";
+  chromium.GetIntegerv( GL_BLUE_BITS, &i ); cout << i << " ";
+  chromium.GetIntegerv( GL_ALPHA_BITS, &i ); cout << i << endl;
+
+  cout << "Accum RGBA: ";
+  chromium.GetIntegerv( GL_ACCUM_RED_BITS, &i ); cout << i << " ";
+  chromium.GetIntegerv( GL_ACCUM_GREEN_BITS, &i ); cout << i << " ";
+  chromium.GetIntegerv( GL_ACCUM_BLUE_BITS, &i ); cout << i << " ";
+  chromium.GetIntegerv( GL_ACCUM_ALPHA_BITS, &i ); cout << i << endl;
+
+  chromium.GetIntegerv( GL_INDEX_BITS, &i ); cout << "Color Index: " << i << endl;
+
+  chromium.GetIntegerv( GL_DEPTH_BITS, &i ); cout << "Depth: " << i << endl;
+  chromium.GetIntegerv( GL_ALPHA_BITS, &i ); cout << "Alpha: " << i << endl;
+  chromium.GetIntegerv( GL_STENCIL_BITS, &i ); cout << "Stencil: " << i << endl;
+
+  chromium.GetBooleanv( GL_DOUBLEBUFFER, &j ); cout << "DoubleBuffer? "
+                                             << (int)j << endl;
+
+  chromium.GetBooleanv( GL_STEREO, &j ); cout << "Stereo? " << (int)j << endl;
+
+#ifdef GL_MULTISAMPLE_SGIS
+  chromium.GetBooleanv( GL_MULTISAMPLE_SGIS, &j ); cout << "Multisample? "
+                                                 << (int)j << endl;
+#endif
+#ifdef GL_SAMPLES_SGIS
+  chromium.GetIntegerv( GL_SAMPLES_SGIS, &i ); cout << "Samples: " << i << endl;
+#endif
+
+  chromium.GetBooleanv( GL_BLEND, &j ); cout << "Blend? " << (int)j << endl;
+  chromium.GetBooleanv( GL_POINT_SMOOTH, &j ); cout << "Point Smooth? "
+                                             << (int)j << endl;
+  chromium.GetBooleanv( GL_LINE_SMOOTH, &j ); cout << "Line Smooth? "
+                                            << (int)j << endl;
+
+  chromium.GetIntegerv( GL_AUX_BUFFERS, &i ); cout << "Aux Buffers: " << i << endl;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::issue_transformed_color
+//       Access: Public
+//  Description: Transform the color by the current color matrix, and
+//               calls the appropriate chromium.Color function.
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+issue_transformed_color(const Colorf &color) const {
+  // To be truly general, we really need a 5x5 matrix to transform a
+  // 4-component color.  Rather than messing with that, we instead
+  // treat the color as a 3-component RGB, which can be transformed by
+  // the ordinary 4x4 matrix, and a separate alpha value, which can be
+  // scaled and offsetted.
+  LPoint3f temp(color[0], color[1], color[2]);
+  temp = temp * get_current_color_mat();
+  float alpha = (color[3] * get_current_alpha_scale()) +
+    get_current_alpha_offset();
+
+  Colorf transformed(temp[0], temp[1], temp[2], alpha);
+
+  //   crgsg_cat.debug() << "Issuing color " << transformed << "\n";
+  //   crgsg_cat.debug() << "\tTransformed by " << get_current_color_mat() << "\n";
+  //   crgsg_cat.debug() << "\tAlpha Transformed by " << get_current_alpha_offset() << " "
+  //                     << get_current_alpha_scale() << "\n";
+  chromium.Color4fv(transformed.get_data());
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::free_pointers
+//       Access: Protected
+//  Description: Frees some memory that was explicitly allocated
+//               within the crgsg.
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+free_pointers() {
+  if (_light_info != (LightInfo *)NULL) {
+    delete[] _light_info;
+    _light_info = (LightInfo *)NULL;
+  }
+  if (_clip_plane_enabled != (bool *)NULL) {
+    delete[] _clip_plane_enabled;
+    _clip_plane_enabled = (bool *)NULL;
+  }
+  if (_cur_clip_plane_enabled != (bool *)NULL) {
+    delete[] _cur_clip_plane_enabled;
+    _cur_clip_plane_enabled = (bool *)NULL;
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::save_frame_buffer
+//       Access: Public
+//  Description: Saves the indicated planes of the frame buffer
+//               (within the indicated display region) and returns it
+//               in some meaningful form that can be restored later
+//               via restore_frame_buffer().  This is a helper
+//               function for push_frame_buffer() and
+//               pop_frame_buffer().
+////////////////////////////////////////////////////////////////////
+PT(SavedFrameBuffer) CRGraphicsStateGuardian::
+save_frame_buffer(const RenderBuffer &buffer,
+                  CPT(DisplayRegion) dr) {
+  CRSavedFrameBuffer *sfb = new CRSavedFrameBuffer(buffer, dr);
+
+  if (buffer._buffer_type & RenderBuffer::T_depth) {
+    // Save the depth buffer.
+    sfb->_depth =
+      new PixelBuffer(PixelBuffer::depth_buffer(dr->get_pixel_width(),
+                                                dr->get_pixel_height()));
+    copy_pixel_buffer(sfb->_depth, dr, buffer);
+  }
+
+  if (buffer._buffer_type & RenderBuffer::T_back) {
+    // Save the color buffer.
+    sfb->_back_rgba = new Texture;
+    copy_texture(sfb->_back_rgba->prepare(this), dr, buffer);
+  }
+
+  return sfb;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::restore_frame_buffer
+//       Access: Public
+//  Description: Restores the frame buffer that was previously saved.
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+restore_frame_buffer(SavedFrameBuffer *frame_buffer) {
+  CRSavedFrameBuffer *sfb = DCAST(CRSavedFrameBuffer, frame_buffer);
+
+  if (sfb->_back_rgba != (Texture *)NULL &&
+      (sfb->_buffer._buffer_type & RenderBuffer::T_back) != 0) {
+    // Restore the color buffer.
+    draw_texture(sfb->_back_rgba->prepare(this),
+                 sfb->_display_region, sfb->_buffer);
+  }
+
+  if (sfb->_depth != (PixelBuffer *)NULL &&
+      (sfb->_buffer._buffer_type & RenderBuffer::T_depth) != 0) {
+    // Restore the depth buffer.
+    draw_pixel_buffer(sfb->_depth, sfb->_display_region, sfb->_buffer);
+  }
+}
+
+#ifndef NDEBUG
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::build_phony_mipmaps
+//       Access: Protected
+//  Description: Generates a series of colored mipmap levels to aid in
+//               visualizing the mipmap levels as the hardware applies
+//               them.
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+build_phony_mipmaps(Texture *tex) {
+  PixelBuffer *pb = tex->_pbuffer;
+  int xsize = pb->get_xsize();
+  int ysize = pb->get_ysize();
+
+  crgsg_cat.info()
+    << "Building phony mipmap levels for " << tex->get_name() << "\n";
+  int level = 0;
+  while (xsize > 0 && ysize > 0) {
+    crgsg_cat.info(false)
+      << "  level " << level << " is " << xsize << " by " << ysize << "\n";
+    build_phony_mipmap_level(level, xsize, ysize);
+
+    xsize >>= 1;
+    ysize >>= 1;
+    level++;
+  }
+
+  while (xsize > 0) {
+    crgsg_cat.info(false)
+      << "  level " << level << " is " << xsize << " by 1\n";
+    build_phony_mipmap_level(level, xsize, 1);
+
+    xsize >>= 1;
+    level++;
+  }
+
+  while (ysize > 0) {
+    crgsg_cat.info(false)
+      << "  level " << level << " is 1 by " << ysize << "\n";
+    build_phony_mipmap_level(level, 1, ysize);
+
+    ysize >>= 1;
+    level++;
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::build_phony_mipmap_level
+//       Access: Protected
+//  Description: Generates a single colored mipmap level.
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+build_phony_mipmap_level(int level, int xsize, int ysize) {
+  static const int num_levels = 10;
+  static const char *level_filenames[num_levels] = {
+    "mipmap_level_0.rgb",
+    "mipmap_level_1.rgb",
+    "mipmap_level_2.rgb",
+    "mipmap_level_3.rgb",
+    "mipmap_level_4.rgb",
+    "mipmap_level_5.rgb",
+    "mipmap_level_6.rgb",
+    "mipmap_level_7.rgb",
+    "mipmap_level_8.rgb",
+    "mipmap_level_9.rgb"
+  };
+  static const RGBColorf level_colors[num_levels] = {
+    RGBColorf(1.0f, 1.0f, 1.0f),
+    RGBColorf(1.0f, 0.0f, 0.0f),
+    RGBColorf(0.0f, 1.0f, 0.0f),
+    RGBColorf(0.0f, 0.0f, 1.0f),
+    RGBColorf(1.0f, 1.0f, 0.0f),
+    RGBColorf(0.0f, 1.0f, 1.0f),
+    RGBColorf(1.0f, 0.0f, 1.0f),
+    RGBColorf(1.0f, 0.5, 0.0f),
+    RGBColorf(0.0f, 1.0f, 0.5),
+    RGBColorf(0.83, 0.71, 1.0f)
+  };
+
+  level = level % num_levels;
+  Filename filename(level_filenames[level]);
+
+  PNMImage image_sized(xsize, ysize);
+  PNMImage image_source;
+  if (filename.resolve_filename(get_texture_path()) ||
+      filename.resolve_filename(get_model_path())) {
+    image_source.read(filename);
+  }
+
+  if (image_source.is_valid()) {
+    image_sized.quick_filter_from(image_source);
+
+  } else {
+    crgsg_cat.info(false)
+      << "    " << filename << " cannot be read, making solid color mipmap.\n";
+    image_sized.fill(level_colors[level][0],
+                     level_colors[level][1],
+                     level_colors[level][2]);
+  }
+
+  PixelBuffer *pb = new PixelBuffer;
+  pb->load(image_sized);
+
+  GLenum internal_format = get_internal_image_format(pb->get_format());
+  GLenum external_format = get_external_image_format(pb->get_format());
+  GLenum type = get_image_type(pb->get_image_type());
+
+  chromium.TexImage2D(GL_TEXTURE_2D, level, internal_format,
+               pb->get_xsize(), pb->get_ysize(), pb->get_border(),
+               external_format, type, pb->_image );
+
+  delete pb;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRGraphicsStateGuardian::save_mipmap_images
+//       Access: Protected
+//  Description: Saves out each mipmap level of the indicated texture
+//               (which must also be the currently active texture in
+//               the GL state) as a separate image file to disk.
+////////////////////////////////////////////////////////////////////
+void CRGraphicsStateGuardian::
+save_mipmap_images(Texture *tex) {
+  Filename filename = tex->get_name();
+  string name;
+  if (filename.empty()) {
+    static int index = 0;
+    name = "texture" + format_string(index);
+    index++;
+  } else {
+    name = filename.get_basename_wo_extension();
+  }
+
+  PixelBuffer *pb = tex->get_ram_image();
+  nassertv(pb != (PixelBuffer *)NULL);
+
+  GLenum external_format = get_external_image_format(pb->get_format());
+  GLenum type = get_image_type(pb->get_image_type());
+
+  int xsize = pb->get_xsize();
+  int ysize = pb->get_ysize();
+
+  // Specify byte-alignment for the pixels on output.
+  set_pack_alignment(1);
+
+  int mipmap_level = 0;
+  do {
+    xsize = max(xsize, 1);
+    ysize = max(ysize, 1);
+
+    PT(PixelBuffer) mpb = 
+      new PixelBuffer(xsize, ysize, pb->get_num_components(),
+                      pb->get_component_width(), pb->get_image_type(),
+                      pb->get_format());
+    chromium.GetTexImage(GL_TEXTURE_2D, mipmap_level, external_format, 
+                  type, mpb->_image);
+    Filename mipmap_filename = name + "_" + format_string(mipmap_level) + ".rgb";
+    nout << "Writing mipmap level " << mipmap_level
+         << " (" << xsize << " by " << ysize << ") " 
+         << mipmap_filename << "\n";
+    mpb->write(mipmap_filename);
+
+    xsize >>= 1;
+    ysize >>= 1;
+    mipmap_level++;
+  } while (xsize > 0 && ysize > 0);
+}
+#endif  // NDEBUG
+
+// factory and type stuff
+
+GraphicsStateGuardian *CRGraphicsStateGuardian::
+make_GlGraphicsStateGuardian(const FactoryParams &params) {
+  GraphicsStateGuardian::GsgWindow *win_param;
+  if (!get_param_into(win_param, params)) {
+    crgsg_cat.error()
+      << "No window specified for gsg creation!" << endl;
+    return NULL;
+  }
+
+  GraphicsWindow *win = win_param->get_window();
+  return new CRGraphicsStateGuardian(win);
+}
+
+TypeHandle CRGraphicsStateGuardian::get_type(void) const {
+  return get_class_type();
+}
+
+TypeHandle CRGraphicsStateGuardian::get_class_type(void) {
+  return _type_handle;
+}
+
+void CRGraphicsStateGuardian::init_type(void) {
+  GraphicsStateGuardian::init_type();
+  register_type(_type_handle, "CRGraphicsStateGuardian",
+                GraphicsStateGuardian::get_class_type());
+}
+
+
+#ifdef GSG_VERBOSE
+
+void CRGraphicsStateGuardian::
+dump_state(void)
+{
+  if (crgsg_cat.is_debug())
+    {
+      int i;
+      ostream &dump = crgsg_cat.debug(false);
+      crgsg_cat.debug() << "Dumping GL State" << endl;
+
+      dump << "\t\t" << "GL_LINE_SMOOTH " << _line_smooth_enabled << " " << (bool)chromium.IsEnabled(GL_LINE_SMOOTH) << "\n";
+      dump << "\t\t" << "GL_POINT_SMOOTH " << _point_smooth_enabled << " " << (bool)chromium.IsEnabled(GL_POINT_SMOOTH) << "\n";
+      dump << "\t\t" << "GL_LIGHTING " << _lighting_enabled << " " << (bool)chromium.IsEnabled(GL_LIGHTING) << "\n";
+      for(i = 0; i < _max_lights; i++)
+        {
+          dump << "\t\t\t\t" << "GL_LIGHT" << i << " " << _light_info[i]._enabled << " " << (bool)chromium.IsEnabled(GL_LIGHT0+i) << "\n";
+        }
+      dump << "\t\t" << "GL_SCISSOR_TEST " << _scissor_enabled << " " << (bool)chromium.IsEnabled(GL_SCISSOR_TEST) << "\n";
+      dump << "\t\t" << "GL_TEXTURE_2D " << _texturing_enabled << " " << (bool)chromium.IsEnabled(GL_TEXTURE_2D) << "\n";
+      dump << "\t\t" << "GL_DITHER " << _dither_enabled << " " << (bool)chromium.IsEnabled(GL_DITHER) << "\n";
+      dump << "\t\t" << "GL_STENCIL_TEST " << " " << (bool)chromium.IsEnabled(GL_STENCIL_TEST) << "\n";
+      for(i = 0; i < _max_clip_planes; i++)
+        {
+          dump << "\t\t\t\t" << "GL_CLIP_PLANE" << i << " " << _clip_plane_enabled[i] << " " << (bool)chromium.IsEnabled(GL_CLIP_PLANE0+i) << "\n";
+        }
+      dump << "\t\t" << "GL_BLEND " << _blend_enabled << " " << (bool)chromium.IsEnabled(GL_BLEND) << "\n";
+      dump << "\t\t" << "GL_DEPTH_TEST " << _depth_test_enabled << " " << (bool)chromium.IsEnabled(GL_DEPTH_TEST) << "\n";
+      dump << "\t\t" << "GL_FOG " << _fog_enabled << " " << (bool)chromium.IsEnabled(GL_FOG) << "\n";
+      dump << "\t\t" << "GL_ALPHA_TEST " << _alpha_test_enabled << " " << (bool)chromium.IsEnabled(GL_ALPHA_TEST) << "\n";
+      dump << "\t\t" << "GL_POLYGON_OFFSET_FILL " << _polygon_offset_enabled << " " << (bool)chromium.IsEnabled(GL_POLYGON_OFFSET_FILL) << "\n";
+
+      dump << endl;
+    }
+}
+
+#else  // GSG_VERBOSE
+
+// This function does nothing unless GSG_VERBOSE is compiled in.
+void CRGraphicsStateGuardian::
+dump_state(void)
+{
+}
+
+#endif  // GSG_VERBOSE
+
+
+#ifdef GSG_VERBOSE
+
+// This is a handy function to output a GLenum value as a string, for
+// debugging.
+ostream &output_cr_enum(ostream &out, GLenum v) {
+  switch (v) {
+  case GL_FALSE:
+    return out << "GL_FALSE";
+  case GL_TRUE:
+    return out << "GL_TRUE";
+
+    /* Data types */
+  case GL_BYTE:
+    return out << "GL_BYTE";
+  case GL_UNSIGNED_BYTE:
+    return out << "GL_UNSIGNED_BYTE";
+  case GL_SHORT:
+    return out << "GL_SHORT";
+  case GL_UNSIGNED_SHORT:
+    return out << "GL_UNSIGNED_SHORT";
+  case GL_INT:
+    return out << "GL_INT";
+  case GL_UNSIGNED_INT:
+    return out << "GL_UNSIGNED_INT";
+  case GL_FLOAT:
+    return out << "GL_FLOAT";
+  case GL_DOUBLE:
+    return out << "GL_DOUBLE";
+  case GL_2_BYTES:
+    return out << "GL_2_BYTES";
+  case GL_3_BYTES:
+    return out << "GL_3_BYTES";
+  case GL_4_BYTES:
+    return out << "GL_4_BYTES";
+
+    /* Primitives */
+    /*
+      case GL_LINES:
+      return out << "GL_LINES";
+      case GL_POINTS:
+      return out << "GL_POINTS";
+    */
+  case GL_LINE_STRIP:
+    return out << "GL_LINE_STRIP";
+  case GL_LINE_LOOP:
+    return out << "GL_LINE_LOOP";
+  case GL_TRIANGLES:
+    return out << "GL_TRIANGLES";
+  case GL_TRIANGLE_STRIP:
+    return out << "GL_TRIANGLE_STRIP";
+  case GL_TRIANGLE_FAN:
+    return out << "GL_TRIANGLE_FAN";
+  case GL_QUADS:
+    return out << "GL_QUADS";
+  case GL_QUAD_STRIP:
+    return out << "GL_QUAD_STRIP";
+  case GL_POLYGON:
+    return out << "GL_POLYGON";
+  case GL_EDGE_FLAG:
+    return out << "GL_EDGE_FLAG";
+
+    /* Vertex Arrays */
+  case GL_VERTEX_ARRAY:
+    return out << "GL_VERTEX_ARRAY";
+  case GL_NORMAL_ARRAY:
+    return out << "GL_NORMAL_ARRAY";
+  case GL_COLOR_ARRAY:
+    return out << "GL_COLOR_ARRAY";
+  case GL_INDEX_ARRAY:
+    return out << "GL_INDEX_ARRAY";
+  case GL_TEXTURE_COORD_ARRAY:
+    return out << "GL_TEXTURE_COORD_ARRAY";
+  case GL_EDGE_FLAG_ARRAY:
+    return out << "GL_EDGE_FLAG_ARRAY";
+  case GL_VERTEX_ARRAY_SIZE:
+    return out << "GL_VERTEX_ARRAY_SIZE";
+  case GL_VERTEX_ARRAY_TYPE:
+    return out << "GL_VERTEX_ARRAY_TYPE";
+  case GL_VERTEX_ARRAY_STRIDE:
+    return out << "GL_VERTEX_ARRAY_STRIDE";
+  case GL_NORMAL_ARRAY_TYPE:
+    return out << "GL_NORMAL_ARRAY_TYPE";
+  case GL_NORMAL_ARRAY_STRIDE:
+    return out << "GL_NORMAL_ARRAY_STRIDE";
+  case GL_COLOR_ARRAY_SIZE:
+    return out << "GL_COLOR_ARRAY_SIZE";
+  case GL_COLOR_ARRAY_TYPE:
+    return out << "GL_COLOR_ARRAY_TYPE";
+  case GL_COLOR_ARRAY_STRIDE:
+    return out << "GL_COLOR_ARRAY_STRIDE";
+  case GL_INDEX_ARRAY_TYPE:
+    return out << "GL_INDEX_ARRAY_TYPE";
+  case GL_INDEX_ARRAY_STRIDE:
+    return out << "GL_INDEX_ARRAY_STRIDE";
+  case GL_TEXTURE_COORD_ARRAY_SIZE:
+    return out << "GL_TEXTURE_COORD_ARRAY_SIZE";
+  case GL_TEXTURE_COORD_ARRAY_TYPE:
+    return out << "GL_TEXTURE_COORD_ARRAY_TYPE";
+  case GL_TEXTURE_COORD_ARRAY_STRIDE:
+    return out << "GL_TEXTURE_COORD_ARRAY_STRIDE";
+  case GL_EDGE_FLAG_ARRAY_STRIDE:
+    return out << "GL_EDGE_FLAG_ARRAY_STRIDE";
+  case GL_VERTEX_ARRAY_POINTER:
+    return out << "GL_VERTEX_ARRAY_POINTER";
+  case GL_NORMAL_ARRAY_POINTER:
+    return out << "GL_NORMAL_ARRAY_POINTER";
+  case GL_COLOR_ARRAY_POINTER:
+    return out << "GL_COLOR_ARRAY_POINTER";
+  case GL_INDEX_ARRAY_POINTER:
+    return out << "GL_INDEX_ARRAY_POINTER";
+  case GL_TEXTURE_COORD_ARRAY_POINTER:
+    return out << "GL_TEXTURE_COORD_ARRAY_POINTER";
+  case GL_EDGE_FLAG_ARRAY_POINTER:
+    return out << "GL_EDGE_FLAG_ARRAY_POINTER";
+  case GL_V2F:
+    return out << "GL_V2F";
+  case GL_V3F:
+    return out << "GL_V3F";
+  case GL_C4UB_V2F:
+    return out << "GL_C4UB_V2F";
+  case GL_C4UB_V3F:
+    return out << "GL_C4UB_V3F";
+  case GL_C3F_V3F:
+    return out << "GL_C3F_V3F";
+  case GL_N3F_V3F:
+    return out << "GL_N3F_V3F";
+  case GL_C4F_N3F_V3F:
+    return out << "GL_C4F_N3F_V3F";
+  case GL_T2F_V3F:
+    return out << "GL_T2F_V3F";
+  case GL_T4F_V4F:
+    return out << "GL_T4F_V4F";
+  case GL_T2F_C4UB_V3F:
+    return out << "GL_T2F_C4UB_V3F";
+  case GL_T2F_C3F_V3F:
+    return out << "GL_T2F_C3F_V3F";
+  case GL_T2F_N3F_V3F:
+    return out << "GL_T2F_N3F_V3F";
+  case GL_T2F_C4F_N3F_V3F:
+    return out << "GL_T2F_C4F_N3F_V3F";
+  case GL_T4F_C4F_N3F_V4F:
+    return out << "GL_T4F_C4F_N3F_V4F";
+
+    /* Matrix Mode */
+  case GL_MATRIX_MODE:
+    return out << "GL_MATRIX_MODE";
+  case GL_MODELVIEW:
+    return out << "GL_MODELVIEW";
+  case GL_PROJECTION:
+    return out << "GL_PROJECTION";
+  case GL_TEXTURE:
+    return out << "GL_TEXTURE";
+
+    /* Points */
+  case GL_POINT_SMOOTH:
+    return out << "GL_POINT_SMOOTH";
+  case GL_POINT_SIZE:
+    return out << "GL_POINT_SIZE";
+  case GL_POINT_SIZE_GRANULARITY:
+    return out << "GL_POINT_SIZE_GRANULARITY";
+  case GL_POINT_SIZE_RANGE:
+    return out << "GL_POINT_SIZE_RANGE";
+
+    /* Lines */
+  case GL_LINE_SMOOTH:
+    return out << "GL_LINE_SMOOTH";
+  case GL_LINE_STIPPLE:
+    return out << "GL_LINE_STIPPLE";
+  case GL_LINE_STIPPLE_PATTERN:
+    return out << "GL_LINE_STIPPLE_PATTERN";
+  case GL_LINE_STIPPLE_REPEAT:
+    return out << "GL_LINE_STIPPLE_REPEAT";
+  case GL_LINE_WIDTH:
+    return out << "GL_LINE_WIDTH";
+  case GL_LINE_WIDTH_GRANULARITY:
+    return out << "GL_LINE_WIDTH_GRANULARITY";
+  case GL_LINE_WIDTH_RANGE:
+    return out << "GL_LINE_WIDTH_RANGE";
+
+    /* Polygons */
+  case GL_POINT:
+    return out << "GL_POINT";
+  case GL_LINE:
+    return out << "GL_LINE";
+  case GL_FILL:
+    return out << "GL_FILL";
+  case GL_CCW:
+    return out << "GL_CCW";
+  case GL_CW:
+    return out << "GL_CW";
+  case GL_FRONT:
+    return out << "GL_FRONT";
+  case GL_BACK:
+    return out << "GL_BACK";
+  case GL_CULL_FACE:
+    return out << "GL_CULL_FACE";
+  case GL_CULL_FACE_MODE:
+    return out << "GL_CULL_FACE_MODE";
+  case GL_POLYGON_SMOOTH:
+    return out << "GL_POLYGON_SMOOTH";
+  case GL_POLYGON_STIPPLE:
+    return out << "GL_POLYGON_STIPPLE";
+  case GL_FRONT_FACE:
+    return out << "GL_FRONT_FACE";
+  case GL_POLYGON_MODE:
+    return out << "GL_POLYGON_MODE";
+  case GL_POLYGON_OFFSET_FACTOR:
+    return out << "GL_POLYGON_OFFSET_FACTOR";
+  case GL_POLYGON_OFFSET_UNITS:
+    return out << "GL_POLYGON_OFFSET_UNITS";
+  case GL_POLYGON_OFFSET_POINT:
+    return out << "GL_POLYGON_OFFSET_POINT";
+  case GL_POLYGON_OFFSET_LINE:
+    return out << "GL_POLYGON_OFFSET_LINE";
+  case GL_POLYGON_OFFSET_FILL:
+    return out << "GL_POLYGON_OFFSET_FILL";
+
+    /* Display Lists */
+  case GL_COMPILE:
+    return out << "GL_COMPILE";
+  case GL_COMPILE_AND_EXECUTE:
+    return out << "GL_COMPILE_AND_EXECUTE";
+  case GL_LIST_BASE:
+    return out << "GL_LIST_BASE";
+  case GL_LIST_INDEX:
+    return out << "GL_LIST_INDEX";
+  case GL_LIST_MODE:
+    return out << "GL_LIST_MODE";
+
+    /* Depth buffer */
+  case GL_NEVER:
+    return out << "GL_NEVER";
+  case GL_LESS:
+    return out << "GL_LESS";
+  case GL_GEQUAL:
+    return out << "GL_GEQUAL";
+  case GL_LEQUAL:
+    return out << "GL_LEQUAL";
+  case GL_GREATER:
+    return out << "GL_GREATER";
+  case GL_NOTEQUAL:
+    return out << "GL_NOTEQUAL";
+  case GL_EQUAL:
+    return out << "GL_EQUAL";
+  case GL_ALWAYS:
+    return out << "GL_ALWAYS";
+  case GL_DEPTH_TEST:
+    return out << "GL_DEPTH_TEST";
+  case GL_DEPTH_BITS:
+    return out << "GL_DEPTH_BITS";
+  case GL_DEPTH_CLEAR_VALUE:
+    return out << "GL_DEPTH_CLEAR_VALUE";
+  case GL_DEPTH_FUNC:
+    return out << "GL_DEPTH_FUNC";
+  case GL_DEPTH_RANGE:
+    return out << "GL_DEPTH_RANGE";
+  case GL_DEPTH_WRITEMASK:
+    return out << "GL_DEPTH_WRITEMASK";
+  case GL_DEPTH_COMPONENT:
+    return out << "GL_DEPTH_COMPONENT";
+
+    /* Lighting */
+  case GL_LIGHTING:
+    return out << "GL_LIGHTING";
+  case GL_LIGHT0:
+    return out << "GL_LIGHT0";
+  case GL_LIGHT1:
+    return out << "GL_LIGHT1";
+  case GL_LIGHT2:
+    return out << "GL_LIGHT2";
+  case GL_LIGHT3:
+    return out << "GL_LIGHT3";
+  case GL_LIGHT4:
+    return out << "GL_LIGHT4";
+  case GL_LIGHT5:
+    return out << "GL_LIGHT5";
+  case GL_LIGHT6:
+    return out << "GL_LIGHT6";
+  case GL_LIGHT7:
+    return out << "GL_LIGHT7";
+  case GL_SPOT_EXPONENT:
+    return out << "GL_SPOT_EXPONENT";
+  case GL_SPOT_CUTOFF:
+    return out << "GL_SPOT_CUTOFF";
+  case GL_CONSTANT_ATTENUATION:
+    return out << "GL_CONSTANT_ATTENUATION";
+  case GL_LINEAR_ATTENUATION:
+    return out << "GL_LINEAR_ATTENUATION";
+  case GL_QUADRATIC_ATTENUATION:
+    return out << "GL_QUADRATIC_ATTENUATION";
+  case GL_AMBIENT:
+    return out << "GL_AMBIENT";
+  case GL_DIFFUSE:
+    return out << "GL_DIFFUSE";
+  case GL_SPECULAR:
+    return out << "GL_SPECULAR";
+  case GL_SHININESS:
+    return out << "GL_SHININESS";
+  case GL_EMISSION:
+    return out << "GL_EMISSION";
+  case GL_POSITION:
+    return out << "GL_POSITION";
+  case GL_SPOT_DIRECTION:
+    return out << "GL_SPOT_DIRECTION";
+  case GL_AMBIENT_AND_DIFFUSE:
+    return out << "GL_AMBIENT_AND_DIFFUSE";
+  case GL_COLOR_INDEXES:
+    return out << "GL_COLOR_INDEXES";
+  case GL_LIGHT_MODEL_TWO_SIDE:
+    return out << "GL_LIGHT_MODEL_TWO_SIDE";
+  case GL_LIGHT_MODEL_LOCAL_VIEWER:
+    return out << "GL_LIGHT_MODEL_LOCAL_VIEWER";
+  case GL_LIGHT_MODEL_AMBIENT:
+    return out << "GL_LIGHT_MODEL_AMBIENT";
+  case GL_FRONT_AND_BACK:
+    return out << "GL_FRONT_AND_BACK";
+  case GL_SHADE_MODEL:
+    return out << "GL_SHADE_MODEL";
+  case GL_FLAT:
+    return out << "GL_FLAT";
+  case GL_SMOOTH:
+    return out << "GL_SMOOTH";
+  case GL_COLOR_MATERIAL:
+    return out << "GL_COLOR_MATERIAL";
+  case GL_COLOR_MATERIAL_FACE:
+    return out << "GL_COLOR_MATERIAL_FACE";
+  case GL_COLOR_MATERIAL_PARAMETER:
+    return out << "GL_COLOR_MATERIAL_PARAMETER";
+  case GL_NORMALIZE:
+    return out << "GL_NORMALIZE";
+
+    /* User clipping planes */
+  case GL_CLIP_PLANE0:
+    return out << "GL_CLIP_PLANE0";
+  case GL_CLIP_PLANE1:
+    return out << "GL_CLIP_PLANE1";
+  case GL_CLIP_PLANE2:
+    return out << "GL_CLIP_PLANE2";
+  case GL_CLIP_PLANE3:
+    return out << "GL_CLIP_PLANE3";
+  case GL_CLIP_PLANE4:
+    return out << "GL_CLIP_PLANE4";
+  case GL_CLIP_PLANE5:
+    return out << "GL_CLIP_PLANE5";
+
+    /* Accumulation buffer */
+  case GL_ACCUM_RED_BITS:
+    return out << "GL_ACCUM_RED_BITS";
+  case GL_ACCUM_GREEN_BITS:
+    return out << "GL_ACCUM_GREEN_BITS";
+  case GL_ACCUM_BLUE_BITS:
+    return out << "GL_ACCUM_BLUE_BITS";
+  case GL_ACCUM_ALPHA_BITS:
+    return out << "GL_ACCUM_ALPHA_BITS";
+  case GL_ACCUM_CLEAR_VALUE:
+    return out << "GL_ACCUM_CLEAR_VALUE";
+  case GL_ACCUM:
+    return out << "GL_ACCUM";
+  case GL_ADD:
+    return out << "GL_ADD";
+  case GL_LOAD:
+    return out << "GL_LOAD";
+  case GL_MULT:
+    return out << "GL_MULT";
+
+    /* Alpha testing */
+  case GL_ALPHA_TEST:
+    return out << "GL_ALPHA_TEST";
+  case GL_ALPHA_TEST_REF:
+    return out << "GL_ALPHA_TEST_REF";
+  case GL_ALPHA_TEST_FUNC:
+    return out << "GL_ALPHA_TEST_FUNC";
+
+    /* Blending */
+  case GL_BLEND:
+    return out << "GL_BLEND";
+  case GL_BLEND_SRC:
+    return out << "GL_BLEND_SRC";
+  case GL_BLEND_DST:
+    return out << "GL_BLEND_DST";
+    /*
+      case GL_ZERO:
+      return out << "GL_ZERO";
+      case GL_ONE:
+      return out << "GL_ONE";
+    */
+  case GL_SRC_COLOR:
+    return out << "GL_SRC_COLOR";
+  case GL_ONE_MINUS_SRC_COLOR:
+    return out << "GL_ONE_MINUS_SRC_COLOR";
+  case GL_DST_COLOR:
+    return out << "GL_DST_COLOR";
+  case GL_ONE_MINUS_DST_COLOR:
+    return out << "GL_ONE_MINUS_DST_COLOR";
+  case GL_SRC_ALPHA:
+    return out << "GL_SRC_ALPHA";
+  case GL_ONE_MINUS_SRC_ALPHA:
+    return out << "GL_ONE_MINUS_SRC_ALPHA";
+  case GL_DST_ALPHA:
+    return out << "GL_DST_ALPHA";
+  case GL_ONE_MINUS_DST_ALPHA:
+    return out << "GL_ONE_MINUS_DST_ALPHA";
+  case GL_SRC_ALPHA_SATURATE:
+    return out << "GL_SRC_ALPHA_SATURATE";
+  case GL_CONSTANT_COLOR:
+    return out << "GL_CONSTANT_COLOR";
+  case GL_ONE_MINUS_CONSTANT_COLOR:
+    return out << "GL_ONE_MINUS_CONSTANT_COLOR";
+  case GL_CONSTANT_ALPHA:
+    return out << "GL_CONSTANT_ALPHA";
+  case GL_ONE_MINUS_CONSTANT_ALPHA:
+    return out << "GL_ONE_MINUS_CONSTANT_ALPHA";
+
+    /* Render Mode */
+  case GL_FEEDBACK:
+    return out << "GL_FEEDBACK";
+  case GL_RENDER:
+    return out << "GL_RENDER";
+  case GL_SELECT:
+    return out << "GL_SELECT";
+
+    /* Feedback */
+  case GL_2D:
+    return out << "GL_2D";
+  case GL_3D:
+    return out << "GL_3D";
+  case GL_3D_COLOR:
+    return out << "GL_3D_COLOR";
+  case GL_3D_COLOR_TEXTURE:
+    return out << "GL_3D_COLOR_TEXTURE";
+  case GL_4D_COLOR_TEXTURE:
+    return out << "GL_4D_COLOR_TEXTURE";
+  case GL_POINT_TOKEN:
+    return out << "GL_POINT_TOKEN";
+  case GL_LINE_TOKEN:
+    return out << "GL_LINE_TOKEN";
+  case GL_LINE_RESET_TOKEN:
+    return out << "GL_LINE_RESET_TOKEN";
+  case GL_POLYGON_TOKEN:
+    return out << "GL_POLYGON_TOKEN";
+  case GL_BITMAP_TOKEN:
+    return out << "GL_BITMAP_TOKEN";
+  case GL_DRAW_PIXEL_TOKEN:
+    return out << "GL_DRAW_PIXEL_TOKEN";
+  case GL_COPY_PIXEL_TOKEN:
+    return out << "GL_COPY_PIXEL_TOKEN";
+  case GL_PASS_THROUGH_TOKEN:
+    return out << "GL_PASS_THROUGH_TOKEN";
+  case GL_FEEDBACK_BUFFER_POINTER:
+    return out << "GL_FEEDBACK_BUFFER_POINTER";
+  case GL_FEEDBACK_BUFFER_SIZE:
+    return out << "GL_FEEDBACK_BUFFER_SIZE";
+  case GL_FEEDBACK_BUFFER_TYPE:
+    return out << "GL_FEEDBACK_BUFFER_TYPE";
+
+    /* Selection */
+  case GL_SELECTION_BUFFER_POINTER:
+    return out << "GL_SELECTION_BUFFER_POINTER";
+  case GL_SELECTION_BUFFER_SIZE:
+    return out << "GL_SELECTION_BUFFER_SIZE";
+
+    /* Fog */
+  case GL_FOG:
+    return out << "GL_FOG";
+  case GL_FOG_MODE:
+    return out << "GL_FOG_MODE";
+  case GL_FOG_DENSITY:
+    return out << "GL_FOG_DENSITY";
+  case GL_FOG_COLOR:
+    return out << "GL_FOG_COLOR";
+  case GL_FOG_INDEX:
+    return out << "GL_FOG_INDEX";
+  case GL_FOG_START:
+    return out << "GL_FOG_START";
+  case GL_FOG_END:
+    return out << "GL_FOG_END";
+  case GL_LINEAR:
+    return out << "GL_LINEAR";
+  case GL_EXP:
+    return out << "GL_EXP";
+  case GL_EXP2:
+    return out << "GL_EXP2";
+
+    /* Logic Ops */
+  case GL_LOGIC_OP:
+    return out << "GL_LOGIC_OP";
+    /*
+      case GL_INDEX_LOGIC_OP:
+      return out << "GL_INDEX_LOGIC_OP";
+    */
+  case GL_COLOR_LOGIC_OP:
+    return out << "GL_COLOR_LOGIC_OP";
+  case GL_LOGIC_OP_MODE:
+    return out << "GL_LOGIC_OP_MODE";
+  case GL_CLEAR:
+    return out << "GL_CLEAR";
+  case GL_SET:
+    return out << "GL_SET";
+  case GL_COPY:
+    return out << "GL_COPY";
+  case GL_COPY_INVERTED:
+    return out << "GL_COPY_INVERTED";
+  case GL_NOOP:
+    return out << "GL_NOOP";
+  case GL_INVERT:
+    return out << "GL_INVERT";
+  case GL_AND:
+    return out << "GL_AND";
+  case GL_NAND:
+    return out << "GL_NAND";
+  case GL_OR:
+    return out << "GL_OR";
+  case GL_NOR:
+    return out << "GL_NOR";
+  case GL_XOR:
+    return out << "GL_XOR";
+  case GL_EQUIV:
+    return out << "GL_EQUIV";
+  case GL_AND_REVERSE:
+    return out << "GL_AND_REVERSE";
+  case GL_AND_INVERTED:
+    return out << "GL_AND_INVERTED";
+  case GL_OR_REVERSE:
+    return out << "GL_OR_REVERSE";
+  case GL_OR_INVERTED:
+    return out << "GL_OR_INVERTED";
+
+    /* Stencil */
+  case GL_STENCIL_TEST:
+    return out << "GL_STENCIL_TEST";
+  case GL_STENCIL_WRITEMASK:
+    return out << "GL_STENCIL_WRITEMASK";
+  case GL_STENCIL_BITS:
+    return out << "GL_STENCIL_BITS";
+  case GL_STENCIL_FUNC:
+    return out << "GL_STENCIL_FUNC";
+  case GL_STENCIL_VALUE_MASK:
+    return out << "GL_STENCIL_VALUE_MASK";
+  case GL_STENCIL_REF:
+    return out << "GL_STENCIL_REF";
+  case GL_STENCIL_FAIL:
+    return out << "GL_STENCIL_FAIL";
+  case GL_STENCIL_PASS_DEPTH_PASS:
+    return out << "GL_STENCIL_PASS_DEPTH_PASS";
+  case GL_STENCIL_PASS_DEPTH_FAIL:
+    return out << "GL_STENCIL_PASS_DEPTH_FAIL";
+  case GL_STENCIL_CLEAR_VALUE:
+    return out << "GL_STENCIL_CLEAR_VALUE";
+  case GL_STENCIL_INDEX:
+    return out << "GL_STENCIL_INDEX";
+  case GL_KEEP:
+    return out << "GL_KEEP";
+  case GL_REPLACE:
+    return out << "GL_REPLACE";
+  case GL_INCR:
+    return out << "GL_INCR";
+  case GL_DECR:
+    return out << "GL_DECR";
+
+    /* Buffers, Pixel Drawing/Reading */
+    /*
+      case GL_NONE:
+      return out << "GL_NONE";
+    */
+  case GL_LEFT:
+    return out << "GL_LEFT";
+  case GL_RIGHT:
+    return out << "GL_RIGHT";
+  case GL_FRONT_LEFT:
+    return out << "GL_FRONT_LEFT";
+  case GL_FRONT_RIGHT:
+    return out << "GL_FRONT_RIGHT";
+  case GL_BACK_LEFT:
+    return out << "GL_BACK_LEFT";
+  case GL_BACK_RIGHT:
+    return out << "GL_BACK_RIGHT";
+  case GL_AUX0:
+    return out << "GL_AUX0";
+  case GL_AUX1:
+    return out << "GL_AUX1";
+  case GL_AUX2:
+    return out << "GL_AUX2";
+  case GL_AUX3:
+    return out << "GL_AUX3";
+  case GL_COLOR_INDEX:
+    return out << "GL_COLOR_INDEX";
+  case GL_RED:
+    return out << "GL_RED";
+  case GL_GREEN:
+    return out << "GL_GREEN";
+  case GL_BLUE:
+    return out << "GL_BLUE";
+  case GL_ALPHA:
+    return out << "GL_ALPHA";
+  case GL_LUMINANCE:
+    return out << "GL_LUMINANCE";
+  case GL_LUMINANCE_ALPHA:
+    return out << "GL_LUMINANCE_ALPHA";
+  case GL_ALPHA_BITS:
+    return out << "GL_ALPHA_BITS";
+  case GL_RED_BITS:
+    return out << "GL_RED_BITS";
+  case GL_GREEN_BITS:
+    return out << "GL_GREEN_BITS";
+  case GL_BLUE_BITS:
+    return out << "GL_BLUE_BITS";
+  case GL_INDEX_BITS:
+    return out << "GL_INDEX_BITS";
+  case GL_SUBPIXEL_BITS:
+    return out << "GL_SUBPIXEL_BITS";
+  case GL_AUX_BUFFERS:
+    return out << "GL_AUX_BUFFERS";
+  case GL_READ_BUFFER:
+    return out << "GL_READ_BUFFER";
+  case GL_DRAW_BUFFER:
+    return out << "GL_DRAW_BUFFER";
+  case GL_DOUBLEBUFFER:
+    return out << "GL_DOUBLEBUFFER";
+  case GL_STEREO:
+    return out << "GL_STEREO";
+  case GL_BITMAP:
+    return out << "GL_BITMAP";
+  case GL_COLOR:
+    return out << "GL_COLOR";
+  case GL_DEPTH:
+    return out << "GL_DEPTH";
+  case GL_STENCIL:
+    return out << "GL_STENCIL";
+  case GL_DITHER:
+    return out << "GL_DITHER";
+  case GL_RGB:
+    return out << "GL_RGB";
+  case GL_RGBA:
+    return out << "GL_RGBA";
+
+    /* Implementation limits */
+  case GL_MAX_LIST_NESTING:
+    return out << "GL_MAX_LIST_NESTING";
+  case GL_MAX_ATTRIB_STACK_DEPTH:
+    return out << "GL_MAX_ATTRIB_STACK_DEPTH";
+  case GL_MAX_MODELVIEW_STACK_DEPTH:
+    return out << "GL_MAX_MODELVIEW_STACK_DEPTH";
+  case GL_MAX_NAME_STACK_DEPTH:
+    return out << "GL_MAX_NAME_STACK_DEPTH";
+  case GL_MAX_PROJECTION_STACK_DEPTH:
+    return out << "GL_MAX_PROJECTION_STACK_DEPTH";
+  case GL_MAX_TEXTURE_STACK_DEPTH:
+    return out << "GL_MAX_TEXTURE_STACK_DEPTH";
+  case GL_MAX_EVAL_ORDER:
+    return out << "GL_MAX_EVAL_ORDER";
+  case GL_MAX_LIGHTS:
+    return out << "GL_MAX_LIGHTS";
+  case GL_MAX_CLIP_PLANES:
+    return out << "GL_MAX_CLIP_PLANES";
+  case GL_MAX_TEXTURE_SIZE:
+    return out << "GL_MAX_TEXTURE_SIZE";
+  case GL_MAX_PIXEL_MAP_TABLE:
+    return out << "GL_MAX_PIXEL_MAP_TABLE";
+  case GL_MAX_VIEWPORT_DIMS:
+    return out << "GL_MAX_VIEWPORT_DIMS";
+  case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
+    return out << "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH";
+
+    /* Gets */
+  case GL_ATTRIB_STACK_DEPTH:
+    return out << "GL_ATTRIB_STACK_DEPTH";
+  case GL_CLIENT_ATTRIB_STACK_DEPTH:
+    return out << "GL_CLIENT_ATTRIB_STACK_DEPTH";
+  case GL_COLOR_CLEAR_VALUE:
+    return out << "GL_COLOR_CLEAR_VALUE";
+  case GL_COLOR_WRITEMASK:
+    return out << "GL_COLOR_WRITEMASK";
+  case GL_CURRENT_INDEX:
+    return out << "GL_CURRENT_INDEX";
+  case GL_CURRENT_COLOR:
+    return out << "GL_CURRENT_COLOR";
+  case GL_CURRENT_NORMAL:
+    return out << "GL_CURRENT_NORMAL";
+  case GL_CURRENT_RASTER_COLOR:
+    return out << "GL_CURRENT_RASTER_COLOR";
+  case GL_CURRENT_RASTER_DISTANCE:
+    return out << "GL_CURRENT_RASTER_DISTANCE";
+  case GL_CURRENT_RASTER_INDEX:
+    return out << "GL_CURRENT_RASTER_INDEX";
+  case GL_CURRENT_RASTER_POSITION:
+    return out << "GL_CURRENT_RASTER_POSITION";
+  case GL_CURRENT_RASTER_TEXTURE_COORDS:
+    return out << "GL_CURRENT_RASTER_TEXTURE_COORDS";
+  case GL_CURRENT_RASTER_POSITION_VALID:
+    return out << "GL_CURRENT_RASTER_POSITION_VALID";
+  case GL_CURRENT_TEXTURE_COORDS:
+    return out << "GL_CURRENT_TEXTURE_COORDS";
+  case GL_INDEX_CLEAR_VALUE:
+    return out << "GL_INDEX_CLEAR_VALUE";
+  case GL_INDEX_MODE:
+    return out << "GL_INDEX_MODE";
+  case GL_INDEX_WRITEMASK:
+    return out << "GL_INDEX_WRITEMASK";
+  case GL_MODELVIEW_MATRIX:
+    return out << "GL_MODELVIEW_MATRIX";
+  case GL_MODELVIEW_STACK_DEPTH:
+    return out << "GL_MODELVIEW_STACK_DEPTH";
+  case GL_NAME_STACK_DEPTH:
+    return out << "GL_NAME_STACK_DEPTH";
+  case GL_PROJECTION_MATRIX:
+    return out << "GL_PROJECTION_MATRIX";
+  case GL_PROJECTION_STACK_DEPTH:
+    return out << "GL_PROJECTION_STACK_DEPTH";
+  case GL_RENDER_MODE:
+    return out << "GL_RENDER_MODE";
+  case GL_RGBA_MODE:
+    return out << "GL_RGBA_MODE";
+  case GL_TEXTURE_MATRIX:
+    return out << "GL_TEXTURE_MATRIX";
+  case GL_TEXTURE_STACK_DEPTH:
+    return out << "GL_TEXTURE_STACK_DEPTH";
+  case GL_VIEWPORT:
+    return out << "GL_VIEWPORT";
+
+
+    /* Evaluators */
+  case GL_AUTO_NORMAL:
+    return out << "GL_AUTO_NORMAL";
+  case GL_MAP1_COLOR_4:
+    return out << "GL_MAP1_COLOR_4";
+  case GL_MAP1_GRID_DOMAIN:
+    return out << "GL_MAP1_GRID_DOMAIN";
+  case GL_MAP1_GRID_SEGMENTS:
+    return out << "GL_MAP1_GRID_SEGMENTS";
+  case GL_MAP1_INDEX:
+    return out << "GL_MAP1_INDEX";
+  case GL_MAP1_NORMAL:
+    return out << "GL_MAP1_NORMAL";
+  case GL_MAP1_TEXTURE_COORD_1:
+    return out << "GL_MAP1_TEXTURE_COORD_1";
+  case GL_MAP1_TEXTURE_COORD_2:
+    return out << "GL_MAP1_TEXTURE_COORD_2";
+  case GL_MAP1_TEXTURE_COORD_3:
+    return out << "GL_MAP1_TEXTURE_COORD_3";
+  case GL_MAP1_TEXTURE_COORD_4:
+    return out << "GL_MAP1_TEXTURE_COORD_4";
+  case GL_MAP1_VERTEX_3:
+    return out << "GL_MAP1_VERTEX_3";
+  case GL_MAP1_VERTEX_4:
+    return out << "GL_MAP1_VERTEX_4";
+  case GL_MAP2_COLOR_4:
+    return out << "GL_MAP2_COLOR_4";
+  case GL_MAP2_GRID_DOMAIN:
+    return out << "GL_MAP2_GRID_DOMAIN";
+  case GL_MAP2_GRID_SEGMENTS:
+    return out << "GL_MAP2_GRID_SEGMENTS";
+  case GL_MAP2_INDEX:
+    return out << "GL_MAP2_INDEX";
+  case GL_MAP2_NORMAL:
+    return out << "GL_MAP2_NORMAL";
+  case GL_MAP2_TEXTURE_COORD_1:
+    return out << "GL_MAP2_TEXTURE_COORD_1";
+  case GL_MAP2_TEXTURE_COORD_2:
+    return out << "GL_MAP2_TEXTURE_COORD_2";
+  case GL_MAP2_TEXTURE_COORD_3:
+    return out << "GL_MAP2_TEXTURE_COORD_3";
+  case GL_MAP2_TEXTURE_COORD_4:
+    return out << "GL_MAP2_TEXTURE_COORD_4";
+  case GL_MAP2_VERTEX_3:
+    return out << "GL_MAP2_VERTEX_3";
+  case GL_MAP2_VERTEX_4:
+    return out << "GL_MAP2_VERTEX_4";
+  case GL_COEFF:
+    return out << "GL_COEFF";
+  case GL_DOMAIN:
+    return out << "GL_DOMAIN";
+  case GL_ORDER:
+    return out << "GL_ORDER";
+
+    /* Hints */
+  case GL_FOG_HINT:
+    return out << "GL_FOG_HINT";
+  case GL_LINE_SMOOTH_HINT:
+    return out << "GL_LINE_SMOOTH_HINT";
+  case GL_PERSPECTIVE_CORRECTION_HINT:
+    return out << "GL_PERSPECTIVE_CORRECTION_HINT";
+  case GL_POINT_SMOOTH_HINT:
+    return out << "GL_POINT_SMOOTH_HINT";
+  case GL_POLYGON_SMOOTH_HINT:
+    return out << "GL_POLYGON_SMOOTH_HINT";
+  case GL_DONT_CARE:
+    return out << "GL_DONT_CARE";
+  case GL_FASTEST:
+    return out << "GL_FASTEST";
+  case GL_NICEST:
+    return out << "GL_NICEST";
+
+    /* Scissor box */
+  case GL_SCISSOR_TEST:
+    return out << "GL_SCISSOR_TEST";
+  case GL_SCISSOR_BOX:
+    return out << "GL_SCISSOR_BOX";
+
+    /* Pixel Mode / Transfer */
+  case GL_MAP_COLOR:
+    return out << "GL_MAP_COLOR";
+  case GL_MAP_STENCIL:
+    return out << "GL_MAP_STENCIL";
+  case GL_INDEX_SHIFT:
+    return out << "GL_INDEX_SHIFT";
+  case GL_INDEX_OFFSET:
+    return out << "GL_INDEX_OFFSET";
+  case GL_RED_SCALE:
+    return out << "GL_RED_SCALE";
+  case GL_RED_BIAS:
+    return out << "GL_RED_BIAS";
+  case GL_GREEN_SCALE:
+    return out << "GL_GREEN_SCALE";
+  case GL_GREEN_BIAS:
+    return out << "GL_GREEN_BIAS";
+  case GL_BLUE_SCALE:
+    return out << "GL_BLUE_SCALE";
+  case GL_BLUE_BIAS:
+    return out << "GL_BLUE_BIAS";
+  case GL_ALPHA_SCALE:
+    return out << "GL_ALPHA_SCALE";
+  case GL_ALPHA_BIAS:
+    return out << "GL_ALPHA_BIAS";
+  case GL_DEPTH_SCALE:
+    return out << "GL_DEPTH_SCALE";
+  case GL_DEPTH_BIAS:
+    return out << "GL_DEPTH_BIAS";
+  case GL_PIXEL_MAP_S_TO_S_SIZE:
+    return out << "GL_PIXEL_MAP_S_TO_S_SIZE";
+  case GL_PIXEL_MAP_I_TO_I_SIZE:
+    return out << "GL_PIXEL_MAP_I_TO_I_SIZE";
+  case GL_PIXEL_MAP_I_TO_R_SIZE:
+    return out << "GL_PIXEL_MAP_I_TO_R_SIZE";
+  case GL_PIXEL_MAP_I_TO_G_SIZE:
+    return out << "GL_PIXEL_MAP_I_TO_G_SIZE";
+  case GL_PIXEL_MAP_I_TO_B_SIZE:
+    return out << "GL_PIXEL_MAP_I_TO_B_SIZE";
+  case GL_PIXEL_MAP_I_TO_A_SIZE:
+    return out << "GL_PIXEL_MAP_I_TO_A_SIZE";
+  case GL_PIXEL_MAP_R_TO_R_SIZE:
+    return out << "GL_PIXEL_MAP_R_TO_R_SIZE";
+  case GL_PIXEL_MAP_G_TO_G_SIZE:
+    return out << "GL_PIXEL_MAP_G_TO_G_SIZE";
+  case GL_PIXEL_MAP_B_TO_B_SIZE:
+    return out << "GL_PIXEL_MAP_B_TO_B_SIZE";
+  case GL_PIXEL_MAP_A_TO_A_SIZE:
+    return out << "GL_PIXEL_MAP_A_TO_A_SIZE";
+  case GL_PIXEL_MAP_S_TO_S:
+    return out << "GL_PIXEL_MAP_S_TO_S";
+  case GL_PIXEL_MAP_I_TO_I:
+    return out << "GL_PIXEL_MAP_I_TO_I";
+  case GL_PIXEL_MAP_I_TO_R:
+    return out << "GL_PIXEL_MAP_I_TO_R";
+  case GL_PIXEL_MAP_I_TO_G:
+    return out << "GL_PIXEL_MAP_I_TO_G";
+  case GL_PIXEL_MAP_I_TO_B:
+    return out << "GL_PIXEL_MAP_I_TO_B";
+  case GL_PIXEL_MAP_I_TO_A:
+    return out << "GL_PIXEL_MAP_I_TO_A";
+  case GL_PIXEL_MAP_R_TO_R:
+    return out << "GL_PIXEL_MAP_R_TO_R";
+  case GL_PIXEL_MAP_G_TO_G:
+    return out << "GL_PIXEL_MAP_G_TO_G";
+  case GL_PIXEL_MAP_B_TO_B:
+    return out << "GL_PIXEL_MAP_B_TO_B";
+  case GL_PIXEL_MAP_A_TO_A:
+    return out << "GL_PIXEL_MAP_A_TO_A";
+  case GL_PACK_ALIGNMENT:
+    return out << "GL_PACK_ALIGNMENT";
+  case GL_PACK_LSB_FIRST:
+    return out << "GL_PACK_LSB_FIRST";
+  case GL_PACK_ROW_LENGTH:
+    return out << "GL_PACK_ROW_LENGTH";
+  case GL_PACK_SKIP_PIXELS:
+    return out << "GL_PACK_SKIP_PIXELS";
+  case GL_PACK_SKIP_ROWS:
+    return out << "GL_PACK_SKIP_ROWS";
+  case GL_PACK_SWAP_BYTES:
+    return out << "GL_PACK_SWAP_BYTES";
+  case GL_UNPACK_ALIGNMENT:
+    return out << "GL_UNPACK_ALIGNMENT";
+  case GL_UNPACK_LSB_FIRST:
+    return out << "GL_UNPACK_LSB_FIRST";
+  case GL_UNPACK_ROW_LENGTH:
+    return out << "GL_UNPACK_ROW_LENGTH";
+  case GL_UNPACK_SKIP_PIXELS:
+    return out << "GL_UNPACK_SKIP_PIXELS";
+  case GL_UNPACK_SKIP_ROWS:
+    return out << "GL_UNPACK_SKIP_ROWS";
+  case GL_UNPACK_SWAP_BYTES:
+    return out << "GL_UNPACK_SWAP_BYTES";
+  case GL_ZOOM_X:
+    return out << "GL_ZOOM_X";
+  case GL_ZOOM_Y:
+    return out << "GL_ZOOM_Y";
+
+    /* Texture mapping */
+  case GL_TEXTURE_ENV:
+    return out << "GL_TEXTURE_ENV";
+  case GL_TEXTURE_ENV_MODE:
+    return out << "GL_TEXTURE_ENV_MODE";
+  case GL_TEXTURE_1D:
+    return out << "GL_TEXTURE_1D";
+  case GL_TEXTURE_2D:
+    return out << "GL_TEXTURE_2D";
+  case GL_TEXTURE_WRAP_S:
+    return out << "GL_TEXTURE_WRAP_S";
+  case GL_TEXTURE_WRAP_T:
+    return out << "GL_TEXTURE_WRAP_T";
+  case GL_TEXTURE_MAG_FILTER:
+    return out << "GL_TEXTURE_MAG_FILTER";
+  case GL_TEXTURE_MIN_FILTER:
+    return out << "GL_TEXTURE_MIN_FILTER";
+  case GL_TEXTURE_ENV_COLOR:
+    return out << "GL_TEXTURE_ENV_COLOR";
+  case GL_TEXTURE_GEN_S:
+    return out << "GL_TEXTURE_GEN_S";
+  case GL_TEXTURE_GEN_T:
+    return out << "GL_TEXTURE_GEN_T";
+  case GL_TEXTURE_GEN_MODE:
+    return out << "GL_TEXTURE_GEN_MODE";
+  case GL_TEXTURE_BORDER_COLOR:
+    return out << "GL_TEXTURE_BORDER_COLOR";
+  case GL_TEXTURE_WIDTH:
+    return out << "GL_TEXTURE_WIDTH";
+  case GL_TEXTURE_HEIGHT:
+    return out << "GL_TEXTURE_HEIGHT";
+  case GL_TEXTURE_BORDER:
+    return out << "GL_TEXTURE_BORDER";
+  case GL_TEXTURE_COMPONENTS:
+    return out << "GL_TEXTURE_COMPONENTS";
+  case GL_TEXTURE_RED_SIZE:
+    return out << "GL_TEXTURE_RED_SIZE";
+  case GL_TEXTURE_GREEN_SIZE:
+    return out << "GL_TEXTURE_GREEN_SIZE";
+  case GL_TEXTURE_BLUE_SIZE:
+    return out << "GL_TEXTURE_BLUE_SIZE";
+  case GL_TEXTURE_ALPHA_SIZE:
+    return out << "GL_TEXTURE_ALPHA_SIZE";
+  case GL_TEXTURE_LUMINANCE_SIZE:
+    return out << "GL_TEXTURE_LUMINANCE_SIZE";
+  case GL_TEXTURE_INTENSITY_SIZE:
+    return out << "GL_TEXTURE_INTENSITY_SIZE";
+  case GL_NEAREST_MIPMAP_NEAREST:
+    return out << "GL_NEAREST_MIPMAP_NEAREST";
+  case GL_NEAREST_MIPMAP_LINEAR:
+    return out << "GL_NEAREST_MIPMAP_LINEAR";
+  case GL_LINEAR_MIPMAP_NEAREST:
+    return out << "GL_LINEAR_MIPMAP_NEAREST";
+  case GL_LINEAR_MIPMAP_LINEAR:
+    return out << "GL_LINEAR_MIPMAP_LINEAR";
+  case GL_OBJECT_LINEAR:
+    return out << "GL_OBJECT_LINEAR";
+  case GL_OBJECT_PLANE:
+    return out << "GL_OBJECT_PLANE";
+  case GL_EYE_LINEAR:
+    return out << "GL_EYE_LINEAR";
+  case GL_EYE_PLANE:
+    return out << "GL_EYE_PLANE";
+  case GL_SPHERE_MAP:
+    return out << "GL_SPHERE_MAP";
+  case GL_DECAL:
+    return out << "GL_DECAL";
+  case GL_MODULATE:
+    return out << "GL_MODULATE";
+  case GL_NEAREST:
+    return out << "GL_NEAREST";
+  case GL_REPEAT:
+    return out << "GL_REPEAT";
+  case GL_CLAMP:
+    return out << "GL_CLAMP";
+  case GL_S:
+    return out << "GL_S";
+  case GL_T:
+    return out << "GL_T";
+  case GL_R:
+    return out << "GL_R";
+  case GL_Q:
+    return out << "GL_Q";
+  case GL_TEXTURE_GEN_R:
+    return out << "GL_TEXTURE_GEN_R";
+  case GL_TEXTURE_GEN_Q:
+    return out << "GL_TEXTURE_GEN_Q";
+
+    /* GL 1.1 texturing */
+  case GL_PROXY_TEXTURE_1D:
+    return out << "GL_PROXY_TEXTURE_1D";
+  case GL_PROXY_TEXTURE_2D:
+    return out << "GL_PROXY_TEXTURE_2D";
+  case GL_TEXTURE_PRIORITY:
+    return out << "GL_TEXTURE_PRIORITY";
+  case GL_TEXTURE_RESIDENT:
+    return out << "GL_TEXTURE_RESIDENT";
+  case GL_TEXTURE_BINDING_1D:
+    return out << "GL_TEXTURE_BINDING_1D";
+  case GL_TEXTURE_BINDING_2D:
+    return out << "GL_TEXTURE_BINDING_2D";
+    /*
+      case GL_TEXTURE_INTERNAL_FORMAT:
+      return out << "GL_TEXTURE_INTERNAL_FORMAT";
+    */
+
+    /* GL 1.2 texturing */
+  case GL_PACK_SKIP_IMAGES:
+    return out << "GL_PACK_SKIP_IMAGES";
+  case GL_PACK_IMAGE_HEIGHT:
+    return out << "GL_PACK_IMAGE_HEIGHT";
+  case GL_UNPACK_SKIP_IMAGES:
+    return out << "GL_UNPACK_SKIP_IMAGES";
+  case GL_UNPACK_IMAGE_HEIGHT:
+    return out << "GL_UNPACK_IMAGE_HEIGHT";
+  case GL_TEXTURE_3D:
+    return out << "GL_TEXTURE_3D";
+  case GL_PROXY_TEXTURE_3D:
+    return out << "GL_PROXY_TEXTURE_3D";
+  case GL_TEXTURE_DEPTH:
+    return out << "GL_TEXTURE_DEPTH";
+  case GL_TEXTURE_WRAP_R:
+    return out << "GL_TEXTURE_WRAP_R";
+  case GL_MAX_3D_TEXTURE_SIZE:
+    return out << "GL_MAX_3D_TEXTURE_SIZE";
+#ifdef GL_TEXTURE_BINDING_3D
+  case GL_TEXTURE_BINDING_3D:
+    return out << "GL_TEXTURE_BINDING_3D";
+#endif
+
+    /* Internal texture formats (GL 1.1) */
+  case GL_ALPHA4:
+    return out << "GL_ALPHA4";
+  case GL_ALPHA8:
+    return out << "GL_ALPHA8";
+  case GL_ALPHA12:
+    return out << "GL_ALPHA12";
+  case GL_ALPHA16:
+    return out << "GL_ALPHA16";
+  case GL_LUMINANCE4:
+    return out << "GL_LUMINANCE4";
+  case GL_LUMINANCE8:
+    return out << "GL_LUMINANCE8";
+  case GL_LUMINANCE12:
+    return out << "GL_LUMINANCE12";
+  case GL_LUMINANCE16:
+    return out << "GL_LUMINANCE16";
+  case GL_LUMINANCE4_ALPHA4:
+    return out << "GL_LUMINANCE4_ALPHA4";
+  case GL_LUMINANCE6_ALPHA2:
+    return out << "GL_LUMINANCE6_ALPHA2";
+  case GL_LUMINANCE8_ALPHA8:
+    return out << "GL_LUMINANCE8_ALPHA8";
+  case GL_LUMINANCE12_ALPHA4:
+    return out << "GL_LUMINANCE12_ALPHA4";
+  case GL_LUMINANCE12_ALPHA12:
+    return out << "GL_LUMINANCE12_ALPHA12";
+  case GL_LUMINANCE16_ALPHA16:
+    return out << "GL_LUMINANCE16_ALPHA16";
+  case GL_INTENSITY:
+    return out << "GL_INTENSITY";
+  case GL_INTENSITY4:
+    return out << "GL_INTENSITY4";
+  case GL_INTENSITY8:
+    return out << "GL_INTENSITY8";
+  case GL_INTENSITY12:
+    return out << "GL_INTENSITY12";
+  case GL_INTENSITY16:
+    return out << "GL_INTENSITY16";
+  case GL_R3_G3_B2:
+    return out << "GL_R3_G3_B2";
+  case GL_RGB4:
+    return out << "GL_RGB4";
+  case GL_RGB5:
+    return out << "GL_RGB5";
+  case GL_RGB8:
+    return out << "GL_RGB8";
+  case GL_RGB10:
+    return out << "GL_RGB10";
+  case GL_RGB12:
+    return out << "GL_RGB12";
+  case GL_RGB16:
+    return out << "GL_RGB16";
+  case GL_RGBA2:
+    return out << "GL_RGBA2";
+  case GL_RGBA4:
+    return out << "GL_RGBA4";
+  case GL_RGB5_A1:
+    return out << "GL_RGB5_A1";
+  case GL_RGBA8:
+    return out << "GL_RGBA8";
+  case GL_RGB10_A2:
+    return out << "GL_RGB10_A2";
+  case GL_RGBA12:
+    return out << "GL_RGBA12";
+  case GL_RGBA16:
+    return out << "GL_RGBA16";
+
+    /* Utility */
+  case GL_VENDOR:
+    return out << "GL_VENDOR";
+  case GL_RENDERER:
+    return out << "GL_RENDERER";
+  case GL_VERSION:
+    return out << "GL_VERSION";
+  case GL_EXTENSIONS:
+    return out << "GL_EXTENSIONS";
+
+    /* Errors */
+  case GL_INVALID_VALUE:
+    return out << "GL_INVALID_VALUE";
+  case GL_INVALID_ENUM:
+    return out << "GL_INVALID_ENUM";
+  case GL_INVALID_OPERATION:
+    return out << "GL_INVALID_OPERATION";
+  case GL_STACK_OVERFLOW:
+    return out << "GL_STACK_OVERFLOW";
+  case GL_STACK_UNDERFLOW:
+    return out << "GL_STACK_UNDERFLOW";
+  case GL_OUT_OF_MEMORY:
+    return out << "GL_OUT_OF_MEMORY";
+
+    /* OpenGL 1.2 */
+  case GL_RESCALE_NORMAL:
+    return out << "GL_RESCALE_NORMAL";
+  case GL_CLAMP_TO_EDGE:
+    return out << "GL_CLAMP_TO_EDGE";
+  case GL_MAX_ELEMENTS_VERTICES:
+    return out << "GL_MAX_ELEMENTS_VERTICES";
+  case GL_MAX_ELEMENTS_INDICES:
+    return out << "GL_MAX_ELEMENTS_INDICES";
+  case GL_BGR:
+    return out << "GL_BGR";
+  case GL_BGRA:
+    return out << "GL_BGRA";
+  case GL_UNSIGNED_BYTE_3_3_2:
+    return out << "GL_UNSIGNED_BYTE_3_3_2";
+  case GL_UNSIGNED_BYTE_2_3_3_REV:
+    return out << "GL_UNSIGNED_BYTE_2_3_3_REV";
+  case GL_UNSIGNED_SHORT_5_6_5:
+    return out << "GL_UNSIGNED_SHORT_5_6_5";
+  case GL_UNSIGNED_SHORT_5_6_5_REV:
+    return out << "GL_UNSIGNED_SHORT_5_6_5_REV";
+  case GL_UNSIGNED_SHORT_4_4_4_4:
+    return out << "GL_UNSIGNED_SHORT_4_4_4_4";
+  case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+    return out << "GL_UNSIGNED_SHORT_4_4_4_4_REV";
+  case GL_UNSIGNED_SHORT_5_5_5_1:
+    return out << "GL_UNSIGNED_SHORT_5_5_5_1";
+  case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+    return out << "GL_UNSIGNED_SHORT_1_5_5_5_REV";
+  case GL_UNSIGNED_INT_8_8_8_8:
+    return out << "GL_UNSIGNED_INT_8_8_8_8";
+  case GL_UNSIGNED_INT_8_8_8_8_REV:
+    return out << "GL_UNSIGNED_INT_8_8_8_8_REV";
+  case GL_UNSIGNED_INT_10_10_10_2:
+    return out << "GL_UNSIGNED_INT_10_10_10_2";
+  case GL_UNSIGNED_INT_2_10_10_10_REV:
+    return out << "GL_UNSIGNED_INT_2_10_10_10_REV";
+  case GL_LIGHT_MODEL_COLOR_CONTROL:
+    return out << "GL_LIGHT_MODEL_COLOR_CONTROL";
+  case GL_SINGLE_COLOR:
+    return out << "GL_SINGLE_COLOR";
+  case GL_SEPARATE_SPECULAR_COLOR:
+    return out << "GL_SEPARATE_SPECULAR_COLOR";
+  case GL_TEXTURE_MIN_LOD:
+    return out << "GL_TEXTURE_MIN_LOD";
+  case GL_TEXTURE_MAX_LOD:
+    return out << "GL_TEXTURE_MAX_LOD";
+  case GL_TEXTURE_BASE_LEVEL:
+    return out << "GL_TEXTURE_BASE_LEVEL";
+  case GL_TEXTURE_MAX_LEVEL:
+    return out << "GL_TEXTURE_MAX_LEVEL";
+  }
+
+  return out << (int)v;
+}
+#endif

+ 404 - 0
panda/src/crgsg/crGraphicsStateGuardian.h

@@ -0,0 +1,404 @@
+// Filename: chromium.GraphicsStateGuardian.h
+// Created by:  drose (02Feb99)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://www.panda3d.org/license.txt .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+#ifndef CRGRAPHICSSTATEGUARDIAN_H
+#define CRGRAPHICSSTATEGUARDIAN_H
+
+//#define GSG_VERBOSE
+
+#include "pandabase.h"
+
+#include "graphicsStateGuardian.h"
+#include "geomprimitives.h"
+#include "texture.h"
+#include "pixelBuffer.h"
+#include "displayRegion.h"
+#include "material.h"
+#include "textureApplyProperty.h"
+#include "depthTestProperty.h"
+#include "stencilProperty.h"
+#include "fog.h"
+#include "pt_Light.h"
+#include "depthTestAttrib.h"
+#include "textureApplyAttrib.h"
+#include "pointerToArray.h"
+
+#ifdef WIN32_VC
+// Must include windows.h before gl.h on NT
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#undef WIN32_LEAN_AND_MEAN
+#endif
+
+
+#include <GL/gl.h>
+// Chromium specific
+#ifdef WIN32_VC // [
+#define WINDOWS 1
+#endif //]
+#include "cr_glwrapper.h"
+#include "cr_applications.h"
+#include "cr_spu.h"
+///////#include "cr_glstate.h"
+extern SPUDispatchTable chromium;
+
+
+
+class PlaneNode;
+class Light;
+
+#ifdef GSG_VERBOSE
+ostream &output_cr_enum(ostream &out, GLenum v);
+INLINE ostream &operator << (ostream &out, GLenum v) {
+  return output_cr_enum(out, v);
+}
+#endif
+
+
+////////////////////////////////////////////////////////////////////
+//       Class : CRGraphicsStateGuardian
+// Description : A GraphicsStateGuardian specialized for rendering
+//               into OpenGL contexts.  There should be no GL calls
+//               outside of this object.
+////////////////////////////////////////////////////////////////////
+class EXPCL_PANDACR CRGraphicsStateGuardian : public GraphicsStateGuardian {
+public:
+  CRGraphicsStateGuardian(GraphicsWindow *win);
+  ~CRGraphicsStateGuardian();
+
+  virtual void reset();
+
+  virtual void clear(const RenderBuffer &buffer);
+  virtual void clear(const RenderBuffer &buffer, const DisplayRegion* region);
+
+  virtual void prepare_display_region();
+  virtual bool prepare_lens();
+
+  virtual void render_frame();
+  virtual void render_scene(Node *root, LensNode *projnode);
+  virtual void render_subgraph(RenderTraverser *traverser,
+                               Node *subgraph, LensNode *projnode,
+                               const AllTransitionsWrapper &net_trans);
+  virtual void render_subgraph(RenderTraverser *traverser,
+                               Node *subgraph,
+                               const AllTransitionsWrapper &net_trans);
+
+  virtual void draw_point(GeomPoint *geom, GeomContext *gc);
+  virtual void draw_line(GeomLine *geom, GeomContext *gc);
+  virtual void draw_linestrip(GeomLinestrip *geom, GeomContext *gc);
+  virtual void draw_sprite(GeomSprite *geom, GeomContext *gc);
+  virtual void draw_polygon(GeomPolygon *geom, GeomContext *gc);
+  virtual void draw_quad(GeomQuad *geom, GeomContext *gc);
+  virtual void draw_tri(GeomTri *geom, GeomContext *gc);
+  virtual void draw_tristrip(GeomTristrip *geom, GeomContext *gc);
+  virtual void draw_trifan(GeomTrifan *geom, GeomContext *gc);
+  virtual void draw_sphere(GeomSphere *geom, GeomContext *gc);
+
+  virtual TextureContext *prepare_texture(Texture *tex);
+  virtual void apply_texture(TextureContext *tc);
+  virtual void release_texture(TextureContext *tc);
+
+  virtual GeomNodeContext *prepare_geom_node(GeomNode *node);
+  virtual void draw_geom_node(GeomNode *node, GeomNodeContext *gnc);
+  virtual void release_geom_node(GeomNodeContext *gnc);
+
+  virtual void copy_texture(TextureContext *tc, const DisplayRegion *dr);
+  virtual void copy_texture(TextureContext *tc, const DisplayRegion *dr,
+                            const RenderBuffer &rb);
+  virtual void draw_texture(TextureContext *tc, const DisplayRegion *dr);
+  virtual void draw_texture(TextureContext *tc, const DisplayRegion *dr,
+                            const RenderBuffer &rb);
+
+  virtual void texture_to_pixel_buffer(TextureContext *tc, PixelBuffer *pb);
+  virtual void texture_to_pixel_buffer(TextureContext *tc, PixelBuffer *pb,
+                                       const DisplayRegion *dr);
+
+  virtual void copy_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr);
+  virtual void copy_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr,
+                                 const RenderBuffer &rb);
+  virtual void draw_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr,
+                                 const NodeTransitions& na=NodeTransitions());
+  virtual void draw_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr,
+                                 const RenderBuffer &rb,
+                                 const NodeTransitions& na=NodeTransitions());
+
+  virtual void apply_material(const Material *material);
+  virtual void apply_fog(Fog *fog);
+
+  virtual void apply_light(PointLight* light);
+  virtual void apply_light(DirectionalLight* light);
+  virtual void apply_light(Spotlight* light);
+  virtual void apply_light(AmbientLight* light);
+
+  virtual void issue_transform(const TransformTransition *attrib);
+  virtual void issue_color_transform(const ColorMatrixTransition *attrib);
+  virtual void issue_alpha_transform(const AlphaTransformTransition *attrib);
+  virtual void issue_tex_matrix(const TexMatrixTransition *attrib);
+  virtual void issue_color(const ColorTransition *attrib);
+  virtual void issue_texture(const TextureTransition *attrib);
+  virtual void issue_light(const LightTransition *attrib);
+  virtual void issue_material(const MaterialTransition *attrib);
+  virtual void issue_render_mode(const RenderModeTransition *attrib);
+  virtual void issue_color_blend(const ColorBlendTransition *attrib);
+  virtual void issue_texture_apply(const TextureApplyTransition *attrib);
+  virtual void issue_color_mask(const ColorMaskTransition *attrib);
+  virtual void issue_depth_test(const DepthTestTransition *attrib);
+  virtual void issue_depth_write(const DepthWriteTransition *attrib);
+  virtual void issue_tex_gen(const TexGenTransition *attrib);
+  virtual void issue_cull_face(const CullFaceTransition *attrib);
+  virtual void issue_stencil(const StencilTransition *attrib);
+  virtual void issue_clip_plane(const ClipPlaneTransition *attrib);
+  virtual void issue_transparency(const TransparencyTransition *attrib);
+  virtual void issue_fog(const FogTransition *attrib);
+  virtual void issue_linesmooth(const LinesmoothTransition *attrib);
+  virtual void issue_point_shape(const PointShapeTransition *attrib);
+  virtual void issue_polygon_offset(const PolygonOffsetTransition *attrib);
+
+  virtual void issue_transform(const TransformState *transform);
+  virtual void issue_texture(const TextureAttrib *attrib);
+  virtual void issue_texture_apply(const TextureApplyAttrib *attrib);
+  virtual void issue_cull_face(const CullFaceAttrib *attrib);
+  virtual void issue_transparency(const TransparencyAttrib *attrib);
+  virtual void issue_color_write(const ColorWriteAttrib *attrib);
+  virtual void issue_depth_test(const DepthTestAttrib *attrib);
+  virtual void issue_depth_write(const DepthWriteAttrib *attrib);
+
+  virtual bool wants_normals(void) const;
+  virtual bool wants_texcoords(void) const;
+
+  virtual void begin_decal(GeomNode *base_geom, AllTransitionsWrapper &attrib);
+  virtual void end_decal(GeomNode *base_geom);
+
+  virtual CoordinateSystem get_internal_coordinate_system() const;
+  virtual float compute_distance_to(const LPoint3f &point) const;
+
+  void print_gfx_visual();
+
+  //For those interested in what the guardian thinks is the current
+  //enabled/disable GL State compared to what GL says it is
+  void dump_state(void);
+
+  //Methods for extracting the current color and alpha transformations
+  INLINE const LMatrix4f &get_current_color_mat() const;
+  INLINE const float &get_current_alpha_offset() const;
+  INLINE const float &get_current_alpha_scale() const;
+
+  void issue_transformed_color(const Colorf &color) const;
+
+protected:
+  void free_pointers();
+  virtual PT(SavedFrameBuffer) save_frame_buffer(const RenderBuffer &buffer,
+                                                 CPT(DisplayRegion) dr);
+  virtual void restore_frame_buffer(SavedFrameBuffer *frame_buffer);
+
+  INLINE void activate();
+
+  INLINE void call_glClearColor(GLclampf red, GLclampf green, GLclampf blue,
+                                GLclampf alpha);
+  INLINE void call_glClearDepth(GLclampd depth);
+  INLINE void call_glClearStencil(GLint s);
+  INLINE void call_glClearAccum(GLclampf red, GLclampf green, GLclampf blue,
+                                GLclampf alpha);
+  INLINE void call_glDrawBuffer(GLenum mode);
+  INLINE void call_glReadBuffer(GLenum mode);
+  INLINE void call_glShadeModel(GLenum mode);
+  INLINE void call_glBlendFunc(GLenum sfunc, GLenum dfunc);
+  INLINE void call_glCullFace(GLenum mode);
+  INLINE void call_glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
+  INLINE void call_glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
+  INLINE void call_glLightModelAmbient(const Colorf& color);
+  INLINE void call_glLightModelLocal(GLboolean local);
+  INLINE void call_glLightModelTwoSide(GLboolean twoside);
+  INLINE void call_glStencilFunc(GLenum func,GLint refval,GLuint mask);
+  INLINE void call_glStencilOp(GLenum fail,GLenum zfail,GLenum pass);
+  INLINE void call_glClipPlane(GLenum plane, const double equation[4]);
+  INLINE void call_glLineWidth(GLfloat width);
+  INLINE void call_glPointSize(GLfloat size);
+  INLINE void call_glFogMode(GLint mode);
+  INLINE void call_glFogStart(GLfloat start);
+  INLINE void call_glFogEnd(GLfloat end);
+  INLINE void call_glFogDensity(GLfloat density);
+  INLINE void call_glFogColor(const Colorf &color);
+  INLINE void call_glAlphaFunc(GLenum func, GLclampf ref);
+  INLINE void call_glPolygonMode(GLenum mode);
+
+  INLINE void set_pack_alignment(GLint alignment);
+  INLINE void set_unpack_alignment(GLint alignment);
+
+  INLINE void enable_multisample(bool val);
+  INLINE void enable_line_smooth(bool val);
+  INLINE void enable_point_smooth(bool val);
+  INLINE void enable_lighting(bool val);
+  INLINE void enable_light(int light, bool val);
+  INLINE void enable_texturing(bool val);
+  INLINE void enable_scissor(bool val);
+  INLINE void enable_dither(bool val);
+  INLINE void enable_stencil_test(bool val);
+  INLINE void enable_clip_plane(int clip_plane, bool val);
+  INLINE void enable_multisample_alpha_one(bool val);
+  INLINE void enable_multisample_alpha_mask(bool val);
+  INLINE void enable_blend(bool val);
+  INLINE void enable_depth_test(bool val);
+  INLINE void enable_fog(bool val);
+  INLINE void enable_alpha_test(bool val);
+  INLINE void enable_polygon_offset(bool val);
+
+  INLINE GLenum get_light_id(int index) const;
+  INLINE GLenum get_clip_plane_id(int index) const;
+
+  INLINE void issue_scene_graph_color();
+
+  void set_draw_buffer(const RenderBuffer &rb);
+  void set_read_buffer(const RenderBuffer &rb);
+
+  void bind_texture(TextureContext *tc);
+  void specify_texture(Texture *tex);
+  bool apply_texture_immediate(Texture *tex);
+
+  GLenum get_texture_wrap_mode(Texture::WrapMode wm);
+  GLenum get_texture_filter_type(Texture::FilterType ft);
+  GLenum get_image_type(PixelBuffer::Type type);
+  GLenum get_external_image_format(PixelBuffer::Format format);
+  GLenum get_internal_image_format(PixelBuffer::Format format);
+  GLint get_texture_apply_mode_type( TextureApplyProperty::Mode am ) const;
+  GLint get_texture_apply_mode_type(TextureApplyAttrib::Mode am) const;
+  GLenum get_depth_func_type(DepthTestProperty::Mode m) const;
+  GLenum get_depth_func_type(DepthTestAttrib::Mode m) const;
+  GLenum get_stencil_func_type(StencilProperty::Mode m) const;
+  GLenum get_stencil_action_type(StencilProperty::Action a) const;
+  GLenum get_fog_mode_type(Fog::Mode m) const;
+
+#ifndef NDEBUG
+  void build_phony_mipmaps(Texture *tex);
+  void build_phony_mipmap_level(int level, int xsize, int ysize);
+  void save_mipmap_images(Texture *tex);
+#endif
+
+  GLclampf _clear_color_red, _clear_color_green, _clear_color_blue,
+    _clear_color_alpha;
+  GLclampd _clear_depth;
+  GLint _clear_stencil;
+  GLclampf _clear_accum_red, _clear_accum_green, _clear_accum_blue,
+    _clear_accum_alpha;
+  GLenum _draw_buffer_mode;
+  GLenum _read_buffer_mode;
+  GLenum _shade_model_mode;
+  GLint _scissor_x;
+  GLint _scissor_y;
+  GLsizei _scissor_width;
+  GLsizei _scissor_height;
+  GLint _viewport_x;
+  GLint _viewport_y;
+  GLsizei _viewport_width;
+  GLsizei _viewport_height;
+  GLboolean _lmodel_local;
+  GLboolean _lmodel_twoside;
+  Colorf _lmodel_ambient;
+  Colorf _material_ambient;
+  Colorf _material_diffuse;
+  Colorf _material_specular;
+  float _material_shininess;
+  Colorf _material_emission;
+  GLenum _stencil_func;
+  GLenum _stencil_op;
+  GLfloat _line_width;
+  GLfloat _point_size;
+  GLenum _blend_source_func;
+  GLenum _blend_dest_func;
+  GLboolean _depth_mask;
+  GLint _fog_mode;
+  GLfloat _fog_start;
+  GLfloat _fog_end;
+  GLfloat _fog_density;
+  Colorf _fog_color;
+  GLenum _alpha_func;
+  GLclampf _alpha_func_ref;
+  GLenum _polygon_mode;
+
+  GLint _pack_alignment;
+  GLint _unpack_alignment;
+
+  bool _multisample_enabled;
+  bool _line_smooth_enabled;
+  bool _point_smooth_enabled;
+  bool _scissor_enabled;
+  bool _lighting_enabled;
+  bool _lighting_enabled_this_frame;
+  bool _texturing_enabled;
+  bool _dither_enabled;
+  bool _stencil_test_enabled;
+  bool _multisample_alpha_one_enabled;
+  bool _multisample_alpha_mask_enabled;
+  bool _blend_enabled;
+  bool _depth_test_enabled;
+  bool _fog_enabled;
+  bool _dithering_enabled;
+  bool _alpha_test_enabled;
+  bool _polygon_offset_enabled;
+  int _decal_level;
+
+  class LightInfo {
+  public:
+    INLINE LightInfo();
+    PT_Light _light;
+    bool _enabled;
+    bool _next_enabled;
+  };
+
+  int _max_lights;
+  LightInfo *_light_info;          // LightInfo[_max_lights]
+  int _cur_light_id;
+
+  LMatrix4f _current_projection_mat;
+  int _projection_mat_stack_count;
+
+  int _max_clip_planes;
+  PTA(PlaneNode *)_available_clip_plane_ids;  // pPlaneNode[_max_clip_planes]
+  bool *_clip_plane_enabled;              // bool[_max_clip_planes]
+  bool *_cur_clip_plane_enabled;          // bool[_max_clip_planes]
+  int _cur_clip_plane_id;
+
+  CPT(DisplayRegion) _actual_display_region;
+
+  int _pass_number;
+
+public:
+  static GraphicsStateGuardian *
+      make_GlGraphicsStateGuardian(const FactoryParams &params);
+
+  static TypeHandle get_class_type(void);
+  static void init_type(void);
+  virtual TypeHandle get_type(void) const;
+  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
+
+  static PStatCollector _vertices_display_list_pcollector;
+
+private:
+  static TypeHandle _type_handle;
+};
+
+#ifdef DO_PSTATS
+#define DO_PSTATS_STUFF(XX) XX;
+#else
+#define DO_PSTATS_STUFF(XX)
+#endif
+
+#include "crGraphicsStateGuardian.I"
+
+#endif
+

+ 39 - 0
panda/src/crgsg/crSavedFrameBuffer.I

@@ -0,0 +1,39 @@
+// Filename: chromium.SavedFrameBuffer.I
+// Created by:  drose (06Oct99)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://www.panda3d.org/license.txt .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRSavedFrameBuffer::Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE CRSavedFrameBuffer::
+CRSavedFrameBuffer(const RenderBuffer &buffer, CPT(DisplayRegion) dr) :
+  SavedFrameBuffer(buffer, dr)
+{
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRSavedFrameBuffer::Destructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE CRSavedFrameBuffer::
+~CRSavedFrameBuffer() {
+}
+

+ 21 - 0
panda/src/crgsg/crSavedFrameBuffer.cxx

@@ -0,0 +1,21 @@
+// Filename: chromium.SavedFrameBuffer.cxx
+// Created by:  drose (06Oct99)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://www.panda3d.org/license.txt .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+#include "crSavedFrameBuffer.h"
+
+TypeHandle CRSavedFrameBuffer::_type_handle;

+ 64 - 0
panda/src/crgsg/crSavedFrameBuffer.h

@@ -0,0 +1,64 @@
+// Filename: chromium.SavedFrameBuffer.h
+// Created by:  drose (06Oct99)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://www.panda3d.org/license.txt .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+#ifndef CRSAVEDFRAMEBUFFER_H
+#define CRSAVEDFRAMEBUFFER_H
+
+#include <pandabase.h>
+
+#include <savedFrameBuffer.h>
+#include <texture.h>
+#include <textureContext.h>
+#include <pixelBuffer.h>
+
+
+////////////////////////////////////////////////////////////////////
+//       Class : CRSavedFrameBuffer
+// Description :
+////////////////////////////////////////////////////////////////////
+class EXPCL_PANDACR CRSavedFrameBuffer : public SavedFrameBuffer {
+public:
+  INLINE CRSavedFrameBuffer(const RenderBuffer &buffer,
+                            CPT(DisplayRegion) dr);
+  INLINE ~CRSavedFrameBuffer();
+
+  PT(Texture) _back_rgba;
+  PT(PixelBuffer) _depth;
+
+public:
+  static TypeHandle get_class_type() {
+    return _type_handle;
+  }
+  static void init_type() {
+    SavedFrameBuffer::init_type();
+    register_type(_type_handle, "CRSavedFrameBuffer",
+                  SavedFrameBuffer::get_class_type());
+  }
+  virtual TypeHandle get_type() const {
+    return get_class_type();
+  }
+  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
+
+private:
+  static TypeHandle _type_handle;
+};
+
+#include "crSavedFrameBuffer.I"
+
+#endif
+

+ 31 - 0
panda/src/crgsg/crTextureContext.I

@@ -0,0 +1,31 @@
+// Filename: chromium.TextureContext.I
+// Created by:  drose (07Oct99)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://www.panda3d.org/license.txt .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: CRTextureContext::Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE CRTextureContext::
+CRTextureContext(Texture *tex) :
+  TextureContext(tex)
+{
+  _index = 0;
+  _priority = 0.5; // For keeping resident in texture memory
+}

+ 21 - 0
panda/src/crgsg/crTextureContext.cxx

@@ -0,0 +1,21 @@
+// Filename: chromium.TextureContext.cxx
+// Created by:  drose (07Oct99)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://www.panda3d.org/license.txt .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+#include "crTextureContext.h"
+
+TypeHandle CRTextureContext::_type_handle;

+ 80 - 0
panda/src/crgsg/crTextureContext.h

@@ -0,0 +1,80 @@
+// Filename: chromium.TextureContext.h
+// Created by:  drose (07Oct99)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://www.panda3d.org/license.txt .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+#ifndef CRTEXTURECONTEXT_H
+#define CRTEXTURECONTEXT_H
+
+#include <pandabase.h>
+
+#ifdef WIN32_VC
+// Must include windows.h before gl.h on NT
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#undef WIN32_LEAN_AND_MEAN
+#endif
+
+
+#include <GL/gl.h>
+// Chromium specific
+#ifdef WIN32_VC // [
+#define WINDOWS 1
+#endif //]
+#include "cr_glwrapper.h"
+#include "cr_applications.h"
+#include "cr_spu.h"
+///////#include "cr_glstate.h"
+extern SPUDispatchTable chromium;
+
+#include <textureContext.h>
+
+////////////////////////////////////////////////////////////////////
+//       Class : CRTextureContext
+// Description :
+////////////////////////////////////////////////////////////////////
+class EXPCL_PANDACR CRTextureContext : public TextureContext {
+public:
+  INLINE CRTextureContext(Texture *tex);
+
+  // This is the GL "name" of the texture object.
+  GLuint _index;
+
+  // This is a GL texture priority.
+  GLfloat _priority;
+
+public:
+  static TypeHandle get_class_type() {
+    return _type_handle;
+  }
+  static void init_type() {
+    TextureContext::init_type();
+    register_type(_type_handle, "CRTextureContext",
+                  TextureContext::get_class_type());
+  }
+  virtual TypeHandle get_type() const {
+    return get_class_type();
+  }
+  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
+
+private:
+  static TypeHandle _type_handle;
+};
+
+#include "crTextureContext.I"
+
+#endif
+

+ 948 - 0
panda/src/crgsg/create_crgsg.py

@@ -0,0 +1,948 @@
+#!python
+
+import re
+
+files=(
+    "config_%(n)sgsg.cxx",
+    "config_%(n)sgsg.h",
+    "%(n)sGeomNodeContext.I",
+    "%(n)sGeomNodeContext.cxx",
+    "%(n)sGeomNodeContext.h",
+    "%(n)sGraphicsStateGuardian.I",
+    "%(n)sGraphicsStateGuardian.cxx",
+    "%(n)sGraphicsStateGuardian.h",
+    "%(n)sSavedFrameBuffer.I",
+    "%(n)sSavedFrameBuffer.cxx",
+    "%(n)sSavedFrameBuffer.h",
+    "%(n)sTextureContext.I",
+    "%(n)sTextureContext.cxx",
+    "%(n)sTextureContext.h",
+    "%(n)sext.h",
+    "%(n)sgsg_composite.cxx",
+    "%(n)sgsg_composite1.cxx",
+    #"Sources.pp",
+)
+
+conversion=(
+    ("\"gl([A-Z])", "\"cr\\1"),
+    ("\\bgl([A-Z])", "chromium.\\1"),
+    ("\\bGL([A-TV-Z])", "CR\\1"),
+    ("glgsg", "crgsg"),
+    ("gl_", "cr_"),
+    ("gl-", "cr-"),
+    #("GL_", "CR_"),
+    ("PANDAGL", "PANDACR"),
+    ("#include <GL/gl.h>", """
+#include <GL/gl.h>
+// Chromium specific
+#ifdef WIN32_VC // [
+#define WINDOWS 1
+#endif //]
+#include "cr_glwrapper.h"
+#include "cr_applications.h"
+#include "cr_spu.h"
+///////#include "cr_glstate.h"
+extern SPUDispatchTable chromium;
+"""),
+    ("(TypeHandle CRGraphicsStateGuardian::_type_handle;)", "\\1\nSPUDispatchTable chromium;"),
+)
+
+for fn in files:
+    destPath=fn%({"n":"cr"})
+    print destPath
+    # Read the file:
+    f=open("../glgsg/"+(fn)%({"n":"gl"}), "rb")
+    text=f.read()
+    f.close()
+    
+    # Convert the text:
+    for i in conversion:
+        text=re.sub(i[0], i[1], text)
+    
+    # Write the file:
+    dest=open(destPath, "wb")
+    dest.write(text)
+    dest.close()
+
+
+
+
+
+"""
+    ("\\bglAccum", "chromium.Accum"),
+    ("\\bglActiveTextureARB", "chromium.ActiveTextureARB"),
+    ("\\bglAlphaFunc", "chromium.AlphaFunc"),
+    ("\\bglAreTexturesResident", "chromium.AreTexturesResident"),
+    ("\\bglArrayElement", "chromium.ArrayElement"),
+    ("\\bglBarrierCreate", "chromium.BarrierCreate"),
+    ("\\bglBarrierDestroy", "chromium.BarrierDestroy"),
+    ("\\bglBarrierExec", "chromium.BarrierExec"),
+    ("\\bglBegin", "chromium.Begin"),
+    ("\\bglBindTexture", "chromium.BindTexture"),
+    ("\\bglBitmap", "chromium.Bitmap"),
+    ("\\bglBlendColorEXT", "chromium.BlendColorEXT"),
+    ("\\bglBlendEquationEXT", "chromium.BlendEquationEXT"),
+    ("\\bglBlendFunc", "chromium.BlendFunc"),
+    ("\\bglBoundsInfo", "chromium.BoundsInfo"),
+    ("\\bglCallList", "chromium.CallList"),
+    ("\\bglCallLists", "chromium.CallLists"),
+    ("\\bglChromiumParameterfCR", "chromium.ChromiumParameterfCR"),
+    ("\\bglChromiumParameteriCR", "chromium.ChromiumParameteriCR"),
+    ("\\bglChromiumParametervCR", "chromium.ChromiumParametervCR"),
+    ("\\bglClear", "chromium.Clear"),
+    ("\\bglClearAccum", "chromium.ClearAccum"),
+    ("\\bglClearColor", "chromium.ClearColor"),
+    ("\\bglClearDepth", "chromium.ClearDepth"),
+    ("\\bglClearIndex", "chromium.ClearIndex"),
+    ("\\bglClearStencil", "chromium.ClearStencil"),
+    ("\\bglClientActiveTextureARB", "chromium.ClientActiveTextureARB"),
+    ("\\bglClipPlane", "chromium.ClipPlane"),
+    ("\\bglColor3b", "chromium.Color3b"),
+    ("\\bglColor3bv", "chromium.Color3bv"),
+    ("\\bglColor3d", "chromium.Color3d"),
+    ("\\bglColor3dv", "chromium.Color3dv"),
+    ("\\bglColor3f", "chromium.Color3f"),
+    ("\\bglColor3fv", "chromium.Color3fv"),
+    ("\\bglColor3i", "chromium.Color3i"),
+    ("\\bglColor3iv", "chromium.Color3iv"),
+    ("\\bglColor3s", "chromium.Color3s"),
+    ("\\bglColor3sv", "chromium.Color3sv"),
+    ("\\bglColor3ub", "chromium.Color3ub"),
+    ("\\bglColor3ubv", "chromium.Color3ubv"),
+    ("\\bglColor3ui", "chromium.Color3ui"),
+    ("\\bglColor3uiv", "chromium.Color3uiv"),
+    ("\\bglColor3us", "chromium.Color3us"),
+    ("\\bglColor3usv", "chromium.Color3usv"),
+    ("\\bglColor4b", "chromium.Color4b"),
+    ("\\bglColor4bv", "chromium.Color4bv"),
+    ("\\bglColor4d", "chromium.Color4d"),
+    ("\\bglColor4dv", "chromium.Color4dv"),
+    ("\\bglColor4f", "chromium.Color4f"),
+    ("\\bglColor4fv", "chromium.Color4fv"),
+    ("\\bglColor4i", "chromium.Color4i"),
+    ("\\bglColor4iv", "chromium.Color4iv"),
+    ("\\bglColor4s", "chromium.Color4s"),
+    ("\\bglColor4sv", "chromium.Color4sv"),
+    ("\\bglColor4ub", "chromium.Color4ub"),
+    ("\\bglColor4ubv", "chromium.Color4ubv"),
+    ("\\bglColor4ui", "chromium.Color4ui"),
+    ("\\bglColor4uiv", "chromium.Color4uiv"),
+    ("\\bglColor4us", "chromium.Color4us"),
+    ("\\bglColor4usv", "chromium.Color4usv"),
+    ("\\bglColorMask", "chromium.ColorMask"),
+    ("\\bglColorMaterial", "chromium.ColorMaterial"),
+    ("\\bglColorPointer", "chromium.ColorPointer"),
+    ("\\bglCombinerInputNV", "chromium.CombinerInputNV"),
+    ("\\bglCombinerOutputNV", "chromium.CombinerOutputNV"),
+    ("\\bglCombinerParameterfNV", "chromium.CombinerParameterfNV"),
+    ("\\bglCombinerParameterfvNV", "chromium.CombinerParameterfvNV"),
+    ("\\bglCombinerParameteriNV", "chromium.CombinerParameteriNV"),
+    ("\\bglCombinerParameterivNV", "chromium.CombinerParameterivNV"),
+    ("\\bglCombinerStageParameterfvNV", "chromium.CombinerStageParameterfvNV"),
+    ("\\bglCopyPixels", "chromium.CopyPixels"),
+    ("\\bglCopyTexImage1D", "chromium.CopyTexImage1D"),
+    ("\\bglCopyTexImage2D", "chromium.CopyTexImage2D"),
+    ("\\bglCopyTexSubImage1D", "chromium.CopyTexSubImage1D"),
+    ("\\bglCopyTexSubImage2D", "chromium.CopyTexSubImage2D"),
+    ("\\bglCreateContext", "chromium.CreateContext"),
+    ("\\bglCullFace", "chromium.CullFace"),
+    ("\\bglDeleteLists", "chromium.DeleteLists"),
+    ("\\bglDeleteTextures", "chromium.DeleteTextures"),
+    ("\\bglDepthFunc", "chromium.DepthFunc"),
+    ("\\bglDepthMask", "chromium.DepthMask"),
+    ("\\bglDepthRange", "chromium.DepthRange"),
+    ("\\bglDestroyContext", "chromium.DestroyContext"),
+    ("\\bglDisable", "chromium.Disable"),
+    ("\\bglDisableClientState", "chromium.DisableClientState"),
+    ("\\bglDrawArrays", "chromium.DrawArrays"),
+    ("\\bglDrawBuffer", "chromium.DrawBuffer"),
+    ("\\bglDrawElements", "chromium.DrawElements"),
+    ("\\bglDrawPixels", "chromium.DrawPixels"),
+    ("\\bglDrawRangeElements", "chromium.DrawRangeElements"),
+    ("\\bglEdgeFlag", "chromium.EdgeFlag"),
+    ("\\bglEdgeFlagPointer", "chromium.EdgeFlagPointer"),
+    ("\\bglEdgeFlagv", "chromium.EdgeFlagv"),
+    ("\\bglEnable", "chromium.Enable"),
+    ("\\bglEnableClientState", "chromium.EnableClientState"),
+    ("\\bglEnd", "chromium.End"),
+    ("\\bglEndList", "chromium.EndList"),
+    ("\\bglEvalCoord1d", "chromium.EvalCoord1d"),
+    ("\\bglEvalCoord1dv", "chromium.EvalCoord1dv"),
+    ("\\bglEvalCoord1f", "chromium.EvalCoord1f"),
+    ("\\bglEvalCoord1fv", "chromium.EvalCoord1fv"),
+    ("\\bglEvalCoord2d", "chromium.EvalCoord2d"),
+    ("\\bglEvalCoord2dv", "chromium.EvalCoord2dv"),
+    ("\\bglEvalCoord2f", "chromium.EvalCoord2f"),
+    ("\\bglEvalCoord2fv", "chromium.EvalCoord2fv"),
+    ("\\bglEvalMesh1", "chromium.EvalMesh1"),
+    ("\\bglEvalMesh2", "chromium.EvalMesh2"),
+    ("\\bglEvalPoint1", "chromium.EvalPoint1"),
+    ("\\bglEvalPoint2", "chromium.EvalPoint2"),
+    ("\\bglFeedbackBuffer", "chromium.FeedbackBuffer"),
+    ("\\bglFinalCombinerInputNV", "chromium.FinalCombinerInputNV"),
+    ("\\bglFinish", "chromium.Finish"),
+    ("\\bglFlush", "chromium.Flush"),
+    ("\\bglFogf", "chromium.Fogf"),
+    ("\\bglFogfv", "chromium.Fogfv"),
+    ("\\bglFogi", "chromium.Fogi"),
+    ("\\bglFogiv", "chromium.Fogiv"),
+    ("\\bglFrontFace", "chromium.FrontFace"),
+    ("\\bglFrustum", "chromium.Frustum"),
+    ("\\bglGenLists", "chromium.GenLists"),
+    ("\\bglGenTextures", "chromium.GenTextures"),
+    ("\\bglGetBooleanv", "chromium.GetBooleanv"),
+    ("\\bglGetChromiumParametervCR", "chromium.GetChromiumParametervCR"),
+    ("\\bglGetClipPlane", "chromium.GetClipPlane"),
+    ("\\bglGetCombinerInputParameterfvNV", "chromium.GetCombinerInputParameterfvNV"),
+    ("\\bglGetCombinerInputParameterivNV", "chromium.GetCombinerInputParameterivNV"),
+    ("\\bglGetCombinerOutputParameterfvNV", "chromium.GetCombinerOutputParameterfvNV"),
+    ("\\bglGetCombinerOutputParameterivNV", "chromium.GetCombinerOutputParameterivNV"),
+    ("\\bglGetCombinerStageParameterfvNV", "chromium.GetCombinerStageParameterfvNV"),
+    ("\\bglGetDoublev", "chromium.GetDoublev"),
+    ("\\bglGetError", "chromium.GetError"),
+    ("\\bglGetFinalCombinerInputParameterfvNV", "chromium.GetFinalCombinerInputParameterfvNV"),
+    ("\\bglGetFinalCombinerInputParameterivNV", "chromium.GetFinalCombinerInputParameterivNV"),
+    ("\\bglGetFloatv", "chromium.GetFloatv"),
+    ("\\bglGetIntegerv", "chromium.GetIntegerv"),
+    ("\\bglGetLightfv", "chromium.GetLightfv"),
+    ("\\bglGetLightiv", "chromium.GetLightiv"),
+    ("\\bglGetMapdv", "chromium.GetMapdv"),
+    ("\\bglGetMapfv", "chromium.GetMapfv"),
+    ("\\bglGetMapiv", "chromium.GetMapiv"),
+    ("\\bglGetMaterialfv", "chromium.GetMaterialfv"),
+    ("\\bglGetMaterialiv", "chromium.GetMaterialiv"),
+    ("\\bglGetPixelMapfv", "chromium.GetPixelMapfv"),
+    ("\\bglGetPixelMapuiv", "chromium.GetPixelMapuiv"),
+    ("\\bglGetPixelMapusv", "chromium.GetPixelMapusv"),
+    ("\\bglGetPointerv", "chromium.GetPointerv"),
+    ("\\bglGetPolygonStipple", "chromium.GetPolygonStipple"),
+    ("\\bglGetString", "chromium.GetString"),
+    ("\\bglGetTexEnvfv", "chromium.GetTexEnvfv"),
+    ("\\bglGetTexEnviv", "chromium.GetTexEnviv"),
+    ("\\bglGetTexGendv", "chromium.GetTexGendv"),
+    ("\\bglGetTexGenfv", "chromium.GetTexGenfv"),
+    ("\\bglGetTexGeniv", "chromium.GetTexGeniv"),
+    ("\\bglGetTexImage", "chromium.GetTexImage"),
+    ("\\bglGetTexLevelParameterfv", "chromium.GetTexLevelParameterfv"),
+    ("\\bglGetTexLevelParameteriv", "chromium.GetTexLevelParameteriv"),
+    ("\\bglGetTexParameterfv", "chromium.GetTexParameterfv"),
+    ("\\bglGetTexParameteriv", "chromium.GetTexParameteriv"),
+    ("\\bglHint", "chromium.Hint"),
+    ("\\bglIndexMask", "chromium.IndexMask"),
+    ("\\bglIndexPointer", "chromium.IndexPointer"),
+    ("\\bglIndexd", "chromium.Indexd"),
+    ("\\bglIndexdv", "chromium.Indexdv"),
+    ("\\bglIndexf", "chromium.Indexf"),
+    ("\\bglIndexfv", "chromium.Indexfv"),
+    ("\\bglIndexi", "chromium.Indexi"),
+    ("\\bglIndexiv", "chromium.Indexiv"),
+    ("\\bglIndexs", "chromium.Indexs"),
+    ("\\bglIndexsv", "chromium.Indexsv"),
+    ("\\bglIndexub", "chromium.Indexub"),
+    ("\\bglIndexubv", "chromium.Indexubv"),
+    ("\\bglInitNames", "chromium.InitNames"),
+    ("\\bglInterleavedArrays", "chromium.InterleavedArrays"),
+    ("\\bglIsEnabled", "chromium.IsEnabled"),
+    ("\\bglIsList", "chromium.IsList"),
+    ("\\bglIsTexture", "chromium.IsTexture"),
+    ("\\bglLightModelf", "chromium.LightModelf"),
+    ("\\bglLightModelfv", "chromium.LightModelfv"),
+    ("\\bglLightModeli", "chromium.LightModeli"),
+    ("\\bglLightModeliv", "chromium.LightModeliv"),
+    ("\\bglLightf", "chromium.Lightf"),
+    ("\\bglLightfv", "chromium.Lightfv"),
+    ("\\bglLighti", "chromium.Lighti"),
+    ("\\bglLightiv", "chromium.Lightiv"),
+    ("\\bglLineStipple", "chromium.LineStipple"),
+    ("\\bglLineWidth", "chromium.LineWidth"),
+    ("\\bglListBase", "chromium.ListBase"),
+    ("\\bglLoadIdentity", "chromium.LoadIdentity"),
+    ("\\bglLoadMatrixd", "chromium.LoadMatrixd"),
+    ("\\bglLoadMatrixf", "chromium.LoadMatrixf"),
+    ("\\bglLoadName", "chromium.LoadName"),
+    ("\\bglLogicOp", "chromium.LogicOp"),
+    ("\\bglMakeCurrent", "chromium.MakeCurrent"),
+    ("\\bglMap1d", "chromium.Map1d"),
+    ("\\bglMap1f", "chromium.Map1f"),
+    ("\\bglMap2d", "chromium.Map2d"),
+    ("\\bglMap2f", "chromium.Map2f"),
+    ("\\bglMapGrid1d", "chromium.MapGrid1d"),
+    ("\\bglMapGrid1f", "chromium.MapGrid1f"),
+    ("\\bglMapGrid2d", "chromium.MapGrid2d"),
+    ("\\bglMapGrid2f", "chromium.MapGrid2f"),
+    ("\\bglMaterialf", "chromium.Materialf"),
+    ("\\bglMaterialfv", "chromium.Materialfv"),
+    ("\\bglMateriali", "chromium.Materiali"),
+    ("\\bglMaterialiv", "chromium.Materialiv"),
+    ("\\bglMatrixMode", "chromium.MatrixMode"),
+    ("\\bglMultMatrixd", "chromium.MultMatrixd"),
+    ("\\bglMultMatrixf", "chromium.MultMatrixf"),
+    ("\\bglMultiTexCoord1dARB", "chromium.MultiTexCoord1dARB"),
+    ("\\bglMultiTexCoord1dvARB", "chromium.MultiTexCoord1dvARB"),
+    ("\\bglMultiTexCoord1fARB", "chromium.MultiTexCoord1fARB"),
+    ("\\bglMultiTexCoord1fvARB", "chromium.MultiTexCoord1fvARB"),
+    ("\\bglMultiTexCoord1iARB", "chromium.MultiTexCoord1iARB"),
+    ("\\bglMultiTexCoord1ivARB", "chromium.MultiTexCoord1ivARB"),
+    ("\\bglMultiTexCoord1sARB", "chromium.MultiTexCoord1sARB"),
+    ("\\bglMultiTexCoord1svARB", "chromium.MultiTexCoord1svARB"),
+    ("\\bglMultiTexCoord2dARB", "chromium.MultiTexCoord2dARB"),
+    ("\\bglMultiTexCoord2dvARB", "chromium.MultiTexCoord2dvARB"),
+    ("\\bglMultiTexCoord2fARB", "chromium.MultiTexCoord2fARB"),
+    ("\\bglMultiTexCoord2fvARB", "chromium.MultiTexCoord2fvARB"),
+    ("\\bglMultiTexCoord2iARB", "chromium.MultiTexCoord2iARB"),
+    ("\\bglMultiTexCoord2ivARB", "chromium.MultiTexCoord2ivARB"),
+    ("\\bglMultiTexCoord2sARB", "chromium.MultiTexCoord2sARB"),
+    ("\\bglMultiTexCoord2svARB", "chromium.MultiTexCoord2svARB"),
+    ("\\bglMultiTexCoord3dARB", "chromium.MultiTexCoord3dARB"),
+    ("\\bglMultiTexCoord3dvARB", "chromium.MultiTexCoord3dvARB"),
+    ("\\bglMultiTexCoord3fARB", "chromium.MultiTexCoord3fARB"),
+    ("\\bglMultiTexCoord3fvARB", "chromium.MultiTexCoord3fvARB"),
+    ("\\bglMultiTexCoord3iARB", "chromium.MultiTexCoord3iARB"),
+    ("\\bglMultiTexCoord3ivARB", "chromium.MultiTexCoord3ivARB"),
+    ("\\bglMultiTexCoord3sARB", "chromium.MultiTexCoord3sARB"),
+    ("\\bglMultiTexCoord3svARB", "chromium.MultiTexCoord3svARB"),
+    ("\\bglMultiTexCoord4dARB", "chromium.MultiTexCoord4dARB"),
+    ("\\bglMultiTexCoord4dvARB", "chromium.MultiTexCoord4dvARB"),
+    ("\\bglMultiTexCoord4fARB", "chromium.MultiTexCoord4fARB"),
+    ("\\bglMultiTexCoord4fvARB", "chromium.MultiTexCoord4fvARB"),
+    ("\\bglMultiTexCoord4iARB", "chromium.MultiTexCoord4iARB"),
+    ("\\bglMultiTexCoord4ivARB", "chromium.MultiTexCoord4ivARB"),
+    ("\\bglMultiTexCoord4sARB", "chromium.MultiTexCoord4sARB"),
+    ("\\bglMultiTexCoord4svARB", "chromium.MultiTexCoord4svARB"),
+    ("\\bglNewList", "chromium.NewList"),
+    ("\\bglNormal3b", "chromium.Normal3b"),
+    ("\\bglNormal3bv", "chromium.Normal3bv"),
+    ("\\bglNormal3d", "chromium.Normal3d"),
+    ("\\bglNormal3dv", "chromium.Normal3dv"),
+    ("\\bglNormal3f", "chromium.Normal3f"),
+    ("\\bglNormal3fv", "chromium.Normal3fv"),
+    ("\\bglNormal3i", "chromium.Normal3i"),
+    ("\\bglNormal3iv", "chromium.Normal3iv"),
+    ("\\bglNormal3s", "chromium.Normal3s"),
+    ("\\bglNormal3sv", "chromium.Normal3sv"),
+    ("\\bglNormalPointer", "chromium.NormalPointer"),
+    ("\\bglOrtho", "chromium.Ortho"),
+    ("\\bglPassThrough", "chromium.PassThrough"),
+    ("\\bglPixelMapfv", "chromium.PixelMapfv"),
+    ("\\bglPixelMapuiv", "chromium.PixelMapuiv"),
+    ("\\bglPixelMapusv", "chromium.PixelMapusv"),
+    ("\\bglPixelStoref", "chromium.PixelStoref"),
+    ("\\bglPixelStorei", "chromium.PixelStorei"),
+    ("\\bglPixelTransferf", "chromium.PixelTransferf"),
+    ("\\bglPixelTransferi", "chromium.PixelTransferi"),
+    ("\\bglPixelZoom", "chromium.PixelZoom"),
+    ("\\bglPointSize", "chromium.PointSize"),
+    ("\\bglPolygonMode", "chromium.PolygonMode"),
+    ("\\bglPolygonOffset", "chromium.PolygonOffset"),
+    ("\\bglPolygonStipple", "chromium.PolygonStipple"),
+    ("\\bglPopAttrib", "chromium.PopAttrib"),
+    ("\\bglPopClientAttrib", "chromium.PopClientAttrib"),
+    ("\\bglPopMatrix", "chromium.PopMatrix"),
+    ("\\bglPopName", "chromium.PopName"),
+    ("\\bglPrioritizeTextures", "chromium.PrioritizeTextures"),
+    ("\\bglPushAttrib", "chromium.PushAttrib"),
+    ("\\bglPushClientAttrib", "chromium.PushClientAttrib"),
+    ("\\bglPushMatrix", "chromium.PushMatrix"),
+    ("\\bglPushName", "chromium.PushName"),
+    ("\\bglRasterPos2d", "chromium.RasterPos2d"),
+    ("\\bglRasterPos2dv", "chromium.RasterPos2dv"),
+    ("\\bglRasterPos2f", "chromium.RasterPos2f"),
+    ("\\bglRasterPos2fv", "chromium.RasterPos2fv"),
+    ("\\bglRasterPos2i", "chromium.RasterPos2i"),
+    ("\\bglRasterPos2iv", "chromium.RasterPos2iv"),
+    ("\\bglRasterPos2s", "chromium.RasterPos2s"),
+    ("\\bglRasterPos2sv", "chromium.RasterPos2sv"),
+    ("\\bglRasterPos3d", "chromium.RasterPos3d"),
+    ("\\bglRasterPos3dv", "chromium.RasterPos3dv"),
+    ("\\bglRasterPos3f", "chromium.RasterPos3f"),
+    ("\\bglRasterPos3fv", "chromium.RasterPos3fv"),
+    ("\\bglRasterPos3i", "chromium.RasterPos3i"),
+    ("\\bglRasterPos3iv", "chromium.RasterPos3iv"),
+    ("\\bglRasterPos3s", "chromium.RasterPos3s"),
+    ("\\bglRasterPos3sv", "chromium.RasterPos3sv"),
+    ("\\bglRasterPos4d", "chromium.RasterPos4d"),
+    ("\\bglRasterPos4dv", "chromium.RasterPos4dv"),
+    ("\\bglRasterPos4f", "chromium.RasterPos4f"),
+    ("\\bglRasterPos4fv", "chromium.RasterPos4fv"),
+    ("\\bglRasterPos4i", "chromium.RasterPos4i"),
+    ("\\bglRasterPos4iv", "chromium.RasterPos4iv"),
+    ("\\bglRasterPos4s", "chromium.RasterPos4s"),
+    ("\\bglRasterPos4sv", "chromium.RasterPos4sv"),
+    ("\\bglReadBuffer", "chromium.ReadBuffer"),
+    ("\\bglReadPixels", "chromium.ReadPixels"),
+    ("\\bglRectd", "chromium.Rectd"),
+    ("\\bglRectdv", "chromium.Rectdv"),
+    ("\\bglRectf", "chromium.Rectf"),
+    ("\\bglRectfv", "chromium.Rectfv"),
+    ("\\bglRecti", "chromium.Recti"),
+    ("\\bglRectiv", "chromium.Rectiv"),
+    ("\\bglRects", "chromium.Rects"),
+    ("\\bglRectsv", "chromium.Rectsv"),
+    ("\\bglRenderMode", "chromium.RenderMode"),
+    ("\\bglRotated", "chromium.Rotated"),
+    ("\\bglRotatef", "chromium.Rotatef"),
+    ("\\bglScaled", "chromium.Scaled"),
+    ("\\bglScalef", "chromium.Scalef"),
+    ("\\bglScissor", "chromium.Scissor"),
+    ("\\bglSecondaryColor3bEXT", "chromium.SecondaryColor3bEXT"),
+    ("\\bglSecondaryColor3bvEXT", "chromium.SecondaryColor3bvEXT"),
+    ("\\bglSecondaryColor3dEXT", "chromium.SecondaryColor3dEXT"),
+    ("\\bglSecondaryColor3dvEXT", "chromium.SecondaryColor3dvEXT"),
+    ("\\bglSecondaryColor3fEXT", "chromium.SecondaryColor3fEXT"),
+    ("\\bglSecondaryColor3fvEXT", "chromium.SecondaryColor3fvEXT"),
+    ("\\bglSecondaryColor3iEXT", "chromium.SecondaryColor3iEXT"),
+    ("\\bglSecondaryColor3ivEXT", "chromium.SecondaryColor3ivEXT"),
+    ("\\bglSecondaryColor3sEXT", "chromium.SecondaryColor3sEXT"),
+    ("\\bglSecondaryColor3svEXT", "chromium.SecondaryColor3svEXT"),
+    ("\\bglSecondaryColor3ubEXT", "chromium.SecondaryColor3ubEXT"),
+    ("\\bglSecondaryColor3ubvEXT", "chromium.SecondaryColor3ubvEXT"),
+    ("\\bglSecondaryColor3uiEXT", "chromium.SecondaryColor3uiEXT"),
+    ("\\bglSecondaryColor3uivEXT", "chromium.SecondaryColor3uivEXT"),
+    ("\\bglSecondaryColor3usEXT", "chromium.SecondaryColor3usEXT"),
+    ("\\bglSecondaryColor3usvEXT", "chromium.SecondaryColor3usvEXT"),
+    ("\\bglSecondaryColorPointerEXT", "chromium.SecondaryColorPointerEXT"),
+    ("\\bglSelectBuffer", "chromium.SelectBuffer"),
+    ("\\bglSemaphoreCreate", "chromium.SemaphoreCreate"),
+    ("\\bglSemaphoreDestroy", "chromium.SemaphoreDestroy"),
+    ("\\bglSemaphoreP", "chromium.SemaphoreP"),
+    ("\\bglSemaphoreV", "chromium.SemaphoreV"),
+    ("\\bglShadeModel", "chromium.ShadeModel"),
+    ("\\bglStencilFunc", "chromium.StencilFunc"),
+    ("\\bglStencilMask", "chromium.StencilMask"),
+    ("\\bglStencilOp", "chromium.StencilOp"),
+    ("\\bglSwapBuffers", "chromium.SwapBuffers"),
+    ("\\bglTexCoord1d", "chromium.TexCoord1d"),
+    ("\\bglTexCoord1dv", "chromium.TexCoord1dv"),
+    ("\\bglTexCoord1f", "chromium.TexCoord1f"),
+    ("\\bglTexCoord1fv", "chromium.TexCoord1fv"),
+    ("\\bglTexCoord1i", "chromium.TexCoord1i"),
+    ("\\bglTexCoord1iv", "chromium.TexCoord1iv"),
+    ("\\bglTexCoord1s", "chromium.TexCoord1s"),
+    ("\\bglTexCoord1sv", "chromium.TexCoord1sv"),
+    ("\\bglTexCoord2d", "chromium.TexCoord2d"),
+    ("\\bglTexCoord2dv", "chromium.TexCoord2dv"),
+    ("\\bglTexCoord2f", "chromium.TexCoord2f"),
+    ("\\bglTexCoord2fv", "chromium.TexCoord2fv"),
+    ("\\bglTexCoord2i", "chromium.TexCoord2i"),
+    ("\\bglTexCoord2iv", "chromium.TexCoord2iv"),
+    ("\\bglTexCoord2s", "chromium.TexCoord2s"),
+    ("\\bglTexCoord2sv", "chromium.TexCoord2sv"),
+    ("\\bglTexCoord3d", "chromium.TexCoord3d"),
+    ("\\bglTexCoord3dv", "chromium.TexCoord3dv"),
+    ("\\bglTexCoord3f", "chromium.TexCoord3f"),
+    ("\\bglTexCoord3fv", "chromium.TexCoord3fv"),
+    ("\\bglTexCoord3i", "chromium.TexCoord3i"),
+    ("\\bglTexCoord3iv", "chromium.TexCoord3iv"),
+    ("\\bglTexCoord3s", "chromium.TexCoord3s"),
+    ("\\bglTexCoord3sv", "chromium.TexCoord3sv"),
+    ("\\bglTexCoord4d", "chromium.TexCoord4d"),
+    ("\\bglTexCoord4dv", "chromium.TexCoord4dv"),
+    ("\\bglTexCoord4f", "chromium.TexCoord4f"),
+    ("\\bglTexCoord4fv", "chromium.TexCoord4fv"),
+    ("\\bglTexCoord4i", "chromium.TexCoord4i"),
+    ("\\bglTexCoord4iv", "chromium.TexCoord4iv"),
+    ("\\bglTexCoord4s", "chromium.TexCoord4s"),
+    ("\\bglTexCoord4sv", "chromium.TexCoord4sv"),
+    ("\\bglTexCoordPointer", "chromium.TexCoordPointer"),
+    ("\\bglTexEnvf", "chromium.TexEnvf"),
+    ("\\bglTexEnvfv", "chromium.TexEnvfv"),
+    ("\\bglTexEnvi", "chromium.TexEnvi"),
+    ("\\bglTexEnviv", "chromium.TexEnviv"),
+    ("\\bglTexGend", "chromium.TexGend"),
+    ("\\bglTexGendv", "chromium.TexGendv"),
+    ("\\bglTexGenf", "chromium.TexGenf"),
+    ("\\bglTexGenfv", "chromium.TexGenfv"),
+    ("\\bglTexGeni", "chromium.TexGeni"),
+    ("\\bglTexGeniv", "chromium.TexGeniv"),
+    ("\\bglTexImage1D", "chromium.TexImage1D"),
+    ("\\bglTexImage2D", "chromium.TexImage2D"),
+    ("\\bglTexParameterf", "chromium.TexParameterf"),
+    ("\\bglTexParameterfv", "chromium.TexParameterfv"),
+    ("\\bglTexParameteri", "chromium.TexParameteri"),
+    ("\\bglTexParameteriv", "chromium.TexParameteriv"),
+    ("\\bglTexSubImage1D", "chromium.TexSubImage1D"),
+    ("\\bglTexSubImage2D", "chromium.TexSubImage2D"),
+    ("\\bglTranslated", "chromium.Translated"),
+    ("\\bglTranslatef", "chromium.Translatef"),
+    ("\\bglVertex2d", "chromium.Vertex2d"),
+    ("\\bglVertex2dv", "chromium.Vertex2dv"),
+    ("\\bglVertex2f", "chromium.Vertex2f"),
+    ("\\bglVertex2fv", "chromium.Vertex2fv"),
+    ("\\bglVertex2i", "chromium.Vertex2i"),
+    ("\\bglVertex2iv", "chromium.Vertex2iv"),
+    ("\\bglVertex2s", "chromium.Vertex2s"),
+    ("\\bglVertex2sv", "chromium.Vertex2sv"),
+    ("\\bglVertex3d", "chromium.Vertex3d"),
+    ("\\bglVertex3dv", "chromium.Vertex3dv"),
+    ("\\bglVertex3f", "chromium.Vertex3f"),
+    ("\\bglVertex3fv", "chromium.Vertex3fv"),
+    ("\\bglVertex3i", "chromium.Vertex3i"),
+    ("\\bglVertex3iv", "chromium.Vertex3iv"),
+    ("\\bglVertex3s", "chromium.Vertex3s"),
+    ("\\bglVertex3sv", "chromium.Vertex3sv"),
+    ("\\bglVertex4d", "chromium.Vertex4d"),
+    ("\\bglVertex4dv", "chromium.Vertex4dv"),
+    ("\\bglVertex4f", "chromium.Vertex4f"),
+    ("\\bglVertex4fv", "chromium.Vertex4fv"),
+    ("\\bglVertex4i", "chromium.Vertex4i"),
+    ("\\bglVertex4iv", "chromium.Vertex4iv"),
+    ("\\bglVertex4s", "chromium.Vertex4s"),
+    ("\\bglVertex4sv", "chromium.Vertex4sv"),
+    ("\\bglVertexPointer", "chromium.VertexPointer"),
+    ("\\bglViewport", "chromium.Viewport"),
+    ("\\bglWriteback", "chromium.Writeback"),
+
+
+#define glAccum chromium.Accum
+#define glActiveTextureARB chromium.ActiveTextureARB
+#define glAlphaFunc chromium.AlphaFunc
+#define glAreTexturesResident chromium.AreTexturesResident
+#define glArrayElement chromium.ArrayElement
+#define glBarrierCreate chromium.BarrierCreate
+#define glBarrierDestroy chromium.BarrierDestroy
+#define glBarrierExec chromium.BarrierExec
+#define glBegin chromium.Begin
+#define glBindTexture chromium.BindTexture
+#define glBitmap chromium.Bitmap
+#define glBlendColorEXT chromium.BlendColorEXT
+#define glBlendEquationEXT chromium.BlendEquationEXT
+#define glBlendFunc chromium.BlendFunc
+#define glBoundsInfo chromium.BoundsInfo
+#define glCallList chromium.CallList
+#define glCallLists chromium.CallLists
+#define glChromiumParameterfCR chromium.ChromiumParameterfCR
+#define glChromiumParameteriCR chromium.ChromiumParameteriCR
+#define glChromiumParametervCR chromium.ChromiumParametervCR
+#define glClear chromium.Clear
+#define glClearAccum chromium.ClearAccum
+#define glClearColor chromium.ClearColor
+#define glClearDepth chromium.ClearDepth
+#define glClearIndex chromium.ClearIndex
+#define glClearStencil chromium.ClearStencil
+#define glClientActiveTextureARB chromium.ClientActiveTextureARB
+#define glClipPlane chromium.ClipPlane
+#define glColor3b chromium.Color3b
+#define glColor3bv chromium.Color3bv
+#define glColor3d chromium.Color3d
+#define glColor3dv chromium.Color3dv
+#define glColor3f chromium.Color3f
+#define glColor3fv chromium.Color3fv
+#define glColor3i chromium.Color3i
+#define glColor3iv chromium.Color3iv
+#define glColor3s chromium.Color3s
+#define glColor3sv chromium.Color3sv
+#define glColor3ub chromium.Color3ub
+#define glColor3ubv chromium.Color3ubv
+#define glColor3ui chromium.Color3ui
+#define glColor3uiv chromium.Color3uiv
+#define glColor3us chromium.Color3us
+#define glColor3usv chromium.Color3usv
+#define glColor4b chromium.Color4b
+#define glColor4bv chromium.Color4bv
+#define glColor4d chromium.Color4d
+#define glColor4dv chromium.Color4dv
+#define glColor4f chromium.Color4f
+#define glColor4fv chromium.Color4fv
+#define glColor4i chromium.Color4i
+#define glColor4iv chromium.Color4iv
+#define glColor4s chromium.Color4s
+#define glColor4sv chromium.Color4sv
+#define glColor4ub chromium.Color4ub
+#define glColor4ubv chromium.Color4ubv
+#define glColor4ui chromium.Color4ui
+#define glColor4uiv chromium.Color4uiv
+#define glColor4us chromium.Color4us
+#define glColor4usv chromium.Color4usv
+#define glColorMask chromium.ColorMask
+#define glColorMaterial chromium.ColorMaterial
+#define glColorPointer chromium.ColorPointer
+#define glCombinerInputNV chromium.CombinerInputNV
+#define glCombinerOutputNV chromium.CombinerOutputNV
+#define glCombinerParameterfNV chromium.CombinerParameterfNV
+#define glCombinerParameterfvNV chromium.CombinerParameterfvNV
+#define glCombinerParameteriNV chromium.CombinerParameteriNV
+#define glCombinerParameterivNV chromium.CombinerParameterivNV
+#define glCombinerStageParameterfvNV chromium.CombinerStageParameterfvNV
+#define glCopyPixels chromium.CopyPixels
+#define glCopyTexImage1D chromium.CopyTexImage1D
+#define glCopyTexImage2D chromium.CopyTexImage2D
+#define glCopyTexSubImage1D chromium.CopyTexSubImage1D
+#define glCopyTexSubImage2D chromium.CopyTexSubImage2D
+#define glCreateContext chromium.CreateContext
+#define glCullFace chromium.CullFace
+#define glDeleteLists chromium.DeleteLists
+#define glDeleteTextures chromium.DeleteTextures
+#define glDepthFunc chromium.DepthFunc
+#define glDepthMask chromium.DepthMask
+#define glDepthRange chromium.DepthRange
+#define glDestroyContext chromium.DestroyContext
+#define glDisable chromium.Disable
+#define glDisableClientState chromium.DisableClientState
+#define glDrawArrays chromium.DrawArrays
+#define glDrawBuffer chromium.DrawBuffer
+#define glDrawElements chromium.DrawElements
+#define glDrawPixels chromium.DrawPixels
+#define glDrawRangeElements chromium.DrawRangeElements
+#define glEdgeFlag chromium.EdgeFlag
+#define glEdgeFlagPointer chromium.EdgeFlagPointer
+#define glEdgeFlagv chromium.EdgeFlagv
+#define glEnable chromium.Enable
+#define glEnableClientState chromium.EnableClientState
+#define glEnd chromium.End
+#define glEndList chromium.EndList
+#define glEvalCoord1d chromium.EvalCoord1d
+#define glEvalCoord1dv chromium.EvalCoord1dv
+#define glEvalCoord1f chromium.EvalCoord1f
+#define glEvalCoord1fv chromium.EvalCoord1fv
+#define glEvalCoord2d chromium.EvalCoord2d
+#define glEvalCoord2dv chromium.EvalCoord2dv
+#define glEvalCoord2f chromium.EvalCoord2f
+#define glEvalCoord2fv chromium.EvalCoord2fv
+#define glEvalMesh1 chromium.EvalMesh1
+#define glEvalMesh2 chromium.EvalMesh2
+#define glEvalPoint1 chromium.EvalPoint1
+#define glEvalPoint2 chromium.EvalPoint2
+#define glFeedbackBuffer chromium.FeedbackBuffer
+#define glFinalCombinerInputNV chromium.FinalCombinerInputNV
+#define glFinish chromium.Finish
+#define glFlush chromium.Flush
+#define glFogf chromium.Fogf
+#define glFogfv chromium.Fogfv
+#define glFogi chromium.Fogi
+#define glFogiv chromium.Fogiv
+#define glFrontFace chromium.FrontFace
+#define glFrustum chromium.Frustum
+#define glGenLists chromium.GenLists
+#define glGenTextures chromium.GenTextures
+#define glGetBooleanv chromium.GetBooleanv
+#define glGetChromiumParametervCR chromium.GetChromiumParametervCR
+#define glGetClipPlane chromium.GetClipPlane
+#define glGetCombinerInputParameterfvNV chromium.GetCombinerInputParameterfvNV
+#define glGetCombinerInputParameterivNV chromium.GetCombinerInputParameterivNV
+#define glGetCombinerOutputParameterfvNV chromium.GetCombinerOutputParameterfvNV
+#define glGetCombinerOutputParameterivNV chromium.GetCombinerOutputParameterivNV
+#define glGetCombinerStageParameterfvNV chromium.GetCombinerStageParameterfvNV
+#define glGetDoublev chromium.GetDoublev
+#define glGetError chromium.GetError
+#define glGetFinalCombinerInputParameterfvNV chromium.GetFinalCombinerInputParameterfvNV
+#define glGetFinalCombinerInputParameterivNV chromium.GetFinalCombinerInputParameterivNV
+#define glGetFloatv chromium.GetFloatv
+#define glGetIntegerv chromium.GetIntegerv
+#define glGetLightfv chromium.GetLightfv
+#define glGetLightiv chromium.GetLightiv
+#define glGetMapdv chromium.GetMapdv
+#define glGetMapfv chromium.GetMapfv
+#define glGetMapiv chromium.GetMapiv
+#define glGetMaterialfv chromium.GetMaterialfv
+#define glGetMaterialiv chromium.GetMaterialiv
+#define glGetPixelMapfv chromium.GetPixelMapfv
+#define glGetPixelMapuiv chromium.GetPixelMapuiv
+#define glGetPixelMapusv chromium.GetPixelMapusv
+#define glGetPointerv chromium.GetPointerv
+#define glGetPolygonStipple chromium.GetPolygonStipple
+#define glGetString chromium.GetString
+#define glGetTexEnvfv chromium.GetTexEnvfv
+#define glGetTexEnviv chromium.GetTexEnviv
+#define glGetTexGendv chromium.GetTexGendv
+#define glGetTexGenfv chromium.GetTexGenfv
+#define glGetTexGeniv chromium.GetTexGeniv
+#define glGetTexImage chromium.GetTexImage
+#define glGetTexLevelParameterfv chromium.GetTexLevelParameterfv
+#define glGetTexLevelParameteriv chromium.GetTexLevelParameteriv
+#define glGetTexParameterfv chromium.GetTexParameterfv
+#define glGetTexParameteriv chromium.GetTexParameteriv
+#define glHint chromium.Hint
+#define glIndexMask chromium.IndexMask
+#define glIndexPointer chromium.IndexPointer
+#define glIndexd chromium.Indexd
+#define glIndexdv chromium.Indexdv
+#define glIndexf chromium.Indexf
+#define glIndexfv chromium.Indexfv
+#define glIndexi chromium.Indexi
+#define glIndexiv chromium.Indexiv
+#define glIndexs chromium.Indexs
+#define glIndexsv chromium.Indexsv
+#define glIndexub chromium.Indexub
+#define glIndexubv chromium.Indexubv
+#define glInitNames chromium.InitNames
+#define glInterleavedArrays chromium.InterleavedArrays
+#define glIsEnabled chromium.IsEnabled
+#define glIsList chromium.IsList
+#define glIsTexture chromium.IsTexture
+#define glLightModelf chromium.LightModelf
+#define glLightModelfv chromium.LightModelfv
+#define glLightModeli chromium.LightModeli
+#define glLightModeliv chromium.LightModeliv
+#define glLightf chromium.Lightf
+#define glLightfv chromium.Lightfv
+#define glLighti chromium.Lighti
+#define glLightiv chromium.Lightiv
+#define glLineStipple chromium.LineStipple
+#define glLineWidth chromium.LineWidth
+#define glListBase chromium.ListBase
+#define glLoadIdentity chromium.LoadIdentity
+#define glLoadMatrixd chromium.LoadMatrixd
+#define glLoadMatrixf chromium.LoadMatrixf
+#define glLoadName chromium.LoadName
+#define glLogicOp chromium.LogicOp
+#define glMakeCurrent chromium.MakeCurrent
+#define glMap1d chromium.Map1d
+#define glMap1f chromium.Map1f
+#define glMap2d chromium.Map2d
+#define glMap2f chromium.Map2f
+#define glMapGrid1d chromium.MapGrid1d
+#define glMapGrid1f chromium.MapGrid1f
+#define glMapGrid2d chromium.MapGrid2d
+#define glMapGrid2f chromium.MapGrid2f
+#define glMaterialf chromium.Materialf
+#define glMaterialfv chromium.Materialfv
+#define glMateriali chromium.Materiali
+#define glMaterialiv chromium.Materialiv
+#define glMatrixMode chromium.MatrixMode
+#define glMultMatrixd chromium.MultMatrixd
+#define glMultMatrixf chromium.MultMatrixf
+#define glMultiTexCoord1dARB chromium.MultiTexCoord1dARB
+#define glMultiTexCoord1dvARB chromium.MultiTexCoord1dvARB
+#define glMultiTexCoord1fARB chromium.MultiTexCoord1fARB
+#define glMultiTexCoord1fvARB chromium.MultiTexCoord1fvARB
+#define glMultiTexCoord1iARB chromium.MultiTexCoord1iARB
+#define glMultiTexCoord1ivARB chromium.MultiTexCoord1ivARB
+#define glMultiTexCoord1sARB chromium.MultiTexCoord1sARB
+#define glMultiTexCoord1svARB chromium.MultiTexCoord1svARB
+#define glMultiTexCoord2dARB chromium.MultiTexCoord2dARB
+#define glMultiTexCoord2dvARB chromium.MultiTexCoord2dvARB
+#define glMultiTexCoord2fARB chromium.MultiTexCoord2fARB
+#define glMultiTexCoord2fvARB chromium.MultiTexCoord2fvARB
+#define glMultiTexCoord2iARB chromium.MultiTexCoord2iARB
+#define glMultiTexCoord2ivARB chromium.MultiTexCoord2ivARB
+#define glMultiTexCoord2sARB chromium.MultiTexCoord2sARB
+#define glMultiTexCoord2svARB chromium.MultiTexCoord2svARB
+#define glMultiTexCoord3dARB chromium.MultiTexCoord3dARB
+#define glMultiTexCoord3dvARB chromium.MultiTexCoord3dvARB
+#define glMultiTexCoord3fARB chromium.MultiTexCoord3fARB
+#define glMultiTexCoord3fvARB chromium.MultiTexCoord3fvARB
+#define glMultiTexCoord3iARB chromium.MultiTexCoord3iARB
+#define glMultiTexCoord3ivARB chromium.MultiTexCoord3ivARB
+#define glMultiTexCoord3sARB chromium.MultiTexCoord3sARB
+#define glMultiTexCoord3svARB chromium.MultiTexCoord3svARB
+#define glMultiTexCoord4dARB chromium.MultiTexCoord4dARB
+#define glMultiTexCoord4dvARB chromium.MultiTexCoord4dvARB
+#define glMultiTexCoord4fARB chromium.MultiTexCoord4fARB
+#define glMultiTexCoord4fvARB chromium.MultiTexCoord4fvARB
+#define glMultiTexCoord4iARB chromium.MultiTexCoord4iARB
+#define glMultiTexCoord4ivARB chromium.MultiTexCoord4ivARB
+#define glMultiTexCoord4sARB chromium.MultiTexCoord4sARB
+#define glMultiTexCoord4svARB chromium.MultiTexCoord4svARB
+#define glNewList chromium.NewList
+#define glNormal3b chromium.Normal3b
+#define glNormal3bv chromium.Normal3bv
+#define glNormal3d chromium.Normal3d
+#define glNormal3dv chromium.Normal3dv
+#define glNormal3f chromium.Normal3f
+#define glNormal3fv chromium.Normal3fv
+#define glNormal3i chromium.Normal3i
+#define glNormal3iv chromium.Normal3iv
+#define glNormal3s chromium.Normal3s
+#define glNormal3sv chromium.Normal3sv
+#define glNormalPointer chromium.NormalPointer
+#define glOrtho chromium.Ortho
+#define glPassThrough chromium.PassThrough
+#define glPixelMapfv chromium.PixelMapfv
+#define glPixelMapuiv chromium.PixelMapuiv
+#define glPixelMapusv chromium.PixelMapusv
+#define glPixelStoref chromium.PixelStoref
+#define glPixelStorei chromium.PixelStorei
+#define glPixelTransferf chromium.PixelTransferf
+#define glPixelTransferi chromium.PixelTransferi
+#define glPixelZoom chromium.PixelZoom
+#define glPointSize chromium.PointSize
+#define glPolygonMode chromium.PolygonMode
+#define glPolygonOffset chromium.PolygonOffset
+#define glPolygonStipple chromium.PolygonStipple
+#define glPopAttrib chromium.PopAttrib
+#define glPopClientAttrib chromium.PopClientAttrib
+#define glPopMatrix chromium.PopMatrix
+#define glPopName chromium.PopName
+#define glPrioritizeTextures chromium.PrioritizeTextures
+#define glPushAttrib chromium.PushAttrib
+#define glPushClientAttrib chromium.PushClientAttrib
+#define glPushMatrix chromium.PushMatrix
+#define glPushName chromium.PushName
+#define glRasterPos2d chromium.RasterPos2d
+#define glRasterPos2dv chromium.RasterPos2dv
+#define glRasterPos2f chromium.RasterPos2f
+#define glRasterPos2fv chromium.RasterPos2fv
+#define glRasterPos2i chromium.RasterPos2i
+#define glRasterPos2iv chromium.RasterPos2iv
+#define glRasterPos2s chromium.RasterPos2s
+#define glRasterPos2sv chromium.RasterPos2sv
+#define glRasterPos3d chromium.RasterPos3d
+#define glRasterPos3dv chromium.RasterPos3dv
+#define glRasterPos3f chromium.RasterPos3f
+#define glRasterPos3fv chromium.RasterPos3fv
+#define glRasterPos3i chromium.RasterPos3i
+#define glRasterPos3iv chromium.RasterPos3iv
+#define glRasterPos3s chromium.RasterPos3s
+#define glRasterPos3sv chromium.RasterPos3sv
+#define glRasterPos4d chromium.RasterPos4d
+#define glRasterPos4dv chromium.RasterPos4dv
+#define glRasterPos4f chromium.RasterPos4f
+#define glRasterPos4fv chromium.RasterPos4fv
+#define glRasterPos4i chromium.RasterPos4i
+#define glRasterPos4iv chromium.RasterPos4iv
+#define glRasterPos4s chromium.RasterPos4s
+#define glRasterPos4sv chromium.RasterPos4sv
+#define glReadBuffer chromium.ReadBuffer
+#define glReadPixels chromium.ReadPixels
+#define glRectd chromium.Rectd
+#define glRectdv chromium.Rectdv
+#define glRectf chromium.Rectf
+#define glRectfv chromium.Rectfv
+#define glRecti chromium.Recti
+#define glRectiv chromium.Rectiv
+#define glRects chromium.Rects
+#define glRectsv chromium.Rectsv
+#define glRenderMode chromium.RenderMode
+#define glRotated chromium.Rotated
+#define glRotatef chromium.Rotatef
+#define glScaled chromium.Scaled
+#define glScalef chromium.Scalef
+#define glScissor chromium.Scissor
+#define glSecondaryColor3bEXT chromium.SecondaryColor3bEXT
+#define glSecondaryColor3bvEXT chromium.SecondaryColor3bvEXT
+#define glSecondaryColor3dEXT chromium.SecondaryColor3dEXT
+#define glSecondaryColor3dvEXT chromium.SecondaryColor3dvEXT
+#define glSecondaryColor3fEXT chromium.SecondaryColor3fEXT
+#define glSecondaryColor3fvEXT chromium.SecondaryColor3fvEXT
+#define glSecondaryColor3iEXT chromium.SecondaryColor3iEXT
+#define glSecondaryColor3ivEXT chromium.SecondaryColor3ivEXT
+#define glSecondaryColor3sEXT chromium.SecondaryColor3sEXT
+#define glSecondaryColor3svEXT chromium.SecondaryColor3svEXT
+#define glSecondaryColor3ubEXT chromium.SecondaryColor3ubEXT
+#define glSecondaryColor3ubvEXT chromium.SecondaryColor3ubvEXT
+#define glSecondaryColor3uiEXT chromium.SecondaryColor3uiEXT
+#define glSecondaryColor3uivEXT chromium.SecondaryColor3uivEXT
+#define glSecondaryColor3usEXT chromium.SecondaryColor3usEXT
+#define glSecondaryColor3usvEXT chromium.SecondaryColor3usvEXT
+#define glSecondaryColorPointerEXT chromium.SecondaryColorPointerEXT
+#define glSelectBuffer chromium.SelectBuffer
+#define glSemaphoreCreate chromium.SemaphoreCreate
+#define glSemaphoreDestroy chromium.SemaphoreDestroy
+#define glSemaphoreP chromium.SemaphoreP
+#define glSemaphoreV chromium.SemaphoreV
+#define glShadeModel chromium.ShadeModel
+#define glStencilFunc chromium.StencilFunc
+#define glStencilMask chromium.StencilMask
+#define glStencilOp chromium.StencilOp
+#define glSwapBuffers chromium.SwapBuffers
+#define glTexCoord1d chromium.TexCoord1d
+#define glTexCoord1dv chromium.TexCoord1dv
+#define glTexCoord1f chromium.TexCoord1f
+#define glTexCoord1fv chromium.TexCoord1fv
+#define glTexCoord1i chromium.TexCoord1i
+#define glTexCoord1iv chromium.TexCoord1iv
+#define glTexCoord1s chromium.TexCoord1s
+#define glTexCoord1sv chromium.TexCoord1sv
+#define glTexCoord2d chromium.TexCoord2d
+#define glTexCoord2dv chromium.TexCoord2dv
+#define glTexCoord2f chromium.TexCoord2f
+#define glTexCoord2fv chromium.TexCoord2fv
+#define glTexCoord2i chromium.TexCoord2i
+#define glTexCoord2iv chromium.TexCoord2iv
+#define glTexCoord2s chromium.TexCoord2s
+#define glTexCoord2sv chromium.TexCoord2sv
+#define glTexCoord3d chromium.TexCoord3d
+#define glTexCoord3dv chromium.TexCoord3dv
+#define glTexCoord3f chromium.TexCoord3f
+#define glTexCoord3fv chromium.TexCoord3fv
+#define glTexCoord3i chromium.TexCoord3i
+#define glTexCoord3iv chromium.TexCoord3iv
+#define glTexCoord3s chromium.TexCoord3s
+#define glTexCoord3sv chromium.TexCoord3sv
+#define glTexCoord4d chromium.TexCoord4d
+#define glTexCoord4dv chromium.TexCoord4dv
+#define glTexCoord4f chromium.TexCoord4f
+#define glTexCoord4fv chromium.TexCoord4fv
+#define glTexCoord4i chromium.TexCoord4i
+#define glTexCoord4iv chromium.TexCoord4iv
+#define glTexCoord4s chromium.TexCoord4s
+#define glTexCoord4sv chromium.TexCoord4sv
+#define glTexCoordPointer chromium.TexCoordPointer
+#define glTexEnvf chromium.TexEnvf
+#define glTexEnvfv chromium.TexEnvfv
+#define glTexEnvi chromium.TexEnvi
+#define glTexEnviv chromium.TexEnviv
+#define glTexGend chromium.TexGend
+#define glTexGendv chromium.TexGendv
+#define glTexGenf chromium.TexGenf
+#define glTexGenfv chromium.TexGenfv
+#define glTexGeni chromium.TexGeni
+#define glTexGeniv chromium.TexGeniv
+#define glTexImage1D chromium.TexImage1D
+#define glTexImage2D chromium.TexImage2D
+#define glTexParameterf chromium.TexParameterf
+#define glTexParameterfv chromium.TexParameterfv
+#define glTexParameteri chromium.TexParameteri
+#define glTexParameteriv chromium.TexParameteriv
+#define glTexSubImage1D chromium.TexSubImage1D
+#define glTexSubImage2D chromium.TexSubImage2D
+#define glTranslated chromium.Translated
+#define glTranslatef chromium.Translatef
+#define glVertex2d chromium.Vertex2d
+#define glVertex2dv chromium.Vertex2dv
+#define glVertex2f chromium.Vertex2f
+#define glVertex2fv chromium.Vertex2fv
+#define glVertex2i chromium.Vertex2i
+#define glVertex2iv chromium.Vertex2iv
+#define glVertex2s chromium.Vertex2s
+#define glVertex2sv chromium.Vertex2sv
+#define glVertex3d chromium.Vertex3d
+#define glVertex3dv chromium.Vertex3dv
+#define glVertex3f chromium.Vertex3f
+#define glVertex3fv chromium.Vertex3fv
+#define glVertex3i chromium.Vertex3i
+#define glVertex3iv chromium.Vertex3iv
+#define glVertex3s chromium.Vertex3s
+#define glVertex3sv chromium.Vertex3sv
+#define glVertex4d chromium.Vertex4d
+#define glVertex4dv chromium.Vertex4dv
+#define glVertex4f chromium.Vertex4f
+#define glVertex4fv chromium.Vertex4fv
+#define glVertex4i chromium.Vertex4i
+#define glVertex4iv chromium.Vertex4iv
+#define glVertex4s chromium.Vertex4s
+#define glVertex4sv chromium.Vertex4sv
+#define glVertexPointer chromium.VertexPointer
+#define glViewport chromium.Viewport
+#define glWriteback chromium.Writeback 
+
+
+#define glgsg crgsg
+#define NotifyCategoryGetCategory_glgsg NotifyCategoryGetCategory_crgsg
+
+#define gl_show_transforms cr_show_transforms
+#define gl_cheap_textures cr_cheap_textures
+#define gl_cull_traversal cr_cull_traversal
+#define gl_ignore_mipmaps cr_ignore_mipmaps
+#define gl_force_mipmaps cr_force_mipmaps
+#define gl_show_mipmaps cr_show_mipmaps
+#define gl_save_mipmaps cr_save_mipmaps
+#define gl_auto_normalize_lighting cr_auto_normalize_lighting
+#define gl_supports_bgr cr_supports_bgr
+
+#define GLDecalType CRDecalType
+#define gl_decal_type cr_decal_type
+
+#define init_libglgsg init_libcrgsg
+
+
+#define glgsg_cat crgsg_cat
+
+#define GLGraphicsStateGuardian CRGraphicsStateGuardian
+#define GLTextureContext CRTextureContext
+#define GLGeomNodeContext CRGeomNodeContext
+#define GLSavedFrameBuffer CRSavedFrameBuffer
+
+#define make_GlGraphicsStateGuardian make_CRGraphicsStateGuardian
+
+"""

+ 3296 - 0
panda/src/crgsg/crext.h

@@ -0,0 +1,3296 @@
+#ifndef __glext_h_
+#define __glext_h_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright 1998, 1999, 2000, 2001, NVIDIA Corporation.
+** All rights Reserved.
+** 
+** THE INFORMATION CONTAINED HEREIN IS PROPRIETARY AND CONFIDENTIAL TO
+** NVIDIA, CORPORATION.  USE, REPRODUCTION OR DISCLOSURE TO ANY THIRD PARTY
+** IS SUBJECT TO WRITTEN PRE-APPROVAL BY NVIDIA, CORPORATION.
+*/
+
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+** 
+** http://oss.sgi.com/projects/FreeB
+** 
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+** 
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+** 
+** Additional Notice Provisions: This software was created using the
+** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
+** not been independently verified as being compliant with the OpenGL(R)
+** version 1.2.1 Specification.
+*/
+
+#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__)
+#define WIN32_LEAN_AND_MEAN 1
+#include <windows.h>
+#endif
+
+#ifndef APIENTRY
+#define APIENTRY
+#endif
+
+/*************************************************************/
+
+/* Header file version number, required by OpenGL ABI for Linux */
+#define GL_GLEXT_VERSION 6
+
+#ifndef GL_VERSION_1_2
+#define GL_CONSTANT_COLOR                 0x8001
+#define GL_ONE_MINUS_CONSTANT_COLOR       0x8002
+#define GL_CONSTANT_ALPHA                 0x8003
+#define GL_ONE_MINUS_CONSTANT_ALPHA       0x8004
+#define GL_BLEND_COLOR                    0x8005
+#define GL_FUNC_ADD                       0x8006
+#define GL_MIN                            0x8007
+#define GL_MAX                            0x8008
+#define GL_BLEND_EQUATION                 0x8009
+#define GL_FUNC_SUBTRACT                  0x800A
+#define GL_FUNC_REVERSE_SUBTRACT          0x800B
+#define GL_CONVOLUTION_1D                 0x8010
+#define GL_CONVOLUTION_2D                 0x8011
+#define GL_SEPARABLE_2D                   0x8012
+#define GL_CONVOLUTION_BORDER_MODE        0x8013
+#define GL_CONVOLUTION_FILTER_SCALE       0x8014
+#define GL_CONVOLUTION_FILTER_BIAS        0x8015
+#define GL_REDUCE                         0x8016
+#define GL_CONVOLUTION_FORMAT             0x8017
+#define GL_CONVOLUTION_WIDTH              0x8018
+#define GL_CONVOLUTION_HEIGHT             0x8019
+#define GL_MAX_CONVOLUTION_WIDTH          0x801A
+#define GL_MAX_CONVOLUTION_HEIGHT         0x801B
+#define GL_POST_CONVOLUTION_RED_SCALE     0x801C
+#define GL_POST_CONVOLUTION_GREEN_SCALE   0x801D
+#define GL_POST_CONVOLUTION_BLUE_SCALE    0x801E
+#define GL_POST_CONVOLUTION_ALPHA_SCALE   0x801F
+#define GL_POST_CONVOLUTION_RED_BIAS      0x8020
+#define GL_POST_CONVOLUTION_GREEN_BIAS    0x8021
+#define GL_POST_CONVOLUTION_BLUE_BIAS     0x8022
+#define GL_POST_CONVOLUTION_ALPHA_BIAS    0x8023
+#define GL_HISTOGRAM                      0x8024
+#define GL_PROXY_HISTOGRAM                0x8025
+#define GL_HISTOGRAM_WIDTH                0x8026
+#define GL_HISTOGRAM_FORMAT               0x8027
+#define GL_HISTOGRAM_RED_SIZE             0x8028
+#define GL_HISTOGRAM_GREEN_SIZE           0x8029
+#define GL_HISTOGRAM_BLUE_SIZE            0x802A
+#define GL_HISTOGRAM_ALPHA_SIZE           0x802B
+#define GL_HISTOGRAM_LUMINANCE_SIZE       0x802C
+#define GL_HISTOGRAM_SINK                 0x802D
+#define GL_MINMAX                         0x802E
+#define GL_MINMAX_FORMAT                  0x802F
+#define GL_MINMAX_SINK                    0x8030
+#define GL_TABLE_TOO_LARGE                0x8031
+#define GL_UNSIGNED_BYTE_3_3_2            0x8032
+#define GL_UNSIGNED_SHORT_4_4_4_4         0x8033
+#define GL_UNSIGNED_SHORT_5_5_5_1         0x8034
+#define GL_UNSIGNED_INT_8_8_8_8           0x8035
+#define GL_UNSIGNED_INT_10_10_10_2        0x8036
+#define GL_RESCALE_NORMAL                 0x803A
+#define GL_UNSIGNED_BYTE_2_3_3_REV        0x8362
+#define GL_UNSIGNED_SHORT_5_6_5           0x8363
+#define GL_UNSIGNED_SHORT_5_6_5_REV       0x8364
+#define GL_UNSIGNED_SHORT_4_4_4_4_REV     0x8365
+#define GL_UNSIGNED_SHORT_1_5_5_5_REV     0x8366
+#define GL_UNSIGNED_INT_8_8_8_8_REV       0x8367
+#define GL_UNSIGNED_INT_2_10_10_10_REV    0x8368
+#define GL_COLOR_MATRIX                   0x80B1
+#define GL_COLOR_MATRIX_STACK_DEPTH       0x80B2
+#define GL_MAX_COLOR_MATRIX_STACK_DEPTH   0x80B3
+#define GL_POST_COLOR_MATRIX_RED_SCALE    0x80B4
+#define GL_POST_COLOR_MATRIX_GREEN_SCALE  0x80B5
+#define GL_POST_COLOR_MATRIX_BLUE_SCALE   0x80B6
+#define GL_POST_COLOR_MATRIX_ALPHA_SCALE  0x80B7
+#define GL_POST_COLOR_MATRIX_RED_BIAS     0x80B8
+#define GL_POST_COLOR_MATRIX_GREEN_BIAS   0x80B9
+#define GL_POST_COLOR_MATRIX_BLUE_BIAS    0x80BA
+#define GL_COLOR_TABLE                    0x80D0
+#define GL_POST_CONVOLUTION_COLOR_TABLE   0x80D1
+#define GL_POST_COLOR_MATRIX_COLOR_TABLE  0x80D2
+#define GL_PROXY_COLOR_TABLE              0x80D3
+#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4
+#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5
+#define GL_COLOR_TABLE_SCALE              0x80D6
+#define GL_COLOR_TABLE_BIAS               0x80D7
+#define GL_COLOR_TABLE_FORMAT             0x80D8
+#define GL_COLOR_TABLE_WIDTH              0x80D9
+#define GL_COLOR_TABLE_RED_SIZE           0x80DA
+#define GL_COLOR_TABLE_GREEN_SIZE         0x80DB
+#define GL_COLOR_TABLE_BLUE_SIZE          0x80DC
+#define GL_COLOR_TABLE_ALPHA_SIZE         0x80DD
+#define GL_COLOR_TABLE_LUMINANCE_SIZE     0x80DE
+#define GL_COLOR_TABLE_INTENSITY_SIZE     0x80DF
+#define GL_CLAMP_TO_EDGE                  0x812F
+#define GL_TEXTURE_MIN_LOD                0x813A
+#define GL_TEXTURE_MAX_LOD                0x813B
+#define GL_TEXTURE_BASE_LEVEL             0x813C
+#define GL_TEXTURE_MAX_LEVEL              0x813D
+#endif
+
+#ifndef GL_ARB_multitexture
+#define GL_TEXTURE0_ARB                   0x84C0
+#define GL_TEXTURE1_ARB                   0x84C1
+#define GL_TEXTURE2_ARB                   0x84C2
+#define GL_TEXTURE3_ARB                   0x84C3
+#define GL_TEXTURE4_ARB                   0x84C4
+#define GL_TEXTURE5_ARB                   0x84C5
+#define GL_TEXTURE6_ARB                   0x84C6
+#define GL_TEXTURE7_ARB                   0x84C7
+#define GL_TEXTURE8_ARB                   0x84C8
+#define GL_TEXTURE9_ARB                   0x84C9
+#define GL_TEXTURE10_ARB                  0x84CA
+#define GL_TEXTURE11_ARB                  0x84CB
+#define GL_TEXTURE12_ARB                  0x84CC
+#define GL_TEXTURE13_ARB                  0x84CD
+#define GL_TEXTURE14_ARB                  0x84CE
+#define GL_TEXTURE15_ARB                  0x84CF
+#define GL_TEXTURE16_ARB                  0x84D0
+#define GL_TEXTURE17_ARB                  0x84D1
+#define GL_TEXTURE18_ARB                  0x84D2
+#define GL_TEXTURE19_ARB                  0x84D3
+#define GL_TEXTURE20_ARB                  0x84D4
+#define GL_TEXTURE21_ARB                  0x84D5
+#define GL_TEXTURE22_ARB                  0x84D6
+#define GL_TEXTURE23_ARB                  0x84D7
+#define GL_TEXTURE24_ARB                  0x84D8
+#define GL_TEXTURE25_ARB                  0x84D9
+#define GL_TEXTURE26_ARB                  0x84DA
+#define GL_TEXTURE27_ARB                  0x84DB
+#define GL_TEXTURE28_ARB                  0x84DC
+#define GL_TEXTURE29_ARB                  0x84DD
+#define GL_TEXTURE30_ARB                  0x84DE
+#define GL_TEXTURE31_ARB                  0x84DF
+#define GL_ACTIVE_TEXTURE_ARB             0x84E0
+#define GL_CLIENT_ACTIVE_TEXTURE_ARB      0x84E1
+#define GL_MAX_TEXTURE_UNITS_ARB          0x84E2
+#endif
+
+#ifndef GL_ARB_transpose_matrix
+#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3
+#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4
+#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB   0x84E5
+#define GL_TRANSPOSE_COLOR_MATRIX_ARB     0x84E6
+#endif
+
+#ifndef GL_ARB_multisample
+#define GL_MULTISAMPLE_ARB                0x809D
+#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB   0x809E
+#define GL_SAMPLE_ALPHA_TO_ONE_ARB        0x809F
+#define GL_SAMPLE_COVERAGE_ARB            0x80A0
+#define GL_SAMPLE_BUFFERS_ARB             0x80A8
+#define GL_SAMPLES_ARB                    0x80A9
+#define GL_SAMPLE_COVERAGE_VALUE_ARB      0x80AA
+#define GL_SAMPLE_COVERAGE_INVERT_ARB     0x80AB
+#define GL_MULTISAMPLE_BIT_ARB            0x20000000
+#endif
+
+#ifndef GL_ARB_texture_cube_map
+#define GL_NORMAL_MAP_ARB                 0x8511
+#define GL_REFLECTION_MAP_ARB             0x8512
+#define GL_TEXTURE_CUBE_MAP_ARB           0x8513
+#define GL_TEXTURE_BINDING_CUBE_MAP_ARB   0x8514
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A
+#define GL_PROXY_TEXTURE_CUBE_MAP_ARB     0x851B
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB  0x851C
+#endif
+
+#ifndef GL_ARB_texture_compression
+#define GL_COMPRESSED_ALPHA_ARB           0x84E9
+#define GL_COMPRESSED_LUMINANCE_ARB       0x84EA
+#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB
+#define GL_COMPRESSED_INTENSITY_ARB       0x84EC
+#define GL_COMPRESSED_RGB_ARB             0x84ED
+#define GL_COMPRESSED_RGBA_ARB            0x84EE
+#define GL_TEXTURE_COMPRESSION_HINT_ARB   0x84EF
+#define GL_TEXTURE_IMAGE_SIZE_ARB         0x86A0
+#define GL_TEXTURE_COMPRESSED_ARB         0x86A1
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3
+#endif
+
+#ifndef GL_EXT_abgr
+#define GL_ABGR_EXT                       0x8000
+#endif
+
+#ifndef GL_EXT_blend_color
+#define GL_CONSTANT_COLOR_EXT             0x8001
+#define GL_ONE_MINUS_CONSTANT_COLOR_EXT   0x8002
+#define GL_CONSTANT_ALPHA_EXT             0x8003
+#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT   0x8004
+#define GL_BLEND_COLOR_EXT                0x8005
+#endif
+
+#ifndef GL_EXT_polygon_offset
+#define GL_POLYGON_OFFSET_EXT             0x8037
+#define GL_POLYGON_OFFSET_FACTOR_EXT      0x8038
+#define GL_POLYGON_OFFSET_BIAS_EXT        0x8039
+#endif
+
+#ifndef GL_EXT_texture
+#define GL_ALPHA4_EXT                     0x803B
+#define GL_ALPHA8_EXT                     0x803C
+#define GL_ALPHA12_EXT                    0x803D
+#define GL_ALPHA16_EXT                    0x803E
+#define GL_LUMINANCE4_EXT                 0x803F
+#define GL_LUMINANCE8_EXT                 0x8040
+#define GL_LUMINANCE12_EXT                0x8041
+#define GL_LUMINANCE16_EXT                0x8042
+#define GL_LUMINANCE4_ALPHA4_EXT          0x8043
+#define GL_LUMINANCE6_ALPHA2_EXT          0x8044
+#define GL_LUMINANCE8_ALPHA8_EXT          0x8045
+#define GL_LUMINANCE12_ALPHA4_EXT         0x8046
+#define GL_LUMINANCE12_ALPHA12_EXT        0x8047
+#define GL_LUMINANCE16_ALPHA16_EXT        0x8048
+#define GL_INTENSITY_EXT                  0x8049
+#define GL_INTENSITY4_EXT                 0x804A
+#define GL_INTENSITY8_EXT                 0x804B
+#define GL_INTENSITY12_EXT                0x804C
+#define GL_INTENSITY16_EXT                0x804D
+#define GL_RGB2_EXT                       0x804E
+#define GL_RGB4_EXT                       0x804F
+#define GL_RGB5_EXT                       0x8050
+#define GL_RGB8_EXT                       0x8051
+#define GL_RGB10_EXT                      0x8052
+#define GL_RGB12_EXT                      0x8053
+#define GL_RGB16_EXT                      0x8054
+#define GL_RGBA2_EXT                      0x8055
+#define GL_RGBA4_EXT                      0x8056
+#define GL_RGB5_A1_EXT                    0x8057
+#define GL_RGBA8_EXT                      0x8058
+#define GL_RGB10_A2_EXT                   0x8059
+#define GL_RGBA12_EXT                     0x805A
+#define GL_RGBA16_EXT                     0x805B
+#define GL_TEXTURE_RED_SIZE_EXT           0x805C
+#define GL_TEXTURE_GREEN_SIZE_EXT         0x805D
+#define GL_TEXTURE_BLUE_SIZE_EXT          0x805E
+#define GL_TEXTURE_ALPHA_SIZE_EXT         0x805F
+#define GL_TEXTURE_LUMINANCE_SIZE_EXT     0x8060
+#define GL_TEXTURE_INTENSITY_SIZE_EXT     0x8061
+#define GL_REPLACE_EXT                    0x8062
+#define GL_PROXY_TEXTURE_1D_EXT           0x8063
+#define GL_PROXY_TEXTURE_2D_EXT           0x8064
+#define GL_TEXTURE_TOO_LARGE_EXT          0x8065
+#endif
+
+#ifndef GL_EXT_texture3D
+#define GL_PACK_SKIP_IMAGES               0x806B
+#define GL_PACK_SKIP_IMAGES_EXT           0x806B
+#define GL_PACK_IMAGE_HEIGHT              0x806C
+#define GL_PACK_IMAGE_HEIGHT_EXT          0x806C
+#define GL_UNPACK_SKIP_IMAGES             0x806D
+#define GL_UNPACK_SKIP_IMAGES_EXT         0x806D
+#define GL_UNPACK_IMAGE_HEIGHT            0x806E
+#define GL_UNPACK_IMAGE_HEIGHT_EXT        0x806E
+#define GL_TEXTURE_3D                     0x806F
+#define GL_TEXTURE_3D_EXT                 0x806F
+#define GL_PROXY_TEXTURE_3D               0x8070
+#define GL_PROXY_TEXTURE_3D_EXT           0x8070
+#define GL_TEXTURE_DEPTH                  0x8071
+#define GL_TEXTURE_DEPTH_EXT              0x8071
+#define GL_TEXTURE_WRAP_R                 0x8072
+#define GL_TEXTURE_WRAP_R_EXT             0x8072
+#define GL_MAX_3D_TEXTURE_SIZE            0x8073
+#define GL_MAX_3D_TEXTURE_SIZE_EXT        0x8073
+#endif
+
+#ifndef GL_SGIS_texture_filter4
+#define GL_FILTER4_SGIS                   0x8146
+#define GL_TEXTURE_FILTER4_SIZE_SGIS      0x8147
+#endif
+
+#ifndef GL_EXT_subtexture
+#endif
+
+#ifndef GL_EXT_copy_texture
+#endif
+
+#ifndef GL_EXT_histogram
+#define GL_HISTOGRAM_EXT                  0x8024
+#define GL_PROXY_HISTOGRAM_EXT            0x8025
+#define GL_HISTOGRAM_WIDTH_EXT            0x8026
+#define GL_HISTOGRAM_FORMAT_EXT           0x8027
+#define GL_HISTOGRAM_RED_SIZE_EXT         0x8028
+#define GL_HISTOGRAM_GREEN_SIZE_EXT       0x8029
+#define GL_HISTOGRAM_BLUE_SIZE_EXT        0x802A
+#define GL_HISTOGRAM_ALPHA_SIZE_EXT       0x802B
+#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT   0x802C
+#define GL_HISTOGRAM_SINK_EXT             0x802D
+#define GL_MINMAX_EXT                     0x802E
+#define GL_MINMAX_FORMAT_EXT              0x802F
+#define GL_MINMAX_SINK_EXT                0x8030
+#define GL_TABLE_TOO_LARGE_EXT            0x8031
+#endif
+
+#ifndef GL_EXT_convolution
+#define GL_CONVOLUTION_1D_EXT             0x8010
+#define GL_CONVOLUTION_2D_EXT             0x8011
+#define GL_SEPARABLE_2D_EXT               0x8012
+#define GL_CONVOLUTION_BORDER_MODE_EXT    0x8013
+#define GL_CONVOLUTION_FILTER_SCALE_EXT   0x8014
+#define GL_CONVOLUTION_FILTER_BIAS_EXT    0x8015
+#define GL_REDUCE_EXT                     0x8016
+#define GL_CONVOLUTION_FORMAT_EXT         0x8017
+#define GL_CONVOLUTION_WIDTH_EXT          0x8018
+#define GL_CONVOLUTION_HEIGHT_EXT         0x8019
+#define GL_MAX_CONVOLUTION_WIDTH_EXT      0x801A
+#define GL_MAX_CONVOLUTION_HEIGHT_EXT     0x801B
+#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C
+#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D
+#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E
+#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F
+#define GL_POST_CONVOLUTION_RED_BIAS_EXT  0x8020
+#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021
+#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022
+#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023
+#endif
+
+#ifndef GL_SGI_color_matrix
+#define GL_COLOR_MATRIX_SGI               0x80B1
+#define GL_COLOR_MATRIX_STACK_DEPTH_SGI   0x80B2
+#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3
+#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4
+#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5
+#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6
+#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7
+#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8
+#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9
+#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA
+#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB
+#endif
+
+#ifndef GL_SGI_color_table
+#define GL_COLOR_TABLE_SGI                0x80D0
+#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1
+#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2
+#define GL_PROXY_COLOR_TABLE_SGI          0x80D3
+#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4
+#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5
+#define GL_COLOR_TABLE_SCALE_SGI          0x80D6
+#define GL_COLOR_TABLE_BIAS_SGI           0x80D7
+#define GL_COLOR_TABLE_FORMAT_SGI         0x80D8
+#define GL_COLOR_TABLE_WIDTH_SGI          0x80D9
+#define GL_COLOR_TABLE_RED_SIZE_SGI       0x80DA
+#define GL_COLOR_TABLE_GREEN_SIZE_SGI     0x80DB
+#define GL_COLOR_TABLE_BLUE_SIZE_SGI      0x80DC
+#define GL_COLOR_TABLE_ALPHA_SIZE_SGI     0x80DD
+#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE
+#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF
+#endif
+
+#ifndef GL_SGIS_pixel_texture
+#define GL_PIXEL_TEXTURE_SGIS             0x8353
+#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354
+#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355
+#define GL_PIXEL_GROUP_COLOR_SGIS         0x8356
+#endif
+
+#ifndef GL_SGIX_pixel_texture
+#define GL_PIXEL_TEX_GEN_SGIX             0x8139
+#define GL_PIXEL_TEX_GEN_MODE_SGIX        0x832B
+#endif
+
+#ifndef GL_SGIS_texture4D
+#define GL_PACK_SKIP_VOLUMES_SGIS         0x8130
+#define GL_PACK_IMAGE_DEPTH_SGIS          0x8131
+#define GL_UNPACK_SKIP_VOLUMES_SGIS       0x8132
+#define GL_UNPACK_IMAGE_DEPTH_SGIS        0x8133
+#define GL_TEXTURE_4D_SGIS                0x8134
+#define GL_PROXY_TEXTURE_4D_SGIS          0x8135
+#define GL_TEXTURE_4DSIZE_SGIS            0x8136
+#define GL_TEXTURE_WRAP_Q_SGIS            0x8137
+#define GL_MAX_4D_TEXTURE_SIZE_SGIS       0x8138
+#define GL_TEXTURE_4D_BINDING_SGIS        0x814F
+#endif
+
+#ifndef GL_SGI_texture_color_table
+#define GL_TEXTURE_COLOR_TABLE_SGI        0x80BC
+#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI  0x80BD
+#endif
+
+#ifndef GL_EXT_cmyka
+#define GL_CMYK_EXT                       0x800C
+#define GL_CMYKA_EXT                      0x800D
+#define GL_PACK_CMYK_HINT_EXT             0x800E
+#define GL_UNPACK_CMYK_HINT_EXT           0x800F
+#endif
+
+#ifndef GL_EXT_texture_object
+#define GL_TEXTURE_PRIORITY_EXT           0x8066
+#define GL_TEXTURE_RESIDENT_EXT           0x8067
+#define GL_TEXTURE_1D_BINDING_EXT         0x8068
+#define GL_TEXTURE_2D_BINDING_EXT         0x8069
+#define GL_TEXTURE_3D_BINDING_EXT         0x806A
+#endif
+
+#ifndef GL_SGIS_detail_texture
+#define GL_DETAIL_TEXTURE_2D_SGIS         0x8095
+#define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096
+#define GL_LINEAR_DETAIL_SGIS             0x8097
+#define GL_LINEAR_DETAIL_ALPHA_SGIS       0x8098
+#define GL_LINEAR_DETAIL_COLOR_SGIS       0x8099
+#define GL_DETAIL_TEXTURE_LEVEL_SGIS      0x809A
+#define GL_DETAIL_TEXTURE_MODE_SGIS       0x809B
+#define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C
+#endif
+
+#ifndef GL_SGIS_sharpen_texture
+#define GL_LINEAR_SHARPEN_SGIS            0x80AD
+#define GL_LINEAR_SHARPEN_ALPHA_SGIS      0x80AE
+#define GL_LINEAR_SHARPEN_COLOR_SGIS      0x80AF
+#define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0
+#endif
+
+#ifndef GL_EXT_packed_pixels
+#define GL_UNSIGNED_BYTE_3_3_2_EXT        0x8032
+#define GL_UNSIGNED_SHORT_4_4_4_4_EXT     0x8033
+#define GL_UNSIGNED_SHORT_5_5_5_1_EXT     0x8034
+#define GL_UNSIGNED_INT_8_8_8_8_EXT       0x8035
+#define GL_UNSIGNED_INT_10_10_10_2_EXT    0x8036
+#endif
+
+#ifndef GL_SGIS_texture_lod
+#define GL_TEXTURE_MIN_LOD_SGIS           0x813A
+#define GL_TEXTURE_MAX_LOD_SGIS           0x813B
+#define GL_TEXTURE_BASE_LEVEL_SGIS        0x813C
+#define GL_TEXTURE_MAX_LEVEL_SGIS         0x813D
+#endif
+
+#ifndef GL_SGIS_multisample
+#define GL_MULTISAMPLE_SGIS               0x809D
+#define GL_SAMPLE_ALPHA_TO_MASK_SGIS      0x809E
+#define GL_SAMPLE_ALPHA_TO_ONE_SGIS       0x809F
+#define GL_SAMPLE_MASK_SGIS               0x80A0
+#define GL_1PASS_SGIS                     0x80A1
+#define GL_2PASS_0_SGIS                   0x80A2
+#define GL_2PASS_1_SGIS                   0x80A3
+#define GL_4PASS_0_SGIS                   0x80A4
+#define GL_4PASS_1_SGIS                   0x80A5
+#define GL_4PASS_2_SGIS                   0x80A6
+#define GL_4PASS_3_SGIS                   0x80A7
+#define GL_SAMPLE_BUFFERS_SGIS            0x80A8
+#define GL_SAMPLES_SGIS                   0x80A9
+#define GL_SAMPLE_MASK_VALUE_SGIS         0x80AA
+#define GL_SAMPLE_MASK_INVERT_SGIS        0x80AB
+#define GL_SAMPLE_PATTERN_SGIS            0x80AC
+#endif
+
+#ifndef GL_EXT_rescale_normal
+#define GL_RESCALE_NORMAL_EXT             0x803A
+#endif
+
+#ifndef GL_EXT_vertex_array
+#define GL_VERTEX_ARRAY_EXT               0x8074
+#define GL_NORMAL_ARRAY_EXT               0x8075
+#define GL_COLOR_ARRAY_EXT                0x8076
+#define GL_INDEX_ARRAY_EXT                0x8077
+#define GL_TEXTURE_COORD_ARRAY_EXT        0x8078
+#define GL_EDGE_FLAG_ARRAY_EXT            0x8079
+#define GL_VERTEX_ARRAY_SIZE_EXT          0x807A
+#define GL_VERTEX_ARRAY_TYPE_EXT          0x807B
+#define GL_VERTEX_ARRAY_STRIDE_EXT        0x807C
+#define GL_VERTEX_ARRAY_COUNT_EXT         0x807D
+#define GL_NORMAL_ARRAY_TYPE_EXT          0x807E
+#define GL_NORMAL_ARRAY_STRIDE_EXT        0x807F
+#define GL_NORMAL_ARRAY_COUNT_EXT         0x8080
+#define GL_COLOR_ARRAY_SIZE_EXT           0x8081
+#define GL_COLOR_ARRAY_TYPE_EXT           0x8082
+#define GL_COLOR_ARRAY_STRIDE_EXT         0x8083
+#define GL_COLOR_ARRAY_COUNT_EXT          0x8084
+#define GL_INDEX_ARRAY_TYPE_EXT           0x8085
+#define GL_INDEX_ARRAY_STRIDE_EXT         0x8086
+#define GL_INDEX_ARRAY_COUNT_EXT          0x8087
+#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT   0x8088
+#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT   0x8089
+#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A
+#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT  0x808B
+#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT     0x808C
+#define GL_EDGE_FLAG_ARRAY_COUNT_EXT      0x808D
+#define GL_VERTEX_ARRAY_POINTER_EXT       0x808E
+#define GL_NORMAL_ARRAY_POINTER_EXT       0x808F
+#define GL_COLOR_ARRAY_POINTER_EXT        0x8090
+#define GL_INDEX_ARRAY_POINTER_EXT        0x8091
+#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092
+#define GL_EDGE_FLAG_ARRAY_POINTER_EXT    0x8093
+#endif
+
+#ifndef GL_EXT_misc_attribute
+#endif
+
+#ifndef GL_SGIS_generate_mipmap
+#define GL_GENERATE_MIPMAP_SGIS           0x8191
+#define GL_GENERATE_MIPMAP_HINT_SGIS      0x8192
+#endif
+
+#ifndef GL_SGIX_clipmap
+#define GL_LINEAR_CLIPMAP_LINEAR_SGIX     0x8170
+#define GL_TEXTURE_CLIPMAP_CENTER_SGIX    0x8171
+#define GL_TEXTURE_CLIPMAP_FRAME_SGIX     0x8172
+#define GL_TEXTURE_CLIPMAP_OFFSET_SGIX    0x8173
+#define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174
+#define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175
+#define GL_TEXTURE_CLIPMAP_DEPTH_SGIX     0x8176
+#define GL_MAX_CLIPMAP_DEPTH_SGIX         0x8177
+#define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178
+#define GL_NEAREST_CLIPMAP_NEAREST_SGIX   0x844D
+#define GL_NEAREST_CLIPMAP_LINEAR_SGIX    0x844E
+#define GL_LINEAR_CLIPMAP_NEAREST_SGIX    0x844F
+#endif
+
+#ifndef GL_SGIX_shadow
+#define GL_TEXTURE_COMPARE_SGIX           0x819A
+#define GL_TEXTURE_COMPARE_OPERATOR_SGIX  0x819B
+#define GL_TEXTURE_LEQUAL_R_SGIX          0x819C
+#define GL_TEXTURE_GEQUAL_R_SGIX          0x819D
+#endif
+
+#ifndef GL_SGIS_texture_edge_clamp
+#define GL_CLAMP_TO_EDGE_SGIS             0x812F
+#endif
+
+#ifndef GL_SGIS_texture_border_clamp
+#define GL_CLAMP_TO_BORDER_SGIS           0x812D
+#endif
+
+#ifndef GL_EXT_blend_minmax
+#define GL_FUNC_ADD_EXT                   0x8006
+#define GL_MIN_EXT                        0x8007
+#define GL_MAX_EXT                        0x8008
+#define GL_BLEND_EQUATION_EXT             0x8009
+#endif
+
+#ifndef GL_EXT_blend_subtract
+#define GL_FUNC_SUBTRACT_EXT              0x800A
+#define GL_FUNC_REVERSE_SUBTRACT_EXT      0x800B
+#endif
+
+#ifndef GL_EXT_blend_logic_op
+#endif
+
+#ifndef GL_SGIX_interlace
+#define GL_INTERLACE_SGIX                 0x8094
+#endif
+
+#ifndef GL_SGIX_pixel_tiles
+#define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E
+#define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F
+#define GL_PIXEL_TILE_WIDTH_SGIX          0x8140
+#define GL_PIXEL_TILE_HEIGHT_SGIX         0x8141
+#define GL_PIXEL_TILE_GRID_WIDTH_SGIX     0x8142
+#define GL_PIXEL_TILE_GRID_HEIGHT_SGIX    0x8143
+#define GL_PIXEL_TILE_GRID_DEPTH_SGIX     0x8144
+#define GL_PIXEL_TILE_CACHE_SIZE_SGIX     0x8145
+#endif
+
+#ifndef GL_SGIS_texture_select
+#define GL_DUAL_ALPHA4_SGIS               0x8110
+#define GL_DUAL_ALPHA8_SGIS               0x8111
+#define GL_DUAL_ALPHA12_SGIS              0x8112
+#define GL_DUAL_ALPHA16_SGIS              0x8113
+#define GL_DUAL_LUMINANCE4_SGIS           0x8114
+#define GL_DUAL_LUMINANCE8_SGIS           0x8115
+#define GL_DUAL_LUMINANCE12_SGIS          0x8116
+#define GL_DUAL_LUMINANCE16_SGIS          0x8117
+#define GL_DUAL_INTENSITY4_SGIS           0x8118
+#define GL_DUAL_INTENSITY8_SGIS           0x8119
+#define GL_DUAL_INTENSITY12_SGIS          0x811A
+#define GL_DUAL_INTENSITY16_SGIS          0x811B
+#define GL_DUAL_LUMINANCE_ALPHA4_SGIS     0x811C
+#define GL_DUAL_LUMINANCE_ALPHA8_SGIS     0x811D
+#define GL_QUAD_ALPHA4_SGIS               0x811E
+#define GL_QUAD_ALPHA8_SGIS               0x811F
+#define GL_QUAD_LUMINANCE4_SGIS           0x8120
+#define GL_QUAD_LUMINANCE8_SGIS           0x8121
+#define GL_QUAD_INTENSITY4_SGIS           0x8122
+#define GL_QUAD_INTENSITY8_SGIS           0x8123
+#define GL_DUAL_TEXTURE_SELECT_SGIS       0x8124
+#define GL_QUAD_TEXTURE_SELECT_SGIS       0x8125
+#endif
+
+#ifndef GL_SGIX_sprite
+#define GL_SPRITE_SGIX                    0x8148
+#define GL_SPRITE_MODE_SGIX               0x8149
+#define GL_SPRITE_AXIS_SGIX               0x814A
+#define GL_SPRITE_TRANSLATION_SGIX        0x814B
+#define GL_SPRITE_AXIAL_SGIX              0x814C
+#define GL_SPRITE_OBJECT_ALIGNED_SGIX     0x814D
+#define GL_SPRITE_EYE_ALIGNED_SGIX        0x814E
+#endif
+
+#ifndef GL_SGIX_texture_multi_buffer
+#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E
+#endif
+
+#ifndef GL_SGIS_point_parameters
+#define GL_POINT_SIZE_MIN_EXT             0x8126
+#define GL_POINT_SIZE_MIN_SGIS            0x8126
+#define GL_POINT_SIZE_MAX_EXT             0x8127
+#define GL_POINT_SIZE_MAX_SGIS            0x8127
+#define GL_POINT_FADE_THRESHOLD_SIZE_EXT  0x8128
+#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128
+#define GL_DISTANCE_ATTENUATION_EXT       0x8129
+#define GL_DISTANCE_ATTENUATION_SGIS      0x8129
+#endif
+
+#ifndef GL_SGIX_instruments
+#define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180
+#define GL_INSTRUMENT_MEASUREMENTS_SGIX   0x8181
+#endif
+
+#ifndef GL_SGIX_texture_scale_bias
+#define GL_POST_TEXTURE_FILTER_BIAS_SGIX  0x8179
+#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A
+#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B
+#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C
+#endif
+
+#ifndef GL_SGIX_framezoom
+#define GL_FRAMEZOOM_SGIX                 0x818B
+#define GL_FRAMEZOOM_FACTOR_SGIX          0x818C
+#define GL_MAX_FRAMEZOOM_FACTOR_SGIX      0x818D
+#endif
+
+#ifndef GL_SGIX_tag_sample_buffer
+#endif
+
+#ifndef GL_SGIX_reference_plane
+#define GL_REFERENCE_PLANE_SGIX           0x817D
+#define GL_REFERENCE_PLANE_EQUATION_SGIX  0x817E
+#endif
+
+#ifndef GL_SGIX_flush_raster
+#endif
+
+#ifndef GL_SGIX_depth_texture
+#define GL_DEPTH_COMPONENT16_SGIX         0x81A5
+#define GL_DEPTH_COMPONENT24_SGIX         0x81A6
+#define GL_DEPTH_COMPONENT32_SGIX         0x81A7
+#endif
+
+#ifndef GL_SGIS_fog_function
+#define GL_FOG_FUNC_SGIS                  0x812A
+#define GL_FOG_FUNC_POINTS_SGIS           0x812B
+#define GL_MAX_FOG_FUNC_POINTS_SGIS       0x812C
+#endif
+
+#ifndef GL_SGIX_fog_offset
+#define GL_FOG_OFFSET_SGIX                0x8198
+#define GL_FOG_OFFSET_VALUE_SGIX          0x8199
+#endif
+
+#ifndef GL_HP_image_transform
+#define GL_IMAGE_SCALE_X_HP               0x8155
+#define GL_IMAGE_SCALE_Y_HP               0x8156
+#define GL_IMAGE_TRANSLATE_X_HP           0x8157
+#define GL_IMAGE_TRANSLATE_Y_HP           0x8158
+#define GL_IMAGE_ROTATE_ANGLE_HP          0x8159
+#define GL_IMAGE_ROTATE_ORIGIN_X_HP       0x815A
+#define GL_IMAGE_ROTATE_ORIGIN_Y_HP       0x815B
+#define GL_IMAGE_MAG_FILTER_HP            0x815C
+#define GL_IMAGE_MIN_FILTER_HP            0x815D
+#define GL_IMAGE_CUBIC_WEIGHT_HP          0x815E
+#define GL_CUBIC_HP                       0x815F
+#define GL_AVERAGE_HP                     0x8160
+#define GL_IMAGE_TRANSFORM_2D_HP          0x8161
+#define GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8162
+#define GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8163
+#endif
+
+#ifndef GL_HP_convolution_border_modes
+#define GL_IGNORE_BORDER_HP               0x8150
+#define GL_CONSTANT_BORDER_HP             0x8151
+#define GL_REPLICATE_BORDER_HP            0x8153
+#define GL_CONVOLUTION_BORDER_COLOR_HP    0x8154
+#endif
+
+#ifndef GL_INGR_palette_buffer
+#endif
+
+#ifndef GL_SGIX_texture_add_env
+#define GL_TEXTURE_ENV_BIAS_SGIX          0x80BE
+#endif
+
+#ifndef GL_EXT_color_subtable
+#endif
+
+#ifndef GL_PGI_vertex_hints
+#define GL_VERTEX_DATA_HINT_PGI           0x1A22A
+#define GL_VERTEX_CONSISTENT_HINT_PGI     0x1A22B
+#define GL_MATERIAL_SIDE_HINT_PGI         0x1A22C
+#define GL_MAX_VERTEX_HINT_PGI            0x1A22D
+#define GL_COLOR3_BIT_PGI                 0x00010000
+#define GL_COLOR4_BIT_PGI                 0x00020000
+#define GL_EDGEFLAG_BIT_PGI               0x00040000
+#define GL_INDEX_BIT_PGI                  0x00080000
+#define GL_MAT_AMBIENT_BIT_PGI            0x00100000
+#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000
+#define GL_MAT_DIFFUSE_BIT_PGI            0x00400000
+#define GL_MAT_EMISSION_BIT_PGI           0x00800000
+#define GL_MAT_COLOR_INDEXES_BIT_PGI      0x01000000
+#define GL_MAT_SHININESS_BIT_PGI          0x02000000
+#define GL_MAT_SPECULAR_BIT_PGI           0x04000000
+#define GL_NORMAL_BIT_PGI                 0x08000000
+#define GL_TEXCOORD1_BIT_PGI              0x10000000
+#define GL_TEXCOORD2_BIT_PGI              0x20000000
+#define GL_TEXCOORD3_BIT_PGI              0x40000000
+#define GL_TEXCOORD4_BIT_PGI              0x80000000
+#define GL_VERTEX23_BIT_PGI               0x00000004
+#define GL_VERTEX4_BIT_PGI                0x00000008
+#endif
+
+#ifndef GL_PGI_misc_hints
+#define GL_PREFER_DOUBLEBUFFER_HINT_PGI   0x1A1F8
+#define GL_CONSERVE_MEMORY_HINT_PGI       0x1A1FD
+#define GL_RECLAIM_MEMORY_HINT_PGI        0x1A1FE
+#define GL_NATIVE_GRAPHICS_HANDLE_PGI     0x1A202
+#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 0x1A203
+#define GL_NATIVE_GRAPHICS_END_HINT_PGI   0x1A204
+#define GL_ALWAYS_FAST_HINT_PGI           0x1A20C
+#define GL_ALWAYS_SOFT_HINT_PGI           0x1A20D
+#define GL_ALLOW_DRAW_OBJ_HINT_PGI        0x1A20E
+#define GL_ALLOW_DRAW_WIN_HINT_PGI        0x1A20F
+#define GL_ALLOW_DRAW_FRG_HINT_PGI        0x1A210
+#define GL_ALLOW_DRAW_MEM_HINT_PGI        0x1A211
+#define GL_STRICT_DEPTHFUNC_HINT_PGI      0x1A216
+#define GL_STRICT_LIGHTING_HINT_PGI       0x1A217
+#define GL_STRICT_SCISSOR_HINT_PGI        0x1A218
+#define GL_FULL_STIPPLE_HINT_PGI          0x1A219
+#define GL_CLIP_NEAR_HINT_PGI             0x1A220
+#define GL_CLIP_FAR_HINT_PGI              0x1A221
+#define GL_WIDE_LINE_HINT_PGI             0x1A222
+#define GL_BACK_NORMALS_HINT_PGI          0x1A223
+#endif
+
+#ifndef GL_EXT_paletted_texture
+#define GL_COLOR_INDEX1_EXT               0x80E2
+#define GL_COLOR_INDEX2_EXT               0x80E3
+#define GL_COLOR_INDEX4_EXT               0x80E4
+#define GL_COLOR_INDEX8_EXT               0x80E5
+#define GL_COLOR_INDEX12_EXT              0x80E6
+#define GL_COLOR_INDEX16_EXT              0x80E7
+#define GL_TEXTURE_INDEX_SIZE_EXT         0x80ED
+#endif
+
+#ifndef GL_EXT_clip_volume_hint
+#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT  0x80F0
+#endif
+
+#ifndef GL_SGIX_list_priority
+#define GL_LIST_PRIORITY_SGIX             0x8182
+#endif
+
+#ifndef GL_SGIX_ir_instrument1
+#define GL_IR_INSTRUMENT1_SGIX            0x817F
+#endif
+
+#ifndef GL_SGIX_calligraphic_fragment
+#define GL_CALLIGRAPHIC_FRAGMENT_SGIX     0x8183
+#endif
+
+#ifndef GL_SGIX_texture_lod_bias
+#define GL_TEXTURE_LOD_BIAS_S_SGIX        0x818E
+#define GL_TEXTURE_LOD_BIAS_T_SGIX        0x818F
+#define GL_TEXTURE_LOD_BIAS_R_SGIX        0x8190
+#endif
+
+#ifndef GL_SGIX_shadow_ambient
+#define GL_SHADOW_AMBIENT_SGIX            0x80BF
+#endif
+
+#ifndef GL_EXT_index_texture
+#endif
+
+#ifndef GL_EXT_index_material
+#define GL_INDEX_MATERIAL_EXT             0x81B8
+#define GL_INDEX_MATERIAL_PARAMETER_EXT   0x81B9
+#define GL_INDEX_MATERIAL_FACE_EXT        0x81BA
+#endif
+
+#ifndef GL_EXT_index_func
+#define GL_INDEX_TEST_EXT                 0x81B5
+#define GL_INDEX_TEST_FUNC_EXT            0x81B6
+#define GL_INDEX_TEST_REF_EXT             0x81B7
+#endif
+
+#ifndef GL_EXT_index_array_formats
+#define GL_IUI_V2F_EXT                    0x81AD
+#define GL_IUI_V3F_EXT                    0x81AE
+#define GL_IUI_N3F_V2F_EXT                0x81AF
+#define GL_IUI_N3F_V3F_EXT                0x81B0
+#define GL_T2F_IUI_V2F_EXT                0x81B1
+#define GL_T2F_IUI_V3F_EXT                0x81B2
+#define GL_T2F_IUI_N3F_V2F_EXT            0x81B3
+#define GL_T2F_IUI_N3F_V3F_EXT            0x81B4
+#endif
+
+#ifndef GL_EXT_compiled_vertex_array
+#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT   0x81A8
+#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT   0x81A9
+#endif
+
+#ifndef GL_EXT_cull_vertex
+#define GL_CULL_VERTEX_EXT                0x81AA
+#define GL_CULL_VERTEX_EYE_POSITION_EXT   0x81AB
+#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC
+#endif
+
+#ifndef GL_SGIX_ycrcb
+#define GL_YCRCB_422_SGIX                 0x81BB
+#define GL_YCRCB_444_SGIX                 0x81BC
+#endif
+
+#ifndef GL_SGIX_fragment_lighting
+#define GL_FRAGMENT_LIGHTING_SGIX         0x8400
+#define GL_FRAGMENT_COLOR_MATERIAL_SGIX   0x8401
+#define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402
+#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403
+#define GL_MAX_FRAGMENT_LIGHTS_SGIX       0x8404
+#define GL_MAX_ACTIVE_LIGHTS_SGIX         0x8405
+#define GL_CURRENT_RASTER_NORMAL_SGIX     0x8406
+#define GL_LIGHT_ENV_MODE_SGIX            0x8407
+#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408
+#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409
+#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A
+#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B
+#define GL_FRAGMENT_LIGHT0_SGIX           0x840C
+#define GL_FRAGMENT_LIGHT1_SGIX           0x840D
+#define GL_FRAGMENT_LIGHT2_SGIX           0x840E
+#define GL_FRAGMENT_LIGHT3_SGIX           0x840F
+#define GL_FRAGMENT_LIGHT4_SGIX           0x8410
+#define GL_FRAGMENT_LIGHT5_SGIX           0x8411
+#define GL_FRAGMENT_LIGHT6_SGIX           0x8412
+#define GL_FRAGMENT_LIGHT7_SGIX           0x8413
+#endif
+
+#ifndef GL_IBM_rasterpos_clip
+#define GL_RASTER_POSITION_UNCLIPPED_IBM  0x19262
+#endif
+
+#ifndef GL_HP_texture_lighting
+#define GL_TEXTURE_LIGHTING_MODE_HP       0x8167
+#define GL_TEXTURE_POST_SPECULAR_HP       0x8168
+#define GL_TEXTURE_PRE_SPECULAR_HP        0x8169
+#endif
+
+#ifndef GL_EXT_draw_range_elements
+#define GL_MAX_ELEMENTS_VERTICES_EXT      0x80E8
+#define GL_MAX_ELEMENTS_INDICES_EXT       0x80E9
+#endif
+
+#ifndef GL_WIN_phong_shading
+#define GL_PHONG_WIN                      0x80EA
+#define GL_PHONG_HINT_WIN                 0x80EB
+#endif
+
+#ifndef GL_WIN_specular_fog
+#define GL_FOG_SPECULAR_TEXTURE_WIN       0x80EC
+#endif
+
+#ifndef GL_EXT_light_texture
+#define GL_FRAGMENT_MATERIAL_EXT          0x8349
+#define GL_FRAGMENT_NORMAL_EXT            0x834A
+#define GL_FRAGMENT_COLOR_EXT             0x834C
+#define GL_ATTENUATION_EXT                0x834D
+#define GL_SHADOW_ATTENUATION_EXT         0x834E
+#define GL_TEXTURE_APPLICATION_MODE_EXT   0x834F
+#define GL_TEXTURE_LIGHT_EXT              0x8350
+#define GL_TEXTURE_MATERIAL_FACE_EXT      0x8351
+#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352
+/* reuse GL_FRAGMENT_DEPTH_EXT */
+#endif
+
+#ifndef GL_SGIX_blend_alpha_minmax
+#define GL_ALPHA_MIN_SGIX                 0x8320
+#define GL_ALPHA_MAX_SGIX                 0x8321
+#endif
+
+#ifndef GL_EXT_bgra
+#define GL_BGR_EXT                        0x80E0
+#define GL_BGRA_EXT                       0x80E1
+#endif
+
+#ifndef GL_INTEL_texture_scissor
+#endif
+
+#ifndef GL_INTEL_parallel_arrays
+#define GL_PARALLEL_ARRAYS_INTEL          0x83F4
+#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5
+#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6
+#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7
+#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8
+#endif
+
+#ifndef GL_HP_occlusion_test
+#define GL_OCCLUSION_TEST_HP              0x8165
+#define GL_OCCLUSION_TEST_RESULT_HP       0x8166
+#endif
+
+#ifndef GL_EXT_pixel_transform
+#define GL_PIXEL_TRANSFORM_2D_EXT         0x8330
+#define GL_PIXEL_MAG_FILTER_EXT           0x8331
+#define GL_PIXEL_MIN_FILTER_EXT           0x8332
+#define GL_PIXEL_CUBIC_WEIGHT_EXT         0x8333
+#define GL_CUBIC_EXT                      0x8334
+#define GL_AVERAGE_EXT                    0x8335
+#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336
+#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337
+#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT  0x8338
+#endif
+
+#ifndef GL_EXT_pixel_transform_color_table
+#endif
+
+#ifndef GL_EXT_shared_texture_palette
+#define GL_SHARED_TEXTURE_PALETTE_EXT     0x81FB
+#endif
+
+#ifndef GL_EXT_separate_specular_color
+#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT  0x81F8
+#define GL_SINGLE_COLOR_EXT               0x81F9
+#define GL_SEPARATE_SPECULAR_COLOR_EXT    0x81FA
+#endif
+
+#ifndef GL_EXT_secondary_color
+#define GL_COLOR_SUM_EXT                  0x8458
+#define GL_CURRENT_SECONDARY_COLOR_EXT    0x8459
+#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A
+#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B
+#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C
+#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D
+#define GL_SECONDARY_COLOR_ARRAY_EXT      0x845E
+#endif
+
+#ifndef GL_EXT_texture_perturb_normal
+#define GL_PERTURB_EXT                    0x85AE
+#define GL_TEXTURE_NORMAL_EXT             0x85AF
+#endif
+
+#ifndef GL_EXT_multi_draw_arrays
+#endif
+
+#ifndef GL_EXT_fog_coord
+#define GL_FOG_COORDINATE_SOURCE_EXT      0x8450
+#define GL_FOG_COORDINATE_EXT             0x8451
+#define GL_FRAGMENT_DEPTH_EXT             0x8452
+#define GL_CURRENT_FOG_COORDINATE_EXT     0x8453
+#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT  0x8454
+#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455
+#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456
+#define GL_FOG_COORDINATE_ARRAY_EXT       0x8457
+#endif
+
+#ifndef GL_REND_screen_coordinates
+#define GL_SCREEN_COORDINATES_REND        0x8490
+#define GL_INVERTED_SCREEN_W_REND         0x8491
+#endif
+
+#ifndef GL_EXT_coordinate_frame
+#define GL_TANGENT_ARRAY_EXT              0x8439
+#define GL_BINORMAL_ARRAY_EXT             0x843A
+#define GL_CURRENT_TANGENT_EXT            0x843B
+#define GL_CURRENT_BINORMAL_EXT           0x843C
+#define GL_TANGENT_ARRAY_TYPE_EXT         0x843E
+#define GL_TANGENT_ARRAY_STRIDE_EXT       0x843F
+#define GL_BINORMAL_ARRAY_TYPE_EXT        0x8440
+#define GL_BINORMAL_ARRAY_STRIDE_EXT      0x8441
+#define GL_TANGENT_ARRAY_POINTER_EXT      0x8442
+#define GL_BINORMAL_ARRAY_POINTER_EXT     0x8443
+#define GL_MAP1_TANGENT_EXT               0x8444
+#define GL_MAP2_TANGENT_EXT               0x8445
+#define GL_MAP1_BINORMAL_EXT              0x8446
+#define GL_MAP2_BINORMAL_EXT              0x8447
+#endif
+
+#ifndef GL_EXT_texture_env_combine
+#define GL_COMBINE_EXT                    0x8570
+#define GL_COMBINE_RGB_EXT                0x8571
+#define GL_COMBINE_ALPHA_EXT              0x8572
+#define GL_RGB_SCALE_EXT                  0x8573
+#define GL_ADD_SIGNED_EXT                 0x8574
+#define GL_INTERPOLATE_EXT                0x8575
+#define GL_CONSTANT_EXT                   0x8576
+#define GL_PRIMARY_COLOR_EXT              0x8577
+#define GL_PREVIOUS_EXT                   0x8578
+#define GL_SOURCE0_RGB_EXT                0x8580
+#define GL_SOURCE1_RGB_EXT                0x8581
+#define GL_SOURCE2_RGB_EXT                0x8582
+#define GL_SOURCE3_RGB_EXT                0x8583
+#define GL_SOURCE4_RGB_EXT                0x8584
+#define GL_SOURCE5_RGB_EXT                0x8585
+#define GL_SOURCE6_RGB_EXT                0x8586
+#define GL_SOURCE7_RGB_EXT                0x8587
+#define GL_SOURCE0_ALPHA_EXT              0x8588
+#define GL_SOURCE1_ALPHA_EXT              0x8589
+#define GL_SOURCE2_ALPHA_EXT              0x858A
+#define GL_SOURCE3_ALPHA_EXT              0x858B
+#define GL_SOURCE4_ALPHA_EXT              0x858C
+#define GL_SOURCE5_ALPHA_EXT              0x858D
+#define GL_SOURCE6_ALPHA_EXT              0x858E
+#define GL_SOURCE7_ALPHA_EXT              0x858F
+#define GL_OPERAND0_RGB_EXT               0x8590
+#define GL_OPERAND1_RGB_EXT               0x8591
+#define GL_OPERAND2_RGB_EXT               0x8592
+#define GL_OPERAND3_RGB_EXT               0x8593
+#define GL_OPERAND4_RGB_EXT               0x8594
+#define GL_OPERAND5_RGB_EXT               0x8595
+#define GL_OPERAND6_RGB_EXT               0x8596
+#define GL_OPERAND7_RGB_EXT               0x8597
+#define GL_OPERAND0_ALPHA_EXT             0x8598
+#define GL_OPERAND1_ALPHA_EXT             0x8599
+#define GL_OPERAND2_ALPHA_EXT             0x859A
+#define GL_OPERAND3_ALPHA_EXT             0x859B
+#define GL_OPERAND4_ALPHA_EXT             0x859C
+#define GL_OPERAND5_ALPHA_EXT             0x859D
+#define GL_OPERAND6_ALPHA_EXT             0x859E
+#define GL_OPERAND7_ALPHA_EXT             0x859F
+#endif
+
+#ifndef GL_APPLE_specular_vector
+#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0
+#endif
+
+#ifndef GL_APPLE_transform_hint
+#define GL_TRANSFORM_HINT_APPLE           0x85B1
+#endif
+
+#ifndef GL_SGIX_fog_scale
+#define GL_FOG_SCALE_SGIX                 0x81FC
+#define GL_FOG_SCALE_VALUE_SGIX           0x81FD
+#endif
+
+#ifndef GL_SUNX_constant_data
+#define GL_UNPACK_CONSTANT_DATA_SUNX      0x81D5
+#define GL_TEXTURE_CONSTANT_DATA_SUNX     0x81D6
+#endif
+
+#ifndef GL_SUN_global_alpha
+#define GL_GLOBAL_ALPHA_SUN               0x81D9
+#define GL_GLOBAL_ALPHA_FACTOR_SUN        0x81DA
+#endif
+
+#ifndef GL_SUN_triangle_list
+#define GL_RESTART_SUN                    0x01
+#define GL_REPLACE_MIDDLE_SUN             0x02
+#define GL_REPLACE_OLDEST_SUN             0x03
+#define GL_TRIANGLE_LIST_SUN              0x81D7
+#define GL_REPLACEMENT_CODE_SUN           0x81D8
+#define GL_REPLACEMENT_CODE_ARRAY_SUN     0x85C0
+#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1
+#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2
+#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3
+#define GL_R1UI_V3F_SUN                   0x85C4
+#define GL_R1UI_C4UB_V3F_SUN              0x85C5
+#define GL_R1UI_C3F_V3F_SUN               0x85C6
+#define GL_R1UI_N3F_V3F_SUN               0x85C7
+#define GL_R1UI_C4F_N3F_V3F_SUN           0x85C8
+#define GL_R1UI_T2F_V3F_SUN               0x85C9
+#define GL_R1UI_T2F_N3F_V3F_SUN           0x85CA
+#define GL_R1UI_T2F_C4F_N3F_V3F_SUN       0x85CB
+#endif
+
+#ifndef GL_SUN_vertex
+#endif
+
+#ifndef GL_EXT_blend_func_separate
+#define GL_BLEND_DST_RGB_EXT              0x80C8
+#define GL_BLEND_SRC_RGB_EXT              0x80C9
+#define GL_BLEND_DST_ALPHA_EXT            0x80CA
+#define GL_BLEND_SRC_ALPHA_EXT            0x80CB
+#endif
+
+#ifndef GL_INGR_color_clamp
+#define GL_RED_MIN_CLAMP_INGR             0x8560
+#define GL_GREEN_MIN_CLAMP_INGR           0x8561
+#define GL_BLUE_MIN_CLAMP_INGR            0x8562
+#define GL_ALPHA_MIN_CLAMP_INGR           0x8563
+#define GL_RED_MAX_CLAMP_INGR             0x8564
+#define GL_GREEN_MAX_CLAMP_INGR           0x8565
+#define GL_BLUE_MAX_CLAMP_INGR            0x8566
+#define GL_ALPHA_MAX_CLAMP_INGR           0x8567
+#endif
+
+#ifndef GL_INGR_interlace_read
+#define GL_INTERLACE_READ_INGR            0x8568
+#endif
+
+#ifndef GL_EXT_stencil_wrap
+#define GL_INCR_WRAP_EXT                  0x8507
+#define GL_DECR_WRAP_EXT                  0x8508
+#endif
+
+#ifndef GL_EXT_422_pixels
+#define GL_422_EXT                        0x80CC
+#define GL_422_REV_EXT                    0x80CD
+#define GL_422_AVERAGE_EXT                0x80CE
+#define GL_422_REV_AVERAGE_EXT            0x80CF
+#endif
+
+#ifndef GL_NV_texgen_reflection
+#define GL_NORMAL_MAP_NV                  0x8511
+#define GL_REFLECTION_MAP_NV              0x8512
+#endif
+
+#ifndef GL_EXT_texture_cube_map
+#define GL_NORMAL_MAP_EXT                 0x8511
+#define GL_REFLECTION_MAP_EXT             0x8512
+#define GL_TEXTURE_CUBE_MAP_EXT           0x8513
+#define GL_TEXTURE_BINDING_CUBE_MAP_EXT   0x8514
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A
+#define GL_PROXY_TEXTURE_CUBE_MAP_EXT     0x851B
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT  0x851C
+#endif
+
+#ifndef GL_SUN_convolution_border_modes
+#define GL_WRAP_BORDER_SUN                0x81D4
+#endif
+
+#ifndef GL_EXT_texture_env_add
+#endif
+
+#ifndef GL_EXT_texture_lod_bias
+#define GL_MAX_TEXTURE_LOD_BIAS_EXT       0x84FD
+#define GL_TEXTURE_FILTER_CONTROL_EXT     0x8500
+#define GL_TEXTURE_LOD_BIAS_EXT           0x8501
+#endif
+
+#ifndef GL_EXT_texture_filter_anisotropic
+#define GL_TEXTURE_MAX_ANISOTROPY_EXT     0x84FE
+#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
+#endif
+
+#ifndef GL_EXT_vertex_weighting
+#define GL_MODELVIEW0_STACK_DEPTH_EXT     GL_MODELVIEW_STACK_DEPTH
+#define GL_MODELVIEW1_STACK_DEPTH_EXT     0x8502
+#define GL_MODELVIEW0_MATRIX_EXT          GL_MODELVIEW_MATRIX
+#define GL_MODELVIEW_MATRIX1_EXT          0x8506
+#define GL_VERTEX_WEIGHTING_EXT           0x8509
+#define GL_MODELVIEW0_EXT                 GL_MODELVIEW
+#define GL_MODELVIEW1_EXT                 0x850A
+#define GL_CURRENT_VERTEX_WEIGHT_EXT      0x850B
+#define GL_VERTEX_WEIGHT_ARRAY_EXT        0x850C
+#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT   0x850D
+#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT   0x850E
+#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F
+#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510
+#endif
+
+#ifndef GL_NV_light_max_exponent
+#define GL_MAX_SHININESS_NV               0x8504
+#define GL_MAX_SPOT_EXPONENT_NV           0x8505
+#endif
+
+#ifndef GL_NV_vertex_array_range
+#define GL_VERTEX_ARRAY_RANGE_NV          0x851D
+#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV   0x851E
+#define GL_VERTEX_ARRAY_RANGE_VALID_NV    0x851F
+#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520
+#define GL_VERTEX_ARRAY_RANGE_POINTER_NV  0x8521
+#endif
+
+#ifndef GL_NV_vertex_array_range2
+#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533
+#endif
+
+#ifndef GL_NV_register_combiners
+#define GL_REGISTER_COMBINERS_NV          0x8522
+#define GL_VARIABLE_A_NV                  0x8523
+#define GL_VARIABLE_B_NV                  0x8524
+#define GL_VARIABLE_C_NV                  0x8525
+#define GL_VARIABLE_D_NV                  0x8526
+#define GL_VARIABLE_E_NV                  0x8527
+#define GL_VARIABLE_F_NV                  0x8528
+#define GL_VARIABLE_G_NV                  0x8529
+#define GL_CONSTANT_COLOR0_NV             0x852A
+#define GL_CONSTANT_COLOR1_NV             0x852B
+#define GL_PRIMARY_COLOR_NV               0x852C
+#define GL_SECONDARY_COLOR_NV             0x852D
+#define GL_SPARE0_NV                      0x852E
+#define GL_SPARE1_NV                      0x852F
+#define GL_DISCARD_NV                     0x8530
+#define GL_E_TIMES_F_NV                   0x8531
+#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532
+#define GL_UNSIGNED_IDENTITY_NV           0x8536
+#define GL_UNSIGNED_INVERT_NV             0x8537
+#define GL_EXPAND_NORMAL_NV               0x8538
+#define GL_EXPAND_NEGATE_NV               0x8539
+#define GL_HALF_BIAS_NORMAL_NV            0x853A
+#define GL_HALF_BIAS_NEGATE_NV            0x853B
+#define GL_SIGNED_IDENTITY_NV             0x853C
+#define GL_SIGNED_NEGATE_NV               0x853D
+#define GL_SCALE_BY_TWO_NV                0x853E
+#define GL_SCALE_BY_FOUR_NV               0x853F
+#define GL_SCALE_BY_ONE_HALF_NV           0x8540
+#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV   0x8541
+#define GL_COMBINER_INPUT_NV              0x8542
+#define GL_COMBINER_MAPPING_NV            0x8543
+#define GL_COMBINER_COMPONENT_USAGE_NV    0x8544
+#define GL_COMBINER_AB_DOT_PRODUCT_NV     0x8545
+#define GL_COMBINER_CD_DOT_PRODUCT_NV     0x8546
+#define GL_COMBINER_MUX_SUM_NV            0x8547
+#define GL_COMBINER_SCALE_NV              0x8548
+#define GL_COMBINER_BIAS_NV               0x8549
+#define GL_COMBINER_AB_OUTPUT_NV          0x854A
+#define GL_COMBINER_CD_OUTPUT_NV          0x854B
+#define GL_COMBINER_SUM_OUTPUT_NV         0x854C
+#define GL_MAX_GENERAL_COMBINERS_NV       0x854D
+#define GL_NUM_GENERAL_COMBINERS_NV       0x854E
+#define GL_COLOR_SUM_CLAMP_NV             0x854F
+#define GL_COMBINER0_NV                   0x8550
+#define GL_COMBINER1_NV                   0x8551
+#define GL_COMBINER2_NV                   0x8552
+#define GL_COMBINER3_NV                   0x8553
+#define GL_COMBINER4_NV                   0x8554
+#define GL_COMBINER5_NV                   0x8555
+#define GL_COMBINER6_NV                   0x8556
+#define GL_COMBINER7_NV                   0x8557
+/* reuse GL_TEXTURE0_ARB */
+/* reuse GL_TEXTURE1_ARB */
+/* reuse GL_ZERO */
+/* reuse GL_NONE */
+/* reuse GL_FOG */
+#endif
+
+#ifndef GL_NV_fog_distance
+#define GL_FOG_DISTANCE_MODE_NV           0x855A
+#define GL_EYE_RADIAL_NV                  0x855B
+#define GL_EYE_PLANE_ABSOLUTE_NV          0x855C
+/* reuse GL_EYE_PLANE */
+#endif
+
+#ifndef GL_NV_texgen_emboss
+#define GL_EMBOSS_LIGHT_NV                0x855D
+#define GL_EMBOSS_CONSTANT_NV             0x855E
+#define GL_EMBOSS_MAP_NV                  0x855F
+#endif
+
+#ifndef GL_NV_blend_square
+#endif
+
+#ifndef GL_NV_texture_env_combine4
+#define GL_COMBINE4_NV                    0x8503
+#define GL_SOURCE3_RGB_NV                 0x8583
+#define GL_SOURCE3_ALPHA_NV               0x858B
+#define GL_OPERAND3_RGB_NV                0x8593
+#define GL_OPERAND3_ALPHA_NV              0x859B
+#endif
+
+
+#ifndef GL_MESA_resize_buffers
+#endif
+
+#ifndef GL_MESA_window_pos
+#endif
+
+#ifndef GL_EXT_texture_compression_s3tc
+#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT   0x83F0
+#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT  0x83F1
+#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT  0x83F2
+#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT  0x83F3
+#endif
+
+#ifndef GL_IBM_cull_vertex
+#define GL_CULL_VERTEX_IBM                103050
+#endif
+
+#ifndef GL_IBM_multimode_draw_arrays
+#endif
+
+#ifndef GL_IBM_vertex_array_lists
+#define GL_VERTEX_ARRAY_LIST_IBM          103070
+#define GL_NORMAL_ARRAY_LIST_IBM          103071
+#define GL_COLOR_ARRAY_LIST_IBM           103072
+#define GL_INDEX_ARRAY_LIST_IBM           103073
+#define GL_TEXTURE_COORD_ARRAY_LIST_IBM   103074
+#define GL_EDGE_FLAG_ARRAY_LIST_IBM       103075
+#define GL_FOG_COORDINATE_ARRAY_LIST_IBM  103076
+#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077
+#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM   103080
+#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM   103081
+#define GL_COLOR_ARRAY_LIST_STRIDE_IBM    103082
+#define GL_INDEX_ARRAY_LIST_STRIDE_IBM    103083
+#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084
+#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085
+#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086
+#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087
+#endif
+
+#ifndef GL_SGIX_subsample
+#define GL_PACK_SUBSAMPLE_RATE_SGIX       0x85A0
+#define GL_UNPACK_SUBSAMPLE_RATE_SGIX     0x85A1
+#define GL_PIXEL_SUBSAMPLE_4444_SGIX      0x85A2
+#define GL_PIXEL_SUBSAMPLE_2424_SGIX      0x85A3
+#define GL_PIXEL_SUBSAMPLE_4242_SGIX      0x85A4
+#endif
+
+#ifndef GL_SGIX_ycrcb_subsample
+#endif
+
+#ifndef GL_SGIX_ycrcba
+#define GL_YCRCB_SGIX                     0x8318
+#define GL_YCRCBA_SGIX                    0x8319
+#endif
+
+#ifndef GL_SGI_depth_pass_instrument
+#define GL_DEPTH_PASS_INSTRUMENT_SGIX     0x8310
+#define GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX 0x8311
+#define GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX 0x8312
+#endif
+
+#ifndef GL_3DFX_texture_compression_FXT1
+#define GL_COMPRESSED_RGB_FXT1_3DFX       0x86B0
+#define GL_COMPRESSED_RGBA_FXT1_3DFX      0x86B1
+#endif
+
+#ifndef GL_3DFX_multisample
+#define GL_MULTISAMPLE_3DFX               0x86B2
+#define GL_SAMPLE_BUFFERS_3DFX            0x86B3
+#define GL_SAMPLES_3DFX                   0x86B4
+#define GL_MULTISAMPLE_BIT_3DFX           0x20000000
+#endif
+
+#ifndef GL_3DFX_tbuffer
+#endif
+
+#ifndef GL_EXT_multisample
+#define GL_MULTISAMPLE_EXT                0x809D
+#define GL_SAMPLE_ALPHA_TO_MASK_EXT       0x809E
+#define GL_SAMPLE_ALPHA_TO_ONE_EXT        0x809F
+#define GL_SAMPLE_MASK_EXT                0x80A0
+#define GL_1PASS_EXT                      0x80A1
+#define GL_2PASS_0_EXT                    0x80A2
+#define GL_2PASS_1_EXT                    0x80A3
+#define GL_4PASS_0_EXT                    0x80A4
+#define GL_4PASS_1_EXT                    0x80A5
+#define GL_4PASS_2_EXT                    0x80A6
+#define GL_4PASS_3_EXT                    0x80A7
+#define GL_SAMPLE_BUFFERS_EXT             0x80A8
+#define GL_SAMPLES_EXT                    0x80A9
+#define GL_SAMPLE_MASK_VALUE_EXT          0x80AA
+#define GL_SAMPLE_MASK_INVERT_EXT         0x80AB
+#define GL_SAMPLE_PATTERN_EXT             0x80AC
+#endif
+
+#ifndef GL_SGIX_vertex_preclip
+#define GL_VERTEX_PRECLIP_SGIX            0x83EE
+#define GL_VERTEX_PRECLIP_HINT_SGIX       0x83EF
+#endif
+
+#ifndef GL_SGIX_convolution_accuracy
+#define GL_CONVOLUTION_HINT_SGIX          0x8316
+#endif
+
+#ifndef GL_SGIX_resample
+#define GL_PACK_RESAMPLE_SGIX             0x842C
+#define GL_UNPACK_RESAMPLE_SGIX           0x842D
+#define GL_RESAMPLE_REPLICATE_SGIX        0x842E
+#define GL_RESAMPLE_ZERO_FILL_SGIX        0x842F
+#define GL_RESAMPLE_DECIMATE_SGIX         0x8430
+#endif
+
+#ifndef GL_SGIS_point_line_texgen
+#define GL_EYE_DISTANCE_TO_POINT_SGIS     0x81F0
+#define GL_OBJECT_DISTANCE_TO_POINT_SGIS  0x81F1
+#define GL_EYE_DISTANCE_TO_LINE_SGIS      0x81F2
+#define GL_OBJECT_DISTANCE_TO_LINE_SGIS   0x81F3
+#define GL_EYE_POINT_SGIS                 0x81F4
+#define GL_OBJECT_POINT_SGIS              0x81F5
+#define GL_EYE_LINE_SGIS                  0x81F6
+#define GL_OBJECT_LINE_SGIS               0x81F7
+#endif
+
+#ifndef GL_SGIS_texture_color_mask
+#define GL_TEXTURE_COLOR_WRITEMASK_SGIS   0x81EF
+#endif
+
+
+/*************************************************************/
+
+#ifndef GL_VERSION_1_2
+#define GL_VERSION_1_2 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.BlendColor (GLclampf, GLclampf, GLclampf, GLclampf);
+extern void APIENTRY chromium.BlendEquation (GLenum);
+extern void APIENTRY chromium.DrawRangeElements (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *);
+extern void APIENTRY chromium.ColorTable (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
+extern void APIENTRY chromium.ColorTableParameterfv (GLenum, GLenum, const GLfloat *);
+extern void APIENTRY chromium.ColorTableParameteriv (GLenum, GLenum, const GLint *);
+extern void APIENTRY chromium.CopyColorTable (GLenum, GLenum, GLint, GLint, GLsizei);
+extern void APIENTRY chromium.GetColorTable (GLenum, GLenum, GLenum, GLvoid *);
+extern void APIENTRY chromium.GetColorTableParameterfv (GLenum, GLenum, GLfloat *);
+extern void APIENTRY chromium.GetColorTableParameteriv (GLenum, GLenum, GLint *);
+extern void APIENTRY chromium.ColorSubTable (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
+extern void APIENTRY chromium.CopyColorSubTable (GLenum, GLsizei, GLint, GLint, GLsizei);
+extern void APIENTRY chromium.ConvolutionFilter1D (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
+extern void APIENTRY chromium.ConvolutionFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
+extern void APIENTRY chromium.ConvolutionParameterf (GLenum, GLenum, GLfloat);
+extern void APIENTRY chromium.ConvolutionParameterfv (GLenum, GLenum, const GLfloat *);
+extern void APIENTRY chromium.ConvolutionParameteri (GLenum, GLenum, GLint);
+extern void APIENTRY chromium.ConvolutionParameteriv (GLenum, GLenum, const GLint *);
+extern void APIENTRY chromium.CopyConvolutionFilter1D (GLenum, GLenum, GLint, GLint, GLsizei);
+extern void APIENTRY chromium.CopyConvolutionFilter2D (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei);
+extern void APIENTRY chromium.GetConvolutionFilter (GLenum, GLenum, GLenum, GLvoid *);
+extern void APIENTRY chromium.GetConvolutionParameterfv (GLenum, GLenum, GLfloat *);
+extern void APIENTRY chromium.GetConvolutionParameteriv (GLenum, GLenum, GLint *);
+extern void APIENTRY chromium.GetSeparableFilter (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *);
+extern void APIENTRY chromium.SeparableFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *);
+extern void APIENTRY chromium.GetHistogram (GLenum, GLboolean, GLenum, GLenum, GLvoid *);
+extern void APIENTRY chromium.GetHistogramParameterfv (GLenum, GLenum, GLfloat *);
+extern void APIENTRY chromium.GetHistogramParameteriv (GLenum, GLenum, GLint *);
+extern void APIENTRY chromium.GetMinmax (GLenum, GLboolean, GLenum, GLenum, GLvoid *);
+extern void APIENTRY chromium.GetMinmaxParameterfv (GLenum, GLenum, GLfloat *);
+extern void APIENTRY chromium.GetMinmaxParameteriv (GLenum, GLenum, GLint *);
+extern void APIENTRY chromium.Histogram (GLenum, GLsizei, GLenum, GLboolean);
+extern void APIENTRY chromium.Minmax (GLenum, GLenum, GLboolean);
+extern void APIENTRY chromium.ResetHistogram (GLenum);
+extern void APIENTRY chromium.ResetMinmax (GLenum);
+extern void APIENTRY chromium.TexImage3D (GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
+extern void APIENTRY chromium.TexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
+extern void APIENTRY chromium.CopyTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+typedef void (APIENTRY * PFNGLBLENDEQUATIONPROC) (GLenum mode);
+typedef void (APIENTRY * PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
+typedef void (APIENTRY * PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
+typedef void (APIENTRY * PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
+typedef void (APIENTRY * PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRY * PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
+typedef void (APIENTRY * PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table);
+typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRY * PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
+typedef void (APIENTRY * PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
+typedef void (APIENTRY * PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);
+typedef void (APIENTRY * PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);
+typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params);
+typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
+typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params);
+typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRY * PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
+typedef void (APIENTRY * PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (APIENTRY * PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image);
+typedef void (APIENTRY * PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRY * PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);
+typedef void (APIENTRY * PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
+typedef void (APIENTRY * PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
+typedef void (APIENTRY * PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRY * PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
+typedef void (APIENTRY * PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRY * PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
+typedef void (APIENTRY * PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink);
+typedef void (APIENTRY * PFNGLRESETHISTOGRAMPROC) (GLenum target);
+typedef void (APIENTRY * PFNGLRESETMINMAXPROC) (GLenum target);
+typedef void (APIENTRY * PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRY * PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRY * PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+#endif
+
+#ifndef GL_ARB_multitexture
+#define GL_ARB_multitexture 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.ActiveTextureARB (GLenum);
+extern void APIENTRY chromium.ClientActiveTextureARB (GLenum);
+extern void APIENTRY chromium.MultiTexCoord1dARB (GLenum, GLdouble);
+extern void APIENTRY chromium.MultiTexCoord1dvARB (GLenum, const GLdouble *);
+extern void APIENTRY chromium.MultiTexCoord1fARB (GLenum, GLfloat);
+extern void APIENTRY chromium.MultiTexCoord1fvARB (GLenum, const GLfloat *);
+extern void APIENTRY chromium.MultiTexCoord1iARB (GLenum, GLint);
+extern void APIENTRY chromium.MultiTexCoord1ivARB (GLenum, const GLint *);
+extern void APIENTRY chromium.MultiTexCoord1sARB (GLenum, GLshort);
+extern void APIENTRY chromium.MultiTexCoord1svARB (GLenum, const GLshort *);
+extern void APIENTRY chromium.MultiTexCoord2dARB (GLenum, GLdouble, GLdouble);
+extern void APIENTRY chromium.MultiTexCoord2dvARB (GLenum, const GLdouble *);
+extern void APIENTRY chromium.MultiTexCoord2fARB (GLenum, GLfloat, GLfloat);
+extern void APIENTRY chromium.MultiTexCoord2fvARB (GLenum, const GLfloat *);
+extern void APIENTRY chromium.MultiTexCoord2iARB (GLenum, GLint, GLint);
+extern void APIENTRY chromium.MultiTexCoord2ivARB (GLenum, const GLint *);
+extern void APIENTRY chromium.MultiTexCoord2sARB (GLenum, GLshort, GLshort);
+extern void APIENTRY chromium.MultiTexCoord2svARB (GLenum, const GLshort *);
+extern void APIENTRY chromium.MultiTexCoord3dARB (GLenum, GLdouble, GLdouble, GLdouble);
+extern void APIENTRY chromium.MultiTexCoord3dvARB (GLenum, const GLdouble *);
+extern void APIENTRY chromium.MultiTexCoord3fARB (GLenum, GLfloat, GLfloat, GLfloat);
+extern void APIENTRY chromium.MultiTexCoord3fvARB (GLenum, const GLfloat *);
+extern void APIENTRY chromium.MultiTexCoord3iARB (GLenum, GLint, GLint, GLint);
+extern void APIENTRY chromium.MultiTexCoord3ivARB (GLenum, const GLint *);
+extern void APIENTRY chromium.MultiTexCoord3sARB (GLenum, GLshort, GLshort, GLshort);
+extern void APIENTRY chromium.MultiTexCoord3svARB (GLenum, const GLshort *);
+extern void APIENTRY chromium.MultiTexCoord4dARB (GLenum, GLdouble, GLdouble, GLdouble, GLdouble);
+extern void APIENTRY chromium.MultiTexCoord4dvARB (GLenum, const GLdouble *);
+extern void APIENTRY chromium.MultiTexCoord4fARB (GLenum, GLfloat, GLfloat, GLfloat, GLfloat);
+extern void APIENTRY chromium.MultiTexCoord4fvARB (GLenum, const GLfloat *);
+extern void APIENTRY chromium.MultiTexCoord4iARB (GLenum, GLint, GLint, GLint, GLint);
+extern void APIENTRY chromium.MultiTexCoord4ivARB (GLenum, const GLint *);
+extern void APIENTRY chromium.MultiTexCoord4sARB (GLenum, GLshort, GLshort, GLshort, GLshort);
+extern void APIENTRY chromium.MultiTexCoord4svARB (GLenum, const GLshort *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum texture);
+typedef void (APIENTRY * PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v);
+#endif
+
+#ifndef GL_ARB_transpose_matrix
+#define GL_ARB_transpose_matrix 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.LoadTransposeMatrixfARB (const GLfloat *);
+extern void APIENTRY chromium.LoadTransposeMatrixdARB (const GLdouble *);
+extern void APIENTRY chromium.MultTransposeMatrixfARB (const GLfloat *);
+extern void APIENTRY chromium.MultTransposeMatrixdARB (const GLdouble *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLLOADTRANSPOSEMATRIXFARBPROC) (const GLfloat *m);
+typedef void (APIENTRY * PFNGLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m);
+typedef void (APIENTRY * PFNGLMULTTRANSPOSEMATRIXFARBPROC) (const GLfloat *m);
+typedef void (APIENTRY * PFNGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m);
+#endif
+
+#ifndef GL_ARB_multisample
+#define GL_ARB_multisample 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.SampleCoverageARB (GLclampf, GLboolean);
+extern void APIENTRY chromium.SamplePassARB (GLenum);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert);
+typedef void (APIENTRY * PFNGLSAMPLEPASSARBPROC) (GLenum pass);
+#endif
+
+#ifndef GL_ARB_texture_env_add
+#define GL_ARB_texture_env_add 1
+#endif
+
+#ifndef GL_ARB_texture_cube_map
+#define GL_ARB_texture_cube_map 1
+#endif
+
+#ifndef GL_ARB_texture_compression
+#define GL_ARB_texture_compression 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.CompressedTexImage3DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
+extern void APIENTRY chromium.CompressedTexImage2DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
+extern void APIENTRY chromium.CompressedTexImage1DARB (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *);
+extern void APIENTRY chromium.CompressedTexSubImage3DARB (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
+extern void APIENTRY chromium.CompressedTexSubImage2DARB (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
+extern void APIENTRY chromium.CompressedTexSubImage1DARB (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *);
+extern void APIENTRY chromium.GetCompressedTexImageARB (GLenum, GLint, void *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRY * PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRY * PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRY * PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, void *img);
+#endif
+
+#ifndef GL_EXT_abgr
+#define GL_EXT_abgr 1
+#endif
+
+#ifndef GL_EXT_blend_color
+#define GL_EXT_blend_color 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.BlendColorEXT (GLclampf, GLclampf, GLclampf, GLclampf);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+#endif
+
+#ifndef GL_EXT_polygon_offset
+#define GL_EXT_polygon_offset 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.PolygonOffsetEXT (GLfloat, GLfloat);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias);
+#endif
+
+#ifndef GL_EXT_texture
+#define GL_EXT_texture 1
+#endif
+
+#ifndef GL_EXT_texture3D
+#define GL_EXT_texture3D 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.TexImage3DEXT (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
+extern void APIENTRY chromium.TexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRY * PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
+#endif
+
+#ifndef GL_SGIS_texture_filter4
+#define GL_SGIS_texture_filter4 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.GetTexFilterFuncSGIS (GLenum, GLenum, GLfloat *);
+extern void APIENTRY chromium.TexFilterFuncSGIS (GLenum, GLenum, GLsizei, const GLfloat *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat *weights);
+typedef void (APIENTRY * PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights);
+#endif
+
+#ifndef GL_EXT_subtexture
+#define GL_EXT_subtexture 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.TexSubImage1DEXT (GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *);
+extern void APIENTRY chromium.TexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRY * PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
+#endif
+
+#ifndef GL_EXT_copy_texture
+#define GL_EXT_copy_texture 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.CopyTexImage1DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint);
+extern void APIENTRY chromium.CopyTexImage2DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint);
+extern void APIENTRY chromium.CopyTexSubImage1DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei);
+extern void APIENTRY chromium.CopyTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
+extern void APIENTRY chromium.CopyTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
+typedef void (APIENTRY * PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+typedef void (APIENTRY * PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
+typedef void (APIENTRY * PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (APIENTRY * PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+#endif
+
+#ifndef GL_EXT_histogram
+#define GL_EXT_histogram 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.GetHistogramEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *);
+extern void APIENTRY chromium.GetHistogramParameterfvEXT (GLenum, GLenum, GLfloat *);
+extern void APIENTRY chromium.GetHistogramParameterivEXT (GLenum, GLenum, GLint *);
+extern void APIENTRY chromium.GetMinmaxEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *);
+extern void APIENTRY chromium.GetMinmaxParameterfvEXT (GLenum, GLenum, GLfloat *);
+extern void APIENTRY chromium.GetMinmaxParameterivEXT (GLenum, GLenum, GLint *);
+extern void APIENTRY chromium.HistogramEXT (GLenum, GLsizei, GLenum, GLboolean);
+extern void APIENTRY chromium.MinmaxEXT (GLenum, GLenum, GLboolean);
+extern void APIENTRY chromium.ResetHistogramEXT (GLenum);
+extern void APIENTRY chromium.ResetMinmaxEXT (GLenum);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
+typedef void (APIENTRY * PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRY * PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
+typedef void (APIENTRY * PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRY * PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
+typedef void (APIENTRY * PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink);
+typedef void (APIENTRY * PFNGLRESETHISTOGRAMEXTPROC) (GLenum target);
+typedef void (APIENTRY * PFNGLRESETMINMAXEXTPROC) (GLenum target);
+#endif
+
+#ifndef GL_EXT_convolution
+#define GL_EXT_convolution 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.ConvolutionFilter1DEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
+extern void APIENTRY chromium.ConvolutionFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
+extern void APIENTRY chromium.ConvolutionParameterfEXT (GLenum, GLenum, GLfloat);
+extern void APIENTRY chromium.ConvolutionParameterfvEXT (GLenum, GLenum, const GLfloat *);
+extern void APIENTRY chromium.ConvolutionParameteriEXT (GLenum, GLenum, GLint);
+extern void APIENTRY chromium.ConvolutionParameterivEXT (GLenum, GLenum, const GLint *);
+extern void APIENTRY chromium.CopyConvolutionFilter1DEXT (GLenum, GLenum, GLint, GLint, GLsizei);
+extern void APIENTRY chromium.CopyConvolutionFilter2DEXT (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei);
+extern void APIENTRY chromium.GetConvolutionFilterEXT (GLenum, GLenum, GLenum, GLvoid *);
+extern void APIENTRY chromium.GetConvolutionParameterfvEXT (GLenum, GLenum, GLfloat *);
+extern void APIENTRY chromium.GetConvolutionParameterivEXT (GLenum, GLenum, GLint *);
+extern void APIENTRY chromium.GetSeparableFilterEXT (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *);
+extern void APIENTRY chromium.SeparableFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);
+typedef void (APIENTRY * PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);
+typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat params);
+typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params);
+typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint params);
+typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRY * PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
+typedef void (APIENTRY * PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (APIENTRY * PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image);
+typedef void (APIENTRY * PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRY * PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);
+typedef void (APIENTRY * PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
+#endif
+
+#ifndef GL_EXT_color_matrix
+#define GL_EXT_color_matrix 1
+#endif
+
+#ifndef GL_SGI_color_table
+#define GL_SGI_color_table 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.ColorTableSGI (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
+extern void APIENTRY chromium.ColorTableParameterfvSGI (GLenum, GLenum, const GLfloat *);
+extern void APIENTRY chromium.ColorTableParameterivSGI (GLenum, GLenum, const GLint *);
+extern void APIENTRY chromium.CopyColorTableSGI (GLenum, GLenum, GLint, GLint, GLsizei);
+extern void APIENTRY chromium.GetColorTableSGI (GLenum, GLenum, GLenum, GLvoid *);
+extern void APIENTRY chromium.GetColorTableParameterfvSGI (GLenum, GLenum, GLfloat *);
+extern void APIENTRY chromium.GetColorTableParameterivSGI (GLenum, GLenum, GLint *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
+typedef void (APIENTRY * PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat *params);
+typedef void (APIENTRY * PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRY * PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
+typedef void (APIENTRY * PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table);
+typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint *params);
+#endif
+
+#ifndef GL_SGIX_pixel_texture
+#define GL_SGIX_pixel_texture 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.PixelTexGenSGIX (GLenum);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLPIXELTEXGENSGIXPROC) (GLenum mode);
+#endif
+
+#ifndef GL_SGIS_pixel_texture
+#define GL_SGIS_pixel_texture 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.PixelTexGenParameteriSGIS (GLenum, GLint);
+extern void APIENTRY chromium.PixelTexGenParameterivSGIS (GLenum, const GLint *);
+extern void APIENTRY chromium.PixelTexGenParameterfSGIS (GLenum, GLfloat);
+extern void APIENTRY chromium.PixelTexGenParameterfvSGIS (GLenum, const GLfloat *);
+extern void APIENTRY chromium.GetPixelTexGenParameterivSGIS (GLenum, GLint *);
+extern void APIENTRY chromium.GetPixelTexGenParameterfvSGIS (GLenum, GLfloat *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLPIXELTEXGENPARAMETERISGISPROC) (GLenum pname, GLint param);
+typedef void (APIENTRY * PFNGLPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, const GLint *params);
+typedef void (APIENTRY * PFNGLPIXELTEXGENPARAMETERFSGISPROC) (GLenum pname, GLfloat param);
+typedef void (APIENTRY * PFNGLPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params);
+typedef void (APIENTRY * PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, GLint *params);
+typedef void (APIENTRY * PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, GLfloat *params);
+#endif
+
+#ifndef GL_SGIS_texture4D
+#define GL_SGIS_texture4D 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.TexImage4DSGIS (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
+extern void APIENTRY chromium.TexSubImage4DSGIS (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRY * PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid *pixels);
+#endif
+
+#ifndef GL_SGI_texture_color_table
+#define GL_SGI_texture_color_table 1
+#endif
+
+#ifndef GL_EXT_cmyka
+#define GL_EXT_cmyka 1
+#endif
+
+#ifndef GL_EXT_texture_object
+#define GL_EXT_texture_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern GLboolean APIENTRY chromium.AreTexturesResidentEXT (GLsizei, const GLuint *, GLboolean *);
+extern void APIENTRY chromium.BindTextureEXT (GLenum, GLuint);
+extern void APIENTRY chromium.DeleteTexturesEXT (GLsizei, const GLuint *);
+extern void APIENTRY chromium.GenTexturesEXT (GLsizei, GLuint *);
+extern GLboolean APIENTRY chromium.IsTextureEXT (GLuint);
+extern void APIENTRY chromium.PrioritizeTexturesEXT (GLsizei, const GLuint *, const GLclampf *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLboolean (APIENTRY * PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint *textures, GLboolean *residences);
+typedef void (APIENTRY * PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture);
+typedef void (APIENTRY * PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint *textures);
+typedef void (APIENTRY * PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint *textures);
+typedef GLboolean (APIENTRY * PFNGLISTEXTUREEXTPROC) (GLuint texture);
+typedef void (APIENTRY * PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint *textures, const GLclampf *priorities);
+#endif
+
+#ifndef GL_SGIS_detail_texture
+#define GL_SGIS_detail_texture 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.DetailTexFuncSGIS (GLenum, GLsizei, const GLfloat *);
+extern void APIENTRY chromium.GetDetailTexFuncSGIS (GLenum, GLfloat *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points);
+typedef void (APIENTRY * PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat *points);
+#endif
+
+#ifndef GL_SGIS_sharpen_texture
+#define GL_SGIS_sharpen_texture 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.SharpenTexFuncSGIS (GLenum, GLsizei, const GLfloat *);
+extern void APIENTRY chromium.GetSharpenTexFuncSGIS (GLenum, GLfloat *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points);
+typedef void (APIENTRY * PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat *points);
+#endif
+
+#ifndef GL_EXT_packed_pixels
+#define GL_EXT_packed_pixels 1
+#endif
+
+#ifndef GL_SGIS_texture_lod
+#define GL_SGIS_texture_lod 1
+#endif
+
+#ifndef GL_SGIS_multisample
+#define GL_SGIS_multisample 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.SampleMaskSGIS (GLclampf, GLboolean);
+extern void APIENTRY chromium.SamplePatternSGIS (GLenum);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert);
+typedef void (APIENTRY * PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern);
+#endif
+
+#ifndef GL_EXT_rescale_normal
+#define GL_EXT_rescale_normal 1
+#endif
+
+#ifndef GL_EXT_vertex_array
+#define GL_EXT_vertex_array 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.ArrayElementEXT (GLint);
+extern void APIENTRY chromium.ColorPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *);
+extern void APIENTRY chromium.DrawArraysEXT (GLenum, GLint, GLsizei);
+extern void APIENTRY chromium.EdgeFlagPointerEXT (GLsizei, GLsizei, const GLboolean *);
+extern void APIENTRY chromium.GetPointervEXT (GLenum, GLvoid* *);
+extern void APIENTRY chromium.IndexPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *);
+extern void APIENTRY chromium.NormalPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *);
+extern void APIENTRY chromium.TexCoordPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *);
+extern void APIENTRY chromium.VertexPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLARRAYELEMENTEXTPROC) (GLint i);
+typedef void (APIENTRY * PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+typedef void (APIENTRY * PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count);
+typedef void (APIENTRY * PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean *pointer);
+typedef void (APIENTRY * PFNGLGETPOINTERVEXTPROC) (GLenum pname, GLvoid* *params);
+typedef void (APIENTRY * PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+typedef void (APIENTRY * PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+typedef void (APIENTRY * PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+typedef void (APIENTRY * PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+#endif
+
+#ifndef GL_EXT_misc_attribute
+#define GL_EXT_misc_attribute 1
+#endif
+
+#ifndef GL_SGIS_generate_mipmap
+#define GL_SGIS_generate_mipmap 1
+#endif
+
+#ifndef GL_SGIX_clipmap
+#define GL_SGIX_clipmap 1
+#endif
+
+#ifndef GL_SGIX_shadow
+#define GL_SGIX_shadow 1
+#endif
+
+#ifndef GL_SGIS_texture_edge_clamp
+#define GL_SGIS_texture_edge_clamp 1
+#endif
+
+#ifndef GL_SGIS_texture_border_clamp
+#define GL_SGIS_texture_border_clamp 1
+#endif
+
+#ifndef GL_EXT_blend_minmax
+#define GL_EXT_blend_minmax 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.BlendEquationEXT (GLenum);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLBLENDEQUATIONEXTPROC) (GLenum mode);
+#endif
+
+#ifndef GL_EXT_blend_subtract
+#define GL_EXT_blend_subtract 1
+#endif
+
+#ifndef GL_EXT_blend_logic_op
+#define GL_EXT_blend_logic_op 1
+#endif
+
+#ifndef GL_SGIX_interlace
+#define GL_SGIX_interlace 1
+#endif
+
+#ifndef GL_SGIX_pixel_tiles
+#define GL_SGIX_pixel_tiles 1
+#endif
+
+#ifndef GL_SGIX_texture_select
+#define GL_SGIX_texture_select 1
+#endif
+
+#ifndef GL_SGIX_sprite
+#define GL_SGIX_sprite 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.SpriteParameterfSGIX (GLenum, GLfloat);
+extern void APIENTRY chromium.SpriteParameterfvSGIX (GLenum, const GLfloat *);
+extern void APIENTRY chromium.SpriteParameteriSGIX (GLenum, GLint);
+extern void APIENTRY chromium.SpriteParameterivSGIX (GLenum, const GLint *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param);
+typedef void (APIENTRY * PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, const GLfloat *params);
+typedef void (APIENTRY * PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param);
+typedef void (APIENTRY * PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, const GLint *params);
+#endif
+
+#ifndef GL_SGIX_texture_multi_buffer
+#define GL_SGIX_texture_multi_buffer 1
+#endif
+
+#ifndef GL_EXT_point_parameters
+#define GL_EXT_point_parameters 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.PointParameterfEXT (GLenum, GLfloat);
+extern void APIENTRY chromium.PointParameterfvEXT (GLenum, const GLfloat *);
+extern void APIENTRY chromium.PointParameterfSGIS (GLenum, GLfloat);
+extern void APIENTRY chromium.PointParameterfvSGIS (GLenum, const GLfloat *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param);
+typedef void (APIENTRY * PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params);
+typedef void (APIENTRY * PFNGLPOINTPARAMETERFSGISPROC) (GLenum pname, GLfloat param);
+typedef void (APIENTRY * PFNGLPOINTPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params);
+#endif
+
+#ifndef GL_SGIX_instruments
+#define GL_SGIX_instruments 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern GLint APIENTRY chromium.GetInstrumentsSGIX (void);
+extern void APIENTRY chromium.InstrumentsBufferSGIX (GLsizei, GLint *);
+extern GLint APIENTRY chromium.PollInstrumentsSGIX (GLint *);
+extern void APIENTRY chromium.ReadInstrumentsSGIX (GLint);
+extern void APIENTRY chromium.StartInstrumentsSGIX (void);
+extern void APIENTRY chromium.StopInstrumentsSGIX (GLint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLint (APIENTRY * PFNGLGETINSTRUMENTSSGIXPROC) (void);
+typedef void (APIENTRY * PFNGLINSTRUMENTSBUFFERSGIXPROC) (GLsizei size, GLint *buffer);
+typedef GLint (APIENTRY * PFNGLPOLLINSTRUMENTSSGIXPROC) (GLint *marker_p);
+typedef void (APIENTRY * PFNGLREADINSTRUMENTSSGIXPROC) (GLint marker);
+typedef void (APIENTRY * PFNGLSTARTINSTRUMENTSSGIXPROC) (void);
+typedef void (APIENTRY * PFNGLSTOPINSTRUMENTSSGIXPROC) (GLint marker);
+#endif
+
+#ifndef GL_SGIX_texture_scale_bias
+#define GL_SGIX_texture_scale_bias 1
+#endif
+
+#ifndef GL_SGIX_framezoom
+#define GL_SGIX_framezoom 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.FrameZoomSGIX (GLint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLFRAMEZOOMSGIXPROC) (GLint factor);
+#endif
+
+#ifndef GL_SGIX_tag_sample_buffer
+#define GL_SGIX_tag_sample_buffer 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.TagSampleBufferSGIX (void);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLTAGSAMPLEBUFFERSGIXPROC) (void);
+#endif
+
+#ifndef GL_SGIX_reference_plane
+#define GL_SGIX_reference_plane 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.ReferencePlaneSGIX (const GLdouble *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLREFERENCEPLANESGIXPROC) (const GLdouble *equation);
+#endif
+
+#ifndef GL_SGIX_flush_raster
+#define GL_SGIX_flush_raster 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.FlushRasterSGIX (void);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLFLUSHRASTERSGIXPROC) (void);
+#endif
+
+#ifndef GL_SGIX_depth_texture
+#define GL_SGIX_depth_texture 1
+#endif
+
+#ifndef GL_SGIS_fog_function
+#define GL_SGIS_fog_function 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.FogFuncSGIS (GLsizei, const GLfloat *);
+extern void APIENTRY chromium.GetFogFuncSGIS (const GLfloat *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat *points);
+typedef void (APIENTRY * PFNGLGETFOGFUNCSGISPROC) (const GLfloat *points);
+#endif
+
+#ifndef GL_SGIX_fog_offset
+#define GL_SGIX_fog_offset 1
+#endif
+
+#ifndef GL_HP_image_transform
+#define GL_HP_image_transform 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.ImageTransformParameteriHP (GLenum, GLenum, GLint);
+extern void APIENTRY chromium.ImageTransformParameterfHP (GLenum, GLenum, GLfloat);
+extern void APIENTRY chromium.ImageTransformParameterivHP (GLenum, GLenum, const GLint *);
+extern void APIENTRY chromium.ImageTransformParameterfvHP (GLenum, GLenum, const GLfloat *);
+extern void APIENTRY chromium.GetImageTransformParameterivHP (GLenum, GLenum, GLint *);
+extern void APIENTRY chromium.GetImageTransformParameterfvHP (GLenum, GLenum, GLfloat *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, GLint param);
+typedef void (APIENTRY * PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, GLfloat param);
+typedef void (APIENTRY * PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRY * PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat *params);
+typedef void (APIENTRY * PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRY * PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, GLfloat *params);
+#endif
+
+#ifndef GL_HP_convolution_border_modes
+#define GL_HP_convolution_border_modes 1
+#endif
+
+#ifndef GL_SGIX_texture_add_env
+#define GL_SGIX_texture_add_env 1
+#endif
+
+#ifndef GL_EXT_color_subtable
+#define GL_EXT_color_subtable 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.ColorSubTableEXT (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
+extern void APIENTRY chromium.CopyColorSubTableEXT (GLenum, GLsizei, GLint, GLint, GLsizei);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
+typedef void (APIENTRY * PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
+#endif
+
+#ifndef GL_PGI_vertex_hints
+#define GL_PGI_vertex_hints 1
+#endif
+
+#ifndef GL_PGI_misc_hints
+#define GL_PGI_misc_hints 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.HintPGI (GLenum, GLint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLHINTPGIPROC) (GLenum target, GLint mode);
+#endif
+
+#ifndef GL_EXT_paletted_texture
+#define GL_EXT_paletted_texture 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.ColorTableEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
+extern void APIENTRY chromium.GetColorTableEXT (GLenum, GLenum, GLenum, GLvoid *);
+extern void APIENTRY chromium.GetColorTableParameterivEXT (GLenum, GLenum, GLint *);
+extern void APIENTRY chromium.GetColorTableParameterfvEXT (GLenum, GLenum, GLfloat *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
+typedef void (APIENTRY * PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *data);
+typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);
+#endif
+
+#ifndef GL_EXT_clip_volume_hint
+#define GL_EXT_clip_volume_hint 1
+#endif
+
+#ifndef GL_SGIX_list_priority
+#define GL_SGIX_list_priority 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.GetListParameterfvSGIX (GLuint, GLenum, GLfloat *);
+extern void APIENTRY chromium.GetListParameterivSGIX (GLuint, GLenum, GLint *);
+extern void APIENTRY chromium.ListParameterfSGIX (GLuint, GLenum, GLfloat);
+extern void APIENTRY chromium.ListParameterfvSGIX (GLuint, GLenum, const GLfloat *);
+extern void APIENTRY chromium.ListParameteriSGIX (GLuint, GLenum, GLint);
+extern void APIENTRY chromium.ListParameterivSGIX (GLuint, GLenum, const GLint *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLGETLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * PFNGLGETLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, GLint *params);
+typedef void (APIENTRY * PFNGLLISTPARAMETERFSGIXPROC) (GLuint list, GLenum pname, GLfloat param);
+typedef void (APIENTRY * PFNGLLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, const GLfloat *params);
+typedef void (APIENTRY * PFNGLLISTPARAMETERISGIXPROC) (GLuint list, GLenum pname, GLint param);
+typedef void (APIENTRY * PFNGLLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, const GLint *params);
+#endif
+
+#ifndef GL_SGIX_ir_instrument1
+#define GL_SGIX_ir_instrument1 1
+#endif
+
+#ifndef GL_SGIX_calligraphic_fragment
+#define GL_SGIX_calligraphic_fragment 1
+#endif
+
+#ifndef GL_SGIX_texture_lod_bias
+#define GL_SGIX_texture_lod_bias 1
+#endif
+
+#ifndef GL_SGIX_shadow_ambient
+#define GL_SGIX_shadow_ambient 1
+#endif
+
+#ifndef GL_EXT_index_texture
+#define GL_EXT_index_texture 1
+#endif
+
+#ifndef GL_EXT_index_material
+#define GL_EXT_index_material 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.IndexMaterialEXT (GLenum, GLenum);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode);
+#endif
+
+#ifndef GL_EXT_index_func
+#define GL_EXT_index_func 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.IndexFuncEXT (GLenum, GLclampf);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLINDEXFUNCEXTPROC) (GLenum func, GLclampf ref);
+#endif
+
+#ifndef GL_EXT_index_array_formats
+#define GL_EXT_index_array_formats 1
+#endif
+
+#ifndef GL_EXT_compiled_vertex_array
+#define GL_EXT_compiled_vertex_array 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.LockArraysEXT (GLint, GLsizei);
+extern void APIENTRY chromium.UnlockArraysEXT (void);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count);
+typedef void (APIENTRY * PFNGLUNLOCKARRAYSEXTPROC) (void);
+#endif
+
+#ifndef GL_EXT_cull_vertex
+#define GL_EXT_cull_vertex 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.CullParameterdvEXT (GLenum, GLdouble *);
+extern void APIENTRY chromium.CullParameterfvEXT (GLenum, GLfloat *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble *params);
+typedef void (APIENTRY * PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat *params);
+#endif
+
+#ifndef GL_SGIX_ycrcb
+#define GL_SGIX_ycrcb 1
+#endif
+
+#ifndef GL_SGIX_fragment_lighting
+#define GL_SGIX_fragment_lighting 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.FragmentColorMaterialSGIX (GLenum, GLenum);
+extern void APIENTRY chromium.FragmentLightfSGIX (GLenum, GLenum, GLfloat);
+extern void APIENTRY chromium.FragmentLightfvSGIX (GLenum, GLenum, const GLfloat *);
+extern void APIENTRY chromium.FragmentLightiSGIX (GLenum, GLenum, GLint);
+extern void APIENTRY chromium.FragmentLightivSGIX (GLenum, GLenum, const GLint *);
+extern void APIENTRY chromium.FragmentLightModelfSGIX (GLenum, GLfloat);
+extern void APIENTRY chromium.FragmentLightModelfvSGIX (GLenum, const GLfloat *);
+extern void APIENTRY chromium.FragmentLightModeliSGIX (GLenum, GLint);
+extern void APIENTRY chromium.FragmentLightModelivSGIX (GLenum, const GLint *);
+extern void APIENTRY chromium.FragmentMaterialfSGIX (GLenum, GLenum, GLfloat);
+extern void APIENTRY chromium.FragmentMaterialfvSGIX (GLenum, GLenum, const GLfloat *);
+extern void APIENTRY chromium.FragmentMaterialiSGIX (GLenum, GLenum, GLint);
+extern void APIENTRY chromium.FragmentMaterialivSGIX (GLenum, GLenum, const GLint *);
+extern void APIENTRY chromium.GetFragmentLightfvSGIX (GLenum, GLenum, GLfloat *);
+extern void APIENTRY chromium.GetFragmentLightivSGIX (GLenum, GLenum, GLint *);
+extern void APIENTRY chromium.GetFragmentMaterialfvSGIX (GLenum, GLenum, GLfloat *);
+extern void APIENTRY chromium.GetFragmentMaterialivSGIX (GLenum, GLenum, GLint *);
+extern void APIENTRY chromium.LightEnviSGIX (GLenum, GLint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode);
+typedef void (APIENTRY * PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param);
+typedef void (APIENTRY * PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, const GLfloat *params);
+typedef void (APIENTRY * PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param);
+typedef void (APIENTRY * PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, const GLint *params);
+typedef void (APIENTRY * PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param);
+typedef void (APIENTRY * PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, const GLfloat *params);
+typedef void (APIENTRY * PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param);
+typedef void (APIENTRY * PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, const GLint *params);
+typedef void (APIENTRY * PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, GLfloat param);
+typedef void (APIENTRY * PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat *params);
+typedef void (APIENTRY * PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, GLint param);
+typedef void (APIENTRY * PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint *params);
+typedef void (APIENTRY * PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint *params);
+typedef void (APIENTRY * PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params);
+typedef void (APIENTRY * PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param);
+#endif
+
+#ifndef GL_IBM_rasterpos_clip
+#define GL_IBM_rasterpos_clip 1
+#endif
+
+#ifndef GL_HP_texture_lighting
+#define GL_HP_texture_lighting 1
+#endif
+
+#ifndef GL_EXT_draw_range_elements
+#define GL_EXT_draw_range_elements 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.DrawRangeElementsEXT (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
+#endif
+
+#ifndef GL_WIN_phong_shading
+#define GL_WIN_phong_shading 1
+#endif
+
+#ifndef GL_WIN_specular_fog
+#define GL_WIN_specular_fog 1
+#endif
+
+#ifndef GL_EXT_light_texture
+#define GL_EXT_light_texture 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.ApplyTextureEXT (GLenum);
+extern void APIENTRY chromium.TextureLightEXT (GLenum);
+extern void APIENTRY chromium.TextureMaterialEXT (GLenum, GLenum);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode);
+typedef void (APIENTRY * PFNGLTEXTURELIGHTEXTPROC) (GLenum pname);
+typedef void (APIENTRY * PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode);
+#endif
+
+#ifndef GL_SGIX_blend_alpha_minmax
+#define GL_SGIX_blend_alpha_minmax 1
+#endif
+
+#ifndef GL_EXT_bgra
+#define GL_EXT_bgra 1
+#endif
+
+#ifndef GL_INTEL_parallel_arrays
+#define GL_INTEL_parallel_arrays 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.VertexPointervINTEL (GLint, GLenum, const GLvoid* *);
+extern void APIENTRY chromium.NormalPointervINTEL (GLenum, const GLvoid* *);
+extern void APIENTRY chromium.ColorPointervINTEL (GLint, GLenum, const GLvoid* *);
+extern void APIENTRY chromium.TexCoordPointervINTEL (GLint, GLenum, const GLvoid* *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer);
+typedef void (APIENTRY * PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const GLvoid* *pointer);
+typedef void (APIENTRY * PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer);
+typedef void (APIENTRY * PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer);
+#endif
+
+#ifndef GL_HP_occlusion_test
+#define GL_HP_occlusion_test 1
+#endif
+
+#ifndef GL_EXT_pixel_transform
+#define GL_EXT_pixel_transform 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.PixelTransformParameteriEXT (GLenum, GLenum, GLint);
+extern void APIENTRY chromium.PixelTransformParameterfEXT (GLenum, GLenum, GLfloat);
+extern void APIENTRY chromium.PixelTransformParameterivEXT (GLenum, GLenum, const GLint *);
+extern void APIENTRY chromium.PixelTransformParameterfvEXT (GLenum, GLenum, const GLfloat *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param);
+typedef void (APIENTRY * PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param);
+typedef void (APIENTRY * PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRY * PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params);
+#endif
+
+#ifndef GL_EXT_pixel_transform_color_table
+#define GL_EXT_pixel_transform_color_table 1
+#endif
+
+#ifndef GL_EXT_shared_texture_palette
+#define GL_EXT_shared_texture_palette 1
+#endif
+
+#ifndef GL_EXT_separate_specular_color
+#define GL_EXT_separate_specular_color 1
+#endif
+
+#ifndef GL_EXT_secondary_color
+#define GL_EXT_secondary_color 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.SecondaryColor3bEXT (GLbyte, GLbyte, GLbyte);
+extern void APIENTRY chromium.SecondaryColor3bvEXT (const GLbyte *);
+extern void APIENTRY chromium.SecondaryColor3dEXT (GLdouble, GLdouble, GLdouble);
+extern void APIENTRY chromium.SecondaryColor3dvEXT (const GLdouble *);
+extern void APIENTRY chromium.SecondaryColor3fEXT (GLfloat, GLfloat, GLfloat);
+extern void APIENTRY chromium.SecondaryColor3fvEXT (const GLfloat *);
+extern void APIENTRY chromium.SecondaryColor3iEXT (GLint, GLint, GLint);
+extern void APIENTRY chromium.SecondaryColor3ivEXT (const GLint *);
+extern void APIENTRY chromium.SecondaryColor3sEXT (GLshort, GLshort, GLshort);
+extern void APIENTRY chromium.SecondaryColor3svEXT (const GLshort *);
+extern void APIENTRY chromium.SecondaryColor3ubEXT (GLubyte, GLubyte, GLubyte);
+extern void APIENTRY chromium.SecondaryColor3ubvEXT (const GLubyte *);
+extern void APIENTRY chromium.SecondaryColor3uiEXT (GLuint, GLuint, GLuint);
+extern void APIENTRY chromium.SecondaryColor3uivEXT (const GLuint *);
+extern void APIENTRY chromium.SecondaryColor3usEXT (GLushort, GLushort, GLushort);
+extern void APIENTRY chromium.SecondaryColor3usvEXT (const GLushort *);
+extern void APIENTRY chromium.SecondaryColorPointerEXT (GLint, GLenum, GLsizei, GLvoid *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue);
+typedef void (APIENTRY * PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v);
+typedef void (APIENTRY * PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue);
+typedef void (APIENTRY * PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v);
+typedef void (APIENTRY * PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue);
+typedef void (APIENTRY * PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v);
+typedef void (APIENTRY * PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue);
+typedef void (APIENTRY * PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v);
+typedef void (APIENTRY * PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue);
+typedef void (APIENTRY * PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v);
+typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue);
+typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v);
+typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue);
+typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v);
+typedef void (APIENTRY * PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue);
+typedef void (APIENTRY * PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v);
+typedef void (APIENTRY * PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLvoid *pointer);
+#endif
+
+#ifndef GL_EXT_texture_perturb_normal
+#define GL_EXT_texture_perturb_normal 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.TextureNormalEXT (GLenum);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLTEXTURENORMALEXTPROC) (GLenum mode);
+#endif
+
+#ifndef GL_EXT_multi_draw_arrays
+#define GL_EXT_multi_draw_arrays 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.MultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei);
+extern void APIENTRY chromium.MultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount);
+typedef void (APIENTRY * PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
+#endif
+
+#ifndef GL_EXT_fog_coord
+#define GL_EXT_fog_coord 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.FogCoordfEXT (GLfloat);
+extern void APIENTRY chromium.FogCoordfvEXT (const GLfloat *);
+extern void APIENTRY chromium.FogCoorddEXT (GLdouble);
+extern void APIENTRY chromium.FogCoorddvEXT (const GLdouble *);
+extern void APIENTRY chromium.FogCoordPointerEXT (GLenum, GLsizei, const GLvoid *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLFOGCOORDFEXTPROC) (GLfloat coord);
+typedef void (APIENTRY * PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord);
+typedef void (APIENTRY * PFNGLFOGCOORDDEXTPROC) (GLdouble coord);
+typedef void (APIENTRY * PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord);
+typedef void (APIENTRY * PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);
+#endif
+
+#ifndef GL_REND_screen_coordinates
+#define GL_REND_screen_coordinates 1
+#endif
+
+#ifndef GL_EXT_coordinate_frame
+#define GL_EXT_coordinate_frame 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.Tangent3bEXT (GLbyte, GLbyte, GLbyte);
+extern void APIENTRY chromium.Tangent3bvEXT (const GLbyte *);
+extern void APIENTRY chromium.Tangent3dEXT (GLdouble, GLdouble, GLdouble);
+extern void APIENTRY chromium.Tangent3dvEXT (const GLdouble *);
+extern void APIENTRY chromium.Tangent3fEXT (GLfloat, GLfloat, GLfloat);
+extern void APIENTRY chromium.Tangent3fvEXT (const GLfloat *);
+extern void APIENTRY chromium.Tangent3iEXT (GLint, GLint, GLint);
+extern void APIENTRY chromium.Tangent3ivEXT (const GLint *);
+extern void APIENTRY chromium.Tangent3sEXT (GLshort, GLshort, GLshort);
+extern void APIENTRY chromium.Tangent3svEXT (const GLshort *);
+extern void APIENTRY chromium.Binormal3bEXT (GLbyte, GLbyte, GLbyte);
+extern void APIENTRY chromium.Binormal3bvEXT (const GLbyte *);
+extern void APIENTRY chromium.Binormal3dEXT (GLdouble, GLdouble, GLdouble);
+extern void APIENTRY chromium.Binormal3dvEXT (const GLdouble *);
+extern void APIENTRY chromium.Binormal3fEXT (GLfloat, GLfloat, GLfloat);
+extern void APIENTRY chromium.Binormal3fvEXT (const GLfloat *);
+extern void APIENTRY chromium.Binormal3iEXT (GLint, GLint, GLint);
+extern void APIENTRY chromium.Binormal3ivEXT (const GLint *);
+extern void APIENTRY chromium.Binormal3sEXT (GLshort, GLshort, GLshort);
+extern void APIENTRY chromium.Binormal3svEXT (const GLshort *);
+extern void APIENTRY chromium.TangentPointerEXT (GLenum, GLsizei, const GLvoid *);
+extern void APIENTRY chromium.BinormalPointerEXT (GLenum, GLsizei, const GLvoid *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLTANGENT3BEXTPROC) (GLbyte tx, GLbyte ty, GLbyte tz);
+typedef void (APIENTRY * PFNGLTANGENT3BVEXTPROC) (const GLbyte *v);
+typedef void (APIENTRY * PFNGLTANGENT3DEXTPROC) (GLdouble tx, GLdouble ty, GLdouble tz);
+typedef void (APIENTRY * PFNGLTANGENT3DVEXTPROC) (const GLdouble *v);
+typedef void (APIENTRY * PFNGLTANGENT3FEXTPROC) (GLfloat tx, GLfloat ty, GLfloat tz);
+typedef void (APIENTRY * PFNGLTANGENT3FVEXTPROC) (const GLfloat *v);
+typedef void (APIENTRY * PFNGLTANGENT3IEXTPROC) (GLint tx, GLint ty, GLint tz);
+typedef void (APIENTRY * PFNGLTANGENT3IVEXTPROC) (const GLint *v);
+typedef void (APIENTRY * PFNGLTANGENT3SEXTPROC) (GLshort tx, GLshort ty, GLshort tz);
+typedef void (APIENTRY * PFNGLTANGENT3SVEXTPROC) (const GLshort *v);
+typedef void (APIENTRY * PFNGLBINORMAL3BEXTPROC) (GLbyte bx, GLbyte by, GLbyte bz);
+typedef void (APIENTRY * PFNGLBINORMAL3BVEXTPROC) (const GLbyte *v);
+typedef void (APIENTRY * PFNGLBINORMAL3DEXTPROC) (GLdouble bx, GLdouble by, GLdouble bz);
+typedef void (APIENTRY * PFNGLBINORMAL3DVEXTPROC) (const GLdouble *v);
+typedef void (APIENTRY * PFNGLBINORMAL3FEXTPROC) (GLfloat bx, GLfloat by, GLfloat bz);
+typedef void (APIENTRY * PFNGLBINORMAL3FVEXTPROC) (const GLfloat *v);
+typedef void (APIENTRY * PFNGLBINORMAL3IEXTPROC) (GLint bx, GLint by, GLint bz);
+typedef void (APIENTRY * PFNGLBINORMAL3IVEXTPROC) (const GLint *v);
+typedef void (APIENTRY * PFNGLBINORMAL3SEXTPROC) (GLshort bx, GLshort by, GLshort bz);
+typedef void (APIENTRY * PFNGLBINORMAL3SVEXTPROC) (const GLshort *v);
+typedef void (APIENTRY * PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);
+typedef void (APIENTRY * PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);
+#endif
+
+#ifndef GL_EXT_texture_env_combine
+#define GL_EXT_texture_env_combine 1
+#endif
+
+#ifndef GL_APPLE_specular_vector
+#define GL_APPLE_specular_vector 1
+#endif
+
+#ifndef GL_APPLE_transform_hint
+#define GL_APPLE_transform_hint 1
+#endif
+
+#ifndef GL_SGIX_fog_scale
+#define GL_SGIX_fog_scale 1
+#endif
+
+#ifndef GL_SUNX_constant_data
+#define GL_SUNX_constant_data 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.FinishTextureSUNX (void);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLFINISHTEXTURESUNXPROC) (void);
+#endif
+
+#ifndef GL_SUN_global_alpha
+#define GL_SUN_global_alpha 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.GlobalAlphaFactorbSUN (GLbyte);
+extern void APIENTRY chromium.GlobalAlphaFactorsSUN (GLshort);
+extern void APIENTRY chromium.GlobalAlphaFactoriSUN (GLint);
+extern void APIENTRY chromium.GlobalAlphaFactorfSUN (GLfloat);
+extern void APIENTRY chromium.GlobalAlphaFactordSUN (GLdouble);
+extern void APIENTRY chromium.GlobalAlphaFactorubSUN (GLubyte);
+extern void APIENTRY chromium.GlobalAlphaFactorusSUN (GLushort);
+extern void APIENTRY chromium.GlobalAlphaFactoruiSUN (GLuint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor);
+typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor);
+typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor);
+typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor);
+typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor);
+typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor);
+typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor);
+typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor);
+#endif
+
+#ifndef GL_SUN_triangle_list
+#define GL_SUN_triangle_list 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.ReplacementCodeuiSUN (GLuint);
+extern void APIENTRY chromium.ReplacementCodeusSUN (GLushort);
+extern void APIENTRY chromium.ReplacementCodeubSUN (GLubyte);
+extern void APIENTRY chromium.ReplacementCodeuivSUN (const GLuint *);
+extern void APIENTRY chromium.ReplacementCodeusvSUN (const GLushort *);
+extern void APIENTRY chromium.ReplacementCodeubvSUN (const GLubyte *);
+extern void APIENTRY chromium.ReplacementCodePointerSUN (GLenum, GLsizei, const GLvoid* *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code);
+typedef void (APIENTRY * PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code);
+typedef void (APIENTRY * PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code);
+typedef void (APIENTRY * PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint *code);
+typedef void (APIENTRY * PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort *code);
+typedef void (APIENTRY * PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte *code);
+typedef void (APIENTRY * PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const GLvoid* *pointer);
+#endif
+
+#ifndef GL_SUN_vertex
+#define GL_SUN_vertex 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.Color4ubVertex2fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat);
+extern void APIENTRY chromium.Color4ubVertex2fvSUN (const GLubyte *, const GLfloat *);
+extern void APIENTRY chromium.Color4ubVertex3fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat);
+extern void APIENTRY chromium.Color4ubVertex3fvSUN (const GLubyte *, const GLfloat *);
+extern void APIENTRY chromium.Color3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
+extern void APIENTRY chromium.Color3fVertex3fvSUN (const GLfloat *, const GLfloat *);
+extern void APIENTRY chromium.Normal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
+extern void APIENTRY chromium.Normal3fVertex3fvSUN (const GLfloat *, const GLfloat *);
+extern void APIENTRY chromium.Color4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
+extern void APIENTRY chromium.Color4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *);
+extern void APIENTRY chromium.TexCoord2fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
+extern void APIENTRY chromium.TexCoord2fVertex3fvSUN (const GLfloat *, const GLfloat *);
+extern void APIENTRY chromium.TexCoord4fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
+extern void APIENTRY chromium.TexCoord4fVertex4fvSUN (const GLfloat *, const GLfloat *);
+extern void APIENTRY chromium.TexCoord2fColor4ubVertex3fSUN (GLfloat, GLfloat, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat);
+extern void APIENTRY chromium.TexCoord2fColor4ubVertex3fvSUN (const GLfloat *, const GLubyte *, const GLfloat *);
+extern void APIENTRY chromium.TexCoord2fColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
+extern void APIENTRY chromium.TexCoord2fColor3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *);
+extern void APIENTRY chromium.TexCoord2fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
+extern void APIENTRY chromium.TexCoord2fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *);
+extern void APIENTRY chromium.TexCoord2fColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
+extern void APIENTRY chromium.TexCoord2fColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *);
+extern void APIENTRY chromium.TexCoord4fColor4fNormal3fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
+extern void APIENTRY chromium.TexCoord4fColor4fNormal3fVertex4fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *);
+extern void APIENTRY chromium.ReplacementCodeuiVertex3fSUN (GLenum, GLfloat, GLfloat, GLfloat);
+extern void APIENTRY chromium.ReplacementCodeuiVertex3fvSUN (const GLenum *, const GLfloat *);
+extern void APIENTRY chromium.ReplacementCodeuiColor4ubVertex3fSUN (GLenum, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat);
+extern void APIENTRY chromium.ReplacementCodeuiColor4ubVertex3fvSUN (const GLenum *, const GLubyte *, const GLfloat *);
+extern void APIENTRY chromium.ReplacementCodeuiColor3fVertex3fSUN (GLenum, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
+extern void APIENTRY chromium.ReplacementCodeuiColor3fVertex3fvSUN (const GLenum *, const GLfloat *, const GLfloat *);
+extern void APIENTRY chromium.ReplacementCodeuiNormal3fVertex3fSUN (GLenum, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
+extern void APIENTRY chromium.ReplacementCodeuiNormal3fVertex3fvSUN (const GLenum *, const GLfloat *, const GLfloat *);
+extern void APIENTRY chromium.ReplacementCodeuiColor4fNormal3fVertex3fSUN (GLenum, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
+extern void APIENTRY chromium.ReplacementCodeuiColor4fNormal3fVertex3fvSUN (const GLenum *, const GLfloat *, const GLfloat *, const GLfloat *);
+extern void APIENTRY chromium.ReplacementCodeuiTexCoord2fVertex3fSUN (GLenum, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
+extern void APIENTRY chromium.ReplacementCodeuiTexCoord2fVertex3fvSUN (const GLenum *, const GLfloat *, const GLfloat *);
+extern void APIENTRY chromium.ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (GLenum, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
+extern void APIENTRY chromium.ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (const GLenum *, const GLfloat *, const GLfloat *, const GLfloat *);
+extern void APIENTRY chromium.ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (GLenum, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
+extern void APIENTRY chromium.ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (const GLenum *, const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y);
+typedef void (APIENTRY * PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte *c, const GLfloat *v);
+typedef void (APIENTRY * PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRY * PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte *c, const GLfloat *v);
+typedef void (APIENTRY * PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRY * PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *v);
+typedef void (APIENTRY * PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRY * PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *n, const GLfloat *v);
+typedef void (APIENTRY * PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRY * PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *n, const GLfloat *v);
+typedef void (APIENTRY * PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRY * PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *v);
+typedef void (APIENTRY * PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (APIENTRY * PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *v);
+typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat *tc, const GLubyte *c, const GLfloat *v);
+typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *v);
+typedef void (APIENTRY * PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRY * PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *n, const GLfloat *v);
+typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
+typedef void (APIENTRY * PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (APIENTRY * PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
+typedef void (APIENTRY * PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLenum rc, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRY * PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLenum *rc, const GLfloat *v);
+typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLenum rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLenum *rc, const GLubyte *c, const GLfloat *v);
+typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLenum rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLenum *rc, const GLfloat *c, const GLfloat *v);
+typedef void (APIENTRY * PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLenum rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRY * PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLenum *rc, const GLfloat *n, const GLfloat *v);
+typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLenum rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLenum *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
+typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLenum rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLenum *rc, const GLfloat *tc, const GLfloat *v);
+typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLenum rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLenum *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v);
+typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLenum rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLenum *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
+#endif
+
+#ifndef GL_EXT_blend_func_separate
+#define GL_EXT_blend_func_separate 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.BlendFuncSeparateEXT (GLenum, GLenum, GLenum, GLenum);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+#endif
+
+#ifndef GL_INGR_color_clamp
+#define GL_INGR_color_clamp 1
+#endif
+
+#ifndef GL_INGR_interlace_read
+#define GL_INGR_interlace_read 1
+#endif
+
+#ifndef GL_EXT_stencil_wrap
+#define GL_EXT_stencil_wrap 1
+#endif
+
+#ifndef GL_EXT_422_pixels
+#define GL_EXT_422_pixels 1
+#endif
+
+#ifndef GL_NV_texgen_reflection
+#define GL_NV_texgen_reflection 1
+#endif
+
+#ifndef GL_SUN_convolution_border_modes
+#define GL_SUN_convolution_border_modes 1
+#endif
+
+#ifndef GL_EXT_texture_env_add
+#define GL_EXT_texture_env_add 1
+#endif
+
+#ifndef GL_EXT_texture_lod_bias
+#define GL_EXT_texture_lod_bias 1
+#endif
+
+#ifndef GL_EXT_texture_filter_anisotropic
+#define GL_EXT_texture_filter_anisotropic 1
+#endif
+
+#ifndef GL_EXT_vertex_weighting
+#define GL_EXT_vertex_weighting 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.VertexWeightfEXT (GLfloat);
+extern void APIENTRY chromium.VertexWeightfvEXT (const GLfloat *);
+extern void APIENTRY chromium.VertexWeightPointerEXT (GLsizei, GLenum, GLsizei, const GLvoid *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight);
+typedef void (APIENTRY * PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight);
+typedef void (APIENTRY * PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer);
+#endif
+
+#ifndef GL_NV_light_max_exponent
+#define GL_NV_light_max_exponent 1
+#endif
+
+#ifndef GL_NV_vertex_array_range
+#define GL_NV_vertex_array_range 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.FlushVertexArrayRangeNV (void);
+extern void APIENTRY chromium.VertexArrayRangeNV (GLsizei, const GLvoid *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void);
+typedef void (APIENTRY * PFNGLVERTEXARRAYRANGENVPROC) (GLsizei size, const GLvoid *pointer);
+#endif
+
+#ifndef GL_NV_vertex_array_range
+#define GL_NV_vertex_array_range2 1
+#endif
+
+#ifndef GL_NV_register_combiners
+#define GL_NV_register_combiners 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.CombinerParameterfvNV (GLenum, const GLfloat *);
+extern void APIENTRY chromium.CombinerParameterfNV (GLenum, GLfloat);
+extern void APIENTRY chromium.CombinerParameterivNV (GLenum, const GLint *);
+extern void APIENTRY chromium.CombinerParameteriNV (GLenum, GLint);
+extern void APIENTRY chromium.CombinerInputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum);
+extern void APIENTRY chromium.CombinerOutputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean);
+extern void APIENTRY chromium.FinalCombinerInputNV (GLenum, GLenum, GLenum, GLenum);
+extern void APIENTRY chromium.GetCombinerInputParameterfvNV (GLenum, GLenum, GLenum, GLenum, GLfloat *);
+extern void APIENTRY chromium.GetCombinerInputParameterivNV (GLenum, GLenum, GLenum, GLenum, GLint *);
+extern void APIENTRY chromium.GetCombinerOutputParameterfvNV (GLenum, GLenum, GLenum, GLfloat *);
+extern void APIENTRY chromium.GetCombinerOutputParameterivNV (GLenum, GLenum, GLenum, GLint *);
+extern void APIENTRY chromium.GetFinalCombinerInputParameterfvNV (GLenum, GLenum, GLfloat *);
+extern void APIENTRY chromium.GetFinalCombinerInputParameterivNV (GLenum, GLenum, GLint *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params);
+typedef void (APIENTRY * PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param);
+typedef void (APIENTRY * PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint *params);
+typedef void (APIENTRY * PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param);
+typedef void (APIENTRY * PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
+typedef void (APIENTRY * PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum);
+typedef void (APIENTRY * PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
+typedef void (APIENTRY * PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params);
+typedef void (APIENTRY * PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint *params);
+typedef void (APIENTRY * PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint *params);
+#endif
+
+#ifndef GL_NV_fog_distance
+#define GL_NV_fog_distance 1
+#endif
+
+#ifndef GL_NV_texgen_emboss
+#define GL_NV_texgen_emboss 1
+#endif
+
+#ifndef GL_NV_blend_square
+#define GL_NV_blend_square 1
+#endif
+
+#ifndef GL_NV_texture_env_combine4
+#define GL_NV_texture_env_combine4 1
+#endif
+
+#ifndef GL_MESA_resize_buffers
+#define GL_MESA_resize_buffers 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.ResizeBuffersMESA (void);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLRESIZEBUFFERSMESAPROC) (void);
+#endif
+
+#ifndef GL_MESA_window_pos
+#define GL_MESA_window_pos 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.WindowPos2dMESA (GLdouble, GLdouble);
+extern void APIENTRY chromium.WindowPos2dvMESA (const GLdouble *);
+extern void APIENTRY chromium.WindowPos2fMESA (GLfloat, GLfloat);
+extern void APIENTRY chromium.WindowPos2fvMESA (const GLfloat *);
+extern void APIENTRY chromium.WindowPos2iMESA (GLint, GLint);
+extern void APIENTRY chromium.WindowPos2ivMESA (const GLint *);
+extern void APIENTRY chromium.WindowPos2sMESA (GLshort, GLshort);
+extern void APIENTRY chromium.WindowPos2svMESA (const GLshort *);
+extern void APIENTRY chromium.WindowPos3dMESA (GLdouble, GLdouble, GLdouble);
+extern void APIENTRY chromium.WindowPos3dvMESA (const GLdouble *);
+extern void APIENTRY chromium.WindowPos3fMESA (GLfloat, GLfloat, GLfloat);
+extern void APIENTRY chromium.WindowPos3fvMESA (const GLfloat *);
+extern void APIENTRY chromium.WindowPos3iMESA (GLint, GLint, GLint);
+extern void APIENTRY chromium.WindowPos3ivMESA (const GLint *);
+extern void APIENTRY chromium.WindowPos3sMESA (GLshort, GLshort, GLshort);
+extern void APIENTRY chromium.WindowPos3svMESA (const GLshort *);
+extern void APIENTRY chromium.WindowPos4dMESA (GLdouble, GLdouble, GLdouble, GLdouble);
+extern void APIENTRY chromium.WindowPos4dvMESA (const GLdouble *);
+extern void APIENTRY chromium.WindowPos4fMESA (GLfloat, GLfloat, GLfloat, GLfloat);
+extern void APIENTRY chromium.WindowPos4fvMESA (const GLfloat *);
+extern void APIENTRY chromium.WindowPos4iMESA (GLint, GLint, GLint, GLint);
+extern void APIENTRY chromium.WindowPos4ivMESA (const GLint *);
+extern void APIENTRY chromium.WindowPos4sMESA (GLshort, GLshort, GLshort, GLshort);
+extern void APIENTRY chromium.WindowPos4svMESA (const GLshort *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y);
+typedef void (APIENTRY * PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble *v);
+typedef void (APIENTRY * PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y);
+typedef void (APIENTRY * PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat *v);
+typedef void (APIENTRY * PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y);
+typedef void (APIENTRY * PFNGLWINDOWPOS2IVMESAPROC) (const GLint *v);
+typedef void (APIENTRY * PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y);
+typedef void (APIENTRY * PFNGLWINDOWPOS2SVMESAPROC) (const GLshort *v);
+typedef void (APIENTRY * PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRY * PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble *v);
+typedef void (APIENTRY * PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRY * PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat *v);
+typedef void (APIENTRY * PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z);
+typedef void (APIENTRY * PFNGLWINDOWPOS3IVMESAPROC) (const GLint *v);
+typedef void (APIENTRY * PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z);
+typedef void (APIENTRY * PFNGLWINDOWPOS3SVMESAPROC) (const GLshort *v);
+typedef void (APIENTRY * PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRY * PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble *v);
+typedef void (APIENTRY * PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (APIENTRY * PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat *v);
+typedef void (APIENTRY * PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w);
+typedef void (APIENTRY * PFNGLWINDOWPOS4IVMESAPROC) (const GLint *v);
+typedef void (APIENTRY * PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w);
+typedef void (APIENTRY * PFNGLWINDOWPOS4SVMESAPROC) (const GLshort *v);
+#endif
+
+#ifndef GL_IBM_cull_vertex
+#define GL_IBM_cull_vertex 1
+#endif
+
+#ifndef GL_IBM_multimode_draw_arrays
+#define GL_IBM_multimode_draw_arrays 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.MultiModeDrawArraysIBM (GLenum, const GLint *, const GLsizei *, GLsizei, GLint);
+extern void APIENTRY chromium.MultiModeDrawElementsIBM (const GLenum *, const GLsizei *, GLenum, const GLvoid* *, GLsizei, GLint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLMULTIMODEDRAWARRAYSIBMPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride);
+typedef void (APIENTRY * PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount, GLint modestride);
+#endif
+
+#ifndef GL_IBM_vertex_array_lists
+#define GL_IBM_vertex_array_lists 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.ColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint);
+extern void APIENTRY chromium.SecondaryColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint);
+extern void APIENTRY chromium.EdgeFlagPointerListIBM (GLint, const GLboolean* *, GLint);
+extern void APIENTRY chromium.FogCoordPointerListIBM (GLenum, GLint, const GLvoid* *, GLint);
+extern void APIENTRY chromium.IndexPointerListIBM (GLenum, GLint, const GLvoid* *, GLint);
+extern void APIENTRY chromium.NormalPointerListIBM (GLenum, GLint, const GLvoid* *, GLint);
+extern void APIENTRY chromium.TexCoordPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint);
+extern void APIENTRY chromium.VertexPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
+typedef void (APIENTRY * PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
+typedef void (APIENTRY * PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean* *pointer, GLint ptrstride);
+typedef void (APIENTRY * PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
+typedef void (APIENTRY * PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
+typedef void (APIENTRY * PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
+typedef void (APIENTRY * PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
+typedef void (APIENTRY * PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
+#endif
+
+#ifndef GL_SGIX_subsample
+#define GL_SGIX_subsample 1
+#endif
+
+#ifndef GL_SGIX_ycrcba
+#define GL_SGIX_ycrcba 1
+#endif
+
+#ifndef GL_SGIX_ycrcb_subsample
+#define GL_SGIX_ycrcb_subsample 1
+#endif
+
+#ifndef GL_SGIX_depth_pass_instrument
+#define GL_SGIX_depth_pass_instrument 1
+#endif
+
+#ifndef GL_3DFX_texture_compression_FXT1
+#define GL_3DFX_texture_compression_FXT1 1
+#endif
+
+#ifndef GL_3DFX_multisample
+#define GL_3DFX_multisample 1
+#endif
+
+#ifndef GL_3DFX_tbuffer
+#define GL_3DFX_tbuffer 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.TbufferMask3DFX (GLuint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLTBUFFERMASK3DFXPROC) (GLuint mask);
+#endif
+
+#ifndef GL_EXT_multisample
+#define GL_EXT_multisample 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.SampleMaskEXT (GLclampf, GLboolean);
+extern void APIENTRY chromium.SamplePatternEXT (GLenum);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert);
+typedef void (APIENTRY * PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern);
+#endif
+
+#ifndef GL_SGI_vertex_preclip
+#define GL_SGI_vertex_preclip 1
+#endif
+
+#ifndef GL_SGIX_convolution_accuracy
+#define GL_SGIX_convolution_accuracy 1
+#endif
+
+#ifndef GL_SGIX_resample
+#define GL_SGIX_resample 1
+#endif
+
+#ifndef GL_SGIS_point_line_texgen
+#define GL_SGIS_point_line_texgen 1
+#endif
+
+#ifndef GL_SGIS_texture_color_mask
+#define GL_SGIS_texture_color_mask 1
+#ifdef GL_GLEXT_PROTOTYPES
+extern void APIENTRY chromium.TextureColorMaskSGIS (GLboolean, GLboolean, GLboolean, GLboolean);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRY * PFNGLTEXTURECOLORMASKSGISPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+#endif
+
+
+
+/* added by Cass -- this part will be auto-generated in the future*/
+
+
+/* Extensions */
+#define GL_ARB_texture_border_clamp       1
+#define GL_ARB_texture_env_combine        1
+#define GL_ARB_texture_env_dot3           1
+#define GL_EXT_texture_env_dot3           1
+#define GL_IBM_texture_mirrored_repeat    1
+#define GL_NV_evaluators                  1
+#define GL_NV_fence                       1
+#define GL_NV_multisample_filter_hint     1
+#define GL_NV_packed_depth_stencil        1
+#define GL_NV_register_combiners2         1
+#define GL_NV_texture_compression_vtc     1
+#define GL_NV_texture_rectangle           1
+#define GL_NV_texture_shader              1
+#define GL_NV_texture_shader2             1
+#define GL_NV_vertex_program              1
+
+/* ARB_texture_border_clamp */
+#define GL_CLAMP_TO_BORDER_ARB            0x812D
+
+/* ARB_texture_env_combine */
+#define GL_COMBINE_ARB                    0x8570
+#define GL_COMBINE_RGB_ARB                0x8571
+#define GL_COMBINE_ALPHA_ARB              0x8572
+#define GL_RGB_SCALE_ARB                  0x8573
+#define GL_ADD_SIGNED_ARB                 0x8574
+#define GL_INTERPOLATE_ARB                0x8575
+#define GL_CONSTANT_ARB                   0x8576
+#define GL_PRIMARY_COLOR_ARB              0x8577
+#define GL_PREVIOUS_ARB                   0x8578
+#define GL_SOURCE0_RGB_ARB                0x8580
+#define GL_SOURCE1_RGB_ARB                0x8581
+#define GL_SOURCE2_RGB_ARB                0x8582
+#define GL_SOURCE0_ALPHA_ARB              0x8588
+#define GL_SOURCE1_ALPHA_ARB              0x8589
+#define GL_SOURCE2_ALPHA_ARB              0x858A
+#define GL_OPERAND0_RGB_ARB               0x8590
+#define GL_OPERAND1_RGB_ARB               0x8591
+#define GL_OPERAND2_RGB_ARB               0x8592
+#define GL_OPERAND0_ALPHA_ARB             0x8598
+#define GL_OPERAND1_ALPHA_ARB             0x8599
+#define GL_OPERAND2_ALPHA_ARB             0x859A
+#define GL_SUBTRACT_ARB                   0x84E7
+
+/* ARB_texture_env_dot3 */
+#define GL_DOT3_RGB_ARB                   0x86AE
+#define GL_DOT3_RGBA_ARB                  0x86AF
+
+/* EXT_texture_env_dot3 */
+#define GL_DOT3_RGB_EXT                   0x8740
+#define GL_DOT3_RGBA_EXT                  0x8741
+
+/* IBM_texture_mirrored_repeat */
+#define GL_MIRRORED_REPEAT_IBM            0x8370
+
+/* NV_vertex_program */
+#define GL_VERTEX_PROGRAM_NV              0x8620
+#define GL_VERTEX_STATE_PROGRAM_NV        0x8621
+#define GL_ATTRIB_ARRAY_SIZE_NV           0x8623
+#define GL_ATTRIB_ARRAY_STRIDE_NV         0x8624
+#define GL_ATTRIB_ARRAY_TYPE_NV           0x8625
+#define GL_CURRENT_ATTRIB_NV              0x8626
+#define GL_PROGRAM_LENGTH_NV              0x8627
+#define GL_PROGRAM_STRING_NV              0x8628
+#define GL_MODELVIEW_PROJECTION_NV        0x8629
+#define GL_IDENTITY_NV                    0x862A
+#define GL_INVERSE_NV                     0x862B
+#define GL_TRANSPOSE_NV                   0x862C
+#define GL_INVERSE_TRANSPOSE_NV           0x862D
+#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E
+#define GL_MAX_TRACK_MATRICES_NV          0x862F
+#define GL_MATRIX0_NV                     0x8630
+#define GL_MATRIX1_NV                     0x8631
+#define GL_MATRIX2_NV                     0x8632
+#define GL_MATRIX3_NV                     0x8633
+#define GL_MATRIX4_NV                     0x8634
+#define GL_MATRIX5_NV                     0x8635
+#define GL_MATRIX6_NV                     0x8636
+#define GL_MATRIX7_NV                     0x8637
+#define GL_CURRENT_MATRIX_STACK_DEPTH_NV  0x8640
+#define GL_CURRENT_MATRIX_NV              0x8641
+#define GL_VERTEX_PROGRAM_POINT_SIZE_NV   0x8642
+#define GL_VERTEX_PROGRAM_TWO_SIDE_NV     0x8643
+#define GL_PROGRAM_PARAMETER_NV           0x8644
+#define GL_ATTRIB_ARRAY_POINTER_NV        0x8645
+#define GL_PROGRAM_TARGET_NV              0x8646
+#define GL_PROGRAM_RESIDENT_NV            0x8647
+#define GL_TRACK_MATRIX_NV                0x8648
+#define GL_TRACK_MATRIX_TRANSFORM_NV      0x8649
+#define GL_VERTEX_PROGRAM_BINDING_NV      0x864A
+#define GL_PROGRAM_ERROR_POSITION_NV      0x864B
+#define GL_VERTEX_ATTRIB_ARRAY0_NV        0x8650
+#define GL_VERTEX_ATTRIB_ARRAY1_NV        0x8651
+#define GL_VERTEX_ATTRIB_ARRAY2_NV        0x8652
+#define GL_VERTEX_ATTRIB_ARRAY3_NV        0x8653
+#define GL_VERTEX_ATTRIB_ARRAY4_NV        0x8654
+#define GL_VERTEX_ATTRIB_ARRAY5_NV        0x8655
+#define GL_VERTEX_ATTRIB_ARRAY6_NV        0x8656
+#define GL_VERTEX_ATTRIB_ARRAY7_NV        0x8657
+#define GL_VERTEX_ATTRIB_ARRAY8_NV        0x8658
+#define GL_VERTEX_ATTRIB_ARRAY9_NV        0x8659
+#define GL_VERTEX_ATTRIB_ARRAY10_NV       0x865A
+#define GL_VERTEX_ATTRIB_ARRAY11_NV       0x865B
+#define GL_VERTEX_ATTRIB_ARRAY12_NV       0x865C
+#define GL_VERTEX_ATTRIB_ARRAY13_NV       0x865D
+#define GL_VERTEX_ATTRIB_ARRAY14_NV       0x865E
+#define GL_VERTEX_ATTRIB_ARRAY15_NV       0x865F
+#define GL_MAP1_VERTEX_ATTRIB0_4_NV       0x8660
+#define GL_MAP1_VERTEX_ATTRIB1_4_NV       0x8661
+#define GL_MAP1_VERTEX_ATTRIB2_4_NV       0x8662
+#define GL_MAP1_VERTEX_ATTRIB3_4_NV       0x8663
+#define GL_MAP1_VERTEX_ATTRIB4_4_NV       0x8664
+#define GL_MAP1_VERTEX_ATTRIB5_4_NV       0x8665
+#define GL_MAP1_VERTEX_ATTRIB6_4_NV       0x8666
+#define GL_MAP1_VERTEX_ATTRIB7_4_NV       0x8667
+#define GL_MAP1_VERTEX_ATTRIB8_4_NV       0x8668
+#define GL_MAP1_VERTEX_ATTRIB9_4_NV       0x8669
+#define GL_MAP1_VERTEX_ATTRIB10_4_NV      0x866A
+#define GL_MAP1_VERTEX_ATTRIB11_4_NV      0x866B
+#define GL_MAP1_VERTEX_ATTRIB12_4_NV      0x866C
+#define GL_MAP1_VERTEX_ATTRIB13_4_NV      0x866D
+#define GL_MAP1_VERTEX_ATTRIB14_4_NV      0x866E
+#define GL_MAP1_VERTEX_ATTRIB15_4_NV      0x866F
+#define GL_MAP2_VERTEX_ATTRIB0_4_NV       0x8670
+#define GL_MAP2_VERTEX_ATTRIB1_4_NV       0x8671
+#define GL_MAP2_VERTEX_ATTRIB2_4_NV       0x8672
+#define GL_MAP2_VERTEX_ATTRIB3_4_NV       0x8673
+#define GL_MAP2_VERTEX_ATTRIB4_4_NV       0x8674
+#define GL_MAP2_VERTEX_ATTRIB5_4_NV       0x8675
+#define GL_MAP2_VERTEX_ATTRIB6_4_NV       0x8676
+#define GL_MAP2_VERTEX_ATTRIB7_4_NV       0x8677
+#define GL_MAP2_VERTEX_ATTRIB8_4_NV       0x8678
+#define GL_MAP2_VERTEX_ATTRIB9_4_NV       0x8679
+#define GL_MAP2_VERTEX_ATTRIB10_4_NV      0x867A
+#define GL_MAP2_VERTEX_ATTRIB11_4_NV      0x867B
+#define GL_MAP2_VERTEX_ATTRIB12_4_NV      0x867C
+#define GL_MAP2_VERTEX_ATTRIB13_4_NV      0x867D
+#define GL_MAP2_VERTEX_ATTRIB14_4_NV      0x867E
+#define GL_MAP2_VERTEX_ATTRIB15_4_NV      0x867F
+
+/* NV_evaluators */
+#define GL_EVAL_2D_NV                     0x86C0
+#define GL_EVAL_TRIANGULAR_2D_NV          0x86C1
+#define GL_MAP_TESSELLATION_NV            0x86C2
+#define GL_MAP_ATTRIB_U_ORDER_NV          0x86C3
+#define GL_MAP_ATTRIB_V_ORDER_NV          0x86C4
+#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5
+#define GL_EVAL_VERTEX_ATTRIB0_NV         0x86C6
+#define GL_EVAL_VERTEX_ATTRIB1_NV         0x86C7
+#define GL_EVAL_VERTEX_ATTRIB2_NV         0x86C8
+#define GL_EVAL_VERTEX_ATTRIB3_NV         0x86C9
+#define GL_EVAL_VERTEX_ATTRIB4_NV         0x86CA
+#define GL_EVAL_VERTEX_ATTRIB5_NV         0x86CB
+#define GL_EVAL_VERTEX_ATTRIB6_NV         0x86CC
+#define GL_EVAL_VERTEX_ATTRIB7_NV         0x86CD
+#define GL_EVAL_VERTEX_ATTRIB8_NV         0x86CE
+#define GL_EVAL_VERTEX_ATTRIB9_NV         0x86CF
+#define GL_EVAL_VERTEX_ATTRIB10_NV        0x86D0
+#define GL_EVAL_VERTEX_ATTRIB11_NV        0x86D1
+#define GL_EVAL_VERTEX_ATTRIB12_NV        0x86D2
+#define GL_EVAL_VERTEX_ATTRIB13_NV        0x86D3
+#define GL_EVAL_VERTEX_ATTRIB14_NV        0x86D4
+#define GL_EVAL_VERTEX_ATTRIB15_NV        0x86D5
+#define GL_MAX_MAP_TESSELLATION_NV        0x86D6
+#define GL_MAX_RATIONAL_EVAL_ORDER_NV     0x86D7
+
+/* NV_fence */
+#define GL_ALL_COMPLETED_NV               0x84F2
+#define GL_FENCE_STATUS_NV                0x84F3
+#define GL_FENCE_CONDITION_NV             0x84F4
+
+/* NV_texture_rectangle */
+#define GL_TEXTURE_RECTANGLE_NV           0x84F5
+#define GL_TEXTURE_BINDING_RECTANGLE_NV   0x84F6
+#define GL_PROXY_TEXTURE_RECTANGLE_NV     0x84F7
+#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV  0x84F8
+
+/* NV_texture_shader */
+#define GL_OFFSET_TEXTURE_RECTANGLE_NV    0x864C
+#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D
+#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E
+#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9
+#define GL_UNSIGNED_INT_S8_S8_8_8_NV      0x86DA
+#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV  0x86DB
+#define GL_DSDT_MAG_INTENSITY_NV          0x86DC
+#define GL_SHADER_CONSISTENT_NV           0x86DD
+#define GL_TEXTURE_SHADER_NV              0x86DE
+#define GL_SHADER_OPERATION_NV            0x86DF
+#define GL_CULL_MODES_NV                  0x86E0
+#define GL_OFFSET_TEXTURE_MATRIX_NV       0x86E1
+#define GL_OFFSET_TEXTURE_SCALE_NV        0x86E2
+#define GL_OFFSET_TEXTURE_BIAS_NV         0x86E3
+#define GL_OFFSET_TEXTURE_2D_MATRIX_NV    GL_OFFSET_TEXTURE_MATRIX_NV
+#define GL_OFFSET_TEXTURE_2D_SCALE_NV     GL_OFFSET_TEXTURE_SCALE_NV
+#define GL_OFFSET_TEXTURE_2D_BIAS_NV      GL_OFFSET_TEXTURE_BIAS_NV
+#define GL_PREVIOUS_TEXTURE_INPUT_NV      0x86E4
+#define GL_CONST_EYE_NV                   0x86E5
+#define GL_PASS_THROUGH_NV                0x86E6
+#define GL_CULL_FRAGMENT_NV               0x86E7
+#define GL_OFFSET_TEXTURE_2D_NV           0x86E8
+#define GL_DEPENDENT_AR_TEXTURE_2D_NV     0x86E9
+#define GL_DEPENDENT_GB_TEXTURE_2D_NV     0x86EA
+#define GL_DOT_PRODUCT_NV                 0x86EC
+#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV   0x86ED
+#define GL_DOT_PRODUCT_TEXTURE_2D_NV      0x86EE
+#define GL_DOT_PRODUCT_TEXTURE_3D_NV      0x86EF
+#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0
+#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1
+#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2
+#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3
+#define GL_HILO_NV                        0x86F4
+#define GL_DSDT_NV                        0x86F5
+#define GL_DSDT_MAG_NV                    0x86F6
+#define GL_DSDT_MAG_VIB_NV                0x86F7
+#define GL_HILO16_NV                      0x86F8
+#define GL_SIGNED_HILO_NV                 0x86F9
+#define GL_SIGNED_HILO16_NV               0x86FA
+#define GL_SIGNED_RGBA_NV                 0x86FB
+#define GL_SIGNED_RGBA8_NV                0x86FC
+#define GL_SIGNED_RGB_NV                  0x86FE
+#define GL_SIGNED_RGB8_NV                 0x86FF
+#define GL_SIGNED_LUMINANCE_NV            0x8701
+#define GL_SIGNED_LUMINANCE8_NV           0x8702
+#define GL_SIGNED_LUMINANCE_ALPHA_NV      0x8703
+#define GL_SIGNED_LUMINANCE8_ALPHA8_NV    0x8704
+#define GL_SIGNED_ALPHA_NV                0x8705
+#define GL_SIGNED_ALPHA8_NV               0x8706
+#define GL_SIGNED_INTENSITY_NV            0x8707
+#define GL_SIGNED_INTENSITY8_NV           0x8708
+#define GL_DSDT8_NV                       0x8709
+#define GL_DSDT8_MAG8_NV                  0x870A
+#define GL_DSDT8_MAG8_INTENSITY8_NV       0x870B
+#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV   0x870C
+#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D
+#define GL_HI_SCALE_NV                    0x870E
+#define GL_LO_SCALE_NV                    0x870F
+#define GL_DS_SCALE_NV                    0x8710
+#define GL_DT_SCALE_NV                    0x8711
+#define GL_MAGNITUDE_SCALE_NV             0x8712
+#define GL_VIBRANCE_SCALE_NV              0x8713
+#define GL_HI_BIAS_NV                     0x8714
+#define GL_LO_BIAS_NV                     0x8715
+#define GL_DS_BIAS_NV                     0x8716
+#define GL_DT_BIAS_NV                     0x8717
+#define GL_MAGNITUDE_BIAS_NV              0x8718
+#define GL_VIBRANCE_BIAS_NV               0x8719
+#define GL_TEXTURE_BORDER_VALUES_NV       0x871A
+#define GL_TEXTURE_HI_SIZE_NV             0x871B
+#define GL_TEXTURE_LO_SIZE_NV             0x871C
+#define GL_TEXTURE_DS_SIZE_NV             0x871D
+#define GL_TEXTURE_DT_SIZE_NV             0x871E
+#define GL_TEXTURE_MAG_SIZE_NV            0x871F
+
+/* NV_texture_shader2 */
+#define GL_DOT_PRODUCT_TEXTURE_3D_NV      0x86EF
+
+/* NV_register_combiners2 */
+#define GL_PER_STAGE_CONSTANTS_NV         0x8535
+
+/* NV_packed_depth_stencil */
+#define GL_DEPTH_STENCIL_NV               0x84F9
+#define GL_UNSIGNED_INT_24_8_NV           0x84FA
+
+/* NV_multisample_filter_hint */
+#define GL_MULTISAMPLE_FILTER_HINT_NV     0x8534
+
+/* NV_texture_compression_vtc */
+
+/* NV_vertex_program */
+typedef GLboolean (APIENTRY * PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint *programs, GLboolean *residences);
+typedef void (APIENTRY * PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id);
+typedef void (APIENTRY * PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint *programs);
+typedef void (APIENTRY * PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat *params);
+typedef void (APIENTRY * PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint *programs);
+typedef void (APIENTRY * PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble *params);
+typedef void (APIENTRY * PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint *params);
+typedef void (APIENTRY * PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte *program);
+typedef void (APIENTRY * PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint *params);
+typedef void (APIENTRY * PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble *params);
+typedef void (APIENTRY * PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint *params);
+typedef void (APIENTRY * PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, GLvoid* *pointer);
+typedef GLboolean (APIENTRY * PFNGLISPROGRAMNVPROC) (GLuint id);
+typedef void (APIENTRY * PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte *program);
+typedef void (APIENTRY * PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRY * PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble *v);
+typedef void (APIENTRY * PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (APIENTRY * PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat *v);
+typedef void (APIENTRY * PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLdouble *v);
+typedef void (APIENTRY * PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *v);
+typedef void (APIENTRY * PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, const GLuint *programs);
+typedef void (APIENTRY * PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform);
+typedef void (APIENTRY * PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer);
+typedef void (APIENTRY * PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x);
+typedef void (APIENTRY * PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRY * PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x);
+typedef void (APIENTRY * PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat *v);
+typedef void (APIENTRY * PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x);
+typedef void (APIENTRY * PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRY * PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y);
+typedef void (APIENTRY * PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRY * PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y);
+typedef void (APIENTRY * PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat *v);
+typedef void (APIENTRY * PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y);
+typedef void (APIENTRY * PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRY * PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRY * PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRY * PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRY * PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat *v);
+typedef void (APIENTRY * PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z);
+typedef void (APIENTRY * PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRY * PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRY * PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRY * PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (APIENTRY * PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat *v);
+typedef void (APIENTRY * PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
+typedef void (APIENTRY * PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRY * PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte *v);
+typedef void (APIENTRY * PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
+typedef void (APIENTRY * PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
+typedef void (APIENTRY * PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
+typedef void (APIENTRY * PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
+typedef void (APIENTRY * PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
+typedef void (APIENTRY * PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
+typedef void (APIENTRY * PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
+typedef void (APIENTRY * PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
+typedef void (APIENTRY * PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
+typedef void (APIENTRY * PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
+typedef void (APIENTRY * PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
+typedef void (APIENTRY * PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
+typedef void (APIENTRY * PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei count, const GLubyte *v);
+
+/* NV_evaluators */
+typedef void (APIENTRY * PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const GLvoid *points);
+typedef void (APIENTRY * PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRY * PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat *params);
+typedef void (APIENTRY * PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, GLvoid *points);
+typedef void (APIENTRY * PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRY * PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params);
+typedef void (APIENTRY * PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode);
+
+/* NV_fence */
+typedef void (APIENTRY * PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences);
+typedef void (APIENTRY * PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences);
+typedef GLboolean (APIENTRY * PFNGLISFENCENVPROC) (GLuint fence);
+typedef GLboolean (APIENTRY * PFNGLTESTFENCENVPROC) (GLuint fence);
+typedef void (APIENTRY * PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params);
+typedef void (APIENTRY * PFNGLFINISHFENCENVPROC) (GLuint fence);
+typedef void (APIENTRY * PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
+
+
+/* NV_register_combiners2 */
+typedef void (APIENTRY * PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat *params);
+typedef void (APIENTRY * PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat *params);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+

+ 5 - 0
panda/src/crgsg/crgsg_composite1.cxx

@@ -0,0 +1,5 @@
+
+#include "config_crgsg.cxx"
+#include "crSavedFrameBuffer.cxx"
+#include "crGeomNodeContext.cxx"
+#include "crTextureContext.cxx"

+ 6 - 0
panda/src/crgsg/index.html

@@ -0,0 +1,6 @@
+
+<h1>        CR GSG          </h1>
+
+<p> The Chromium Graphics State Guardian. </p>
+
+<p> CR is an abbreviation for Chromium. <p>

+ 9 - 0
panda/src/wcrdisplay/index.html

@@ -0,0 +1,9 @@
+<h3>wcrdisplay</h3>
+Windows Chromium Display
+<p>
+This directory contains pipe and window creation code for using 
+<a href="http://sourceforge.net/projects/chromium">chromium</a> within
+panda.
+<p>
+The plan is that chromium (network gl) and gl (local gl) will 
+run together.