From a4ec5410595ddf37bfbc0e85ad87d31a9cbf94f1 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 29 Dec 2007 20:47:08 +0000 Subject: [PATCH] Windows compatibility: - Tweak includes - Fetch all functions from OpenGL 1.2+ with get_proc_address --- Build | 13 +++- extgen.py | 3 +- source/arb_shader_objects.h | 3 +- source/arb_vertex_buffer_object.cpp | 35 ++++++++++ source/arb_vertex_buffer_object.h | 27 +++++++ source/arb_vertex_shader.h | 3 +- source/batch.cpp | 7 +- source/batch.h | 1 - source/color.h | 2 - source/ext_framebuffer_object.h | 3 +- source/extension.cpp | 41 ++++++++++- source/extension.h | 17 +++++ source/font.cpp | 5 +- source/framebuffer.h | 2 +- source/gl.h | 16 +++++ source/material.cpp | 1 + source/matrix.h | 2 +- source/misc.h | 2 +- source/pixelformat.h | 2 +- source/predicate.h | 2 +- source/primitivetype.h | 2 +- source/program.h | 2 +- source/projection.cpp | 20 +++--- source/rendermode.h | 2 +- source/select.cpp | 8 +-- source/select.h | 1 + source/shader.h | 2 +- source/stencil.h | 2 +- source/tests.h | 2 +- source/texture.h | 2 +- source/texture3d.cpp | 5 +- source/texunit.cpp | 12 ++-- source/transform.cpp | 2 +- source/version_1_2.cpp | 89 +++++++++++++++++++++++ source/version_1_2.h | 54 ++++++++++++++ source/version_1_3.cpp | 105 ++++++++++++++++++++++++++++ source/version_1_3.h | 62 ++++++++++++++++ source/vertexarray.cpp | 2 +- source/vertexbuffer.cpp | 18 ++--- 39 files changed, 522 insertions(+), 57 deletions(-) create mode 100644 source/arb_vertex_buffer_object.cpp create mode 100644 source/arb_vertex_buffer_object.h create mode 100644 source/gl.h create mode 100644 source/version_1_2.cpp create mode 100644 source/version_1_2.h create mode 100644 source/version_1_3.cpp create mode 100644 source/version_1_3.h diff --git a/Build b/Build index b83b3c7c..37e2ef7d 100644 --- a/Build +++ b/Build @@ -5,7 +5,18 @@ package "mspgl" description "C++ wrappers for OpenGL"; version "0.1"; - require "opengl"; + // A bit of a hack until I get something better in builder + if "arch!=win32" + { + require "opengl"; + }; + if "arch=win32" + { + build_info + { + library "opengl32"; + }; + }; require "mspdatafile"; require "devil"; build_info diff --git a/extgen.py b/extgen.py index 10980286..2d64cba7 100755 --- a/extgen.py +++ b/extgen.py @@ -24,7 +24,8 @@ out.write("#ifndef MSP_GL_%s_\n"%ext.upper()) out.write("#define MSP_GL_%s_\n"%ext.upper()) out.write(""" -#include +#include "gl.h" +#include namespace Msp { namespace GL { diff --git a/source/arb_shader_objects.h b/source/arb_shader_objects.h index 56200a9f..e256d068 100644 --- a/source/arb_shader_objects.h +++ b/source/arb_shader_objects.h @@ -1,7 +1,8 @@ #ifndef MSP_GL_ARB_SHADER_OBJECTS_ #define MSP_GL_ARB_SHADER_OBJECTS_ -#include +#include "gl.h" +#include namespace Msp { namespace GL { diff --git a/source/arb_vertex_buffer_object.cpp b/source/arb_vertex_buffer_object.cpp new file mode 100644 index 00000000..6e98fef0 --- /dev/null +++ b/source/arb_vertex_buffer_object.cpp @@ -0,0 +1,35 @@ +#include "extension.h" +#include "arb_vertex_buffer_object.h" + +namespace Msp { +namespace GL { + +PFNGLBINDBUFFERARBPROC glBindBufferARB=0; +PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB=0; +PFNGLGENBUFFERSARBPROC glGenBuffersARB=0; +PFNGLISBUFFERARBPROC glIsBufferARB=0; +PFNGLBUFFERDATAARBPROC glBufferDataARB=0; +PFNGLBUFFERSUBDATAARBPROC glBufferSubDataARB=0; +PFNGLGETBUFFERSUBDATAARBPROC glGetBufferSubDataARB=0; +PFNGLMAPBUFFERARBPROC glMapBufferARB=0; +PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB=0; +PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameterivARB=0; +PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointervARB=0; + +void init_arb_vertex_buffer_object() +{ + glBindBufferARB=reinterpret_cast(get_proc_address("glBindBufferARB")); + glDeleteBuffersARB=reinterpret_cast(get_proc_address("glDeleteBuffersARB")); + glGenBuffersARB=reinterpret_cast(get_proc_address("glGenBuffersARB")); + glIsBufferARB=reinterpret_cast(get_proc_address("glIsBufferARB")); + glBufferDataARB=reinterpret_cast(get_proc_address("glBufferDataARB")); + glBufferSubDataARB=reinterpret_cast(get_proc_address("glBufferSubDataARB")); + glGetBufferSubDataARB=reinterpret_cast(get_proc_address("glGetBufferSubDataARB")); + glMapBufferARB=reinterpret_cast(get_proc_address("glMapBufferARB")); + glUnmapBufferARB=reinterpret_cast(get_proc_address("glUnmapBufferARB")); + glGetBufferParameterivARB=reinterpret_cast(get_proc_address("glGetBufferParameterivARB")); + glGetBufferPointervARB=reinterpret_cast(get_proc_address("glGetBufferPointervARB")); +} + +} // namespace GL +} // namespace Msp diff --git a/source/arb_vertex_buffer_object.h b/source/arb_vertex_buffer_object.h new file mode 100644 index 00000000..8d3be978 --- /dev/null +++ b/source/arb_vertex_buffer_object.h @@ -0,0 +1,27 @@ +#ifndef MSP_GL_ARB_VERTEX_BUFFER_OBJECT_ +#define MSP_GL_ARB_VERTEX_BUFFER_OBJECT_ + +#include "gl.h" +#include + +namespace Msp { +namespace GL { + +extern PFNGLBINDBUFFERARBPROC glBindBufferARB; +extern PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB; +extern PFNGLGENBUFFERSARBPROC glGenBuffersARB; +extern PFNGLISBUFFERARBPROC glIsBufferARB; +extern PFNGLBUFFERDATAARBPROC glBufferDataARB; +extern PFNGLBUFFERSUBDATAARBPROC glBufferSubDataARB; +extern PFNGLGETBUFFERSUBDATAARBPROC glGetBufferSubDataARB; +extern PFNGLMAPBUFFERARBPROC glMapBufferARB; +extern PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB; +extern PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameterivARB; +extern PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointervARB; + +void init_arb_vertex_buffer_object(); + +} // namespace GL +} // namespace Msp + +#endif diff --git a/source/arb_vertex_shader.h b/source/arb_vertex_shader.h index bc447a35..6dab0c0a 100644 --- a/source/arb_vertex_shader.h +++ b/source/arb_vertex_shader.h @@ -1,7 +1,8 @@ #ifndef MSP_GL_ARB_VERTEX_SHADER_ #define MSP_GL_ARB_VERTEX_SHADER_ -#include +#include "gl.h" +#include namespace Msp { namespace GL { diff --git a/source/batch.cpp b/source/batch.cpp index df4e2fb8..385b4697 100644 --- a/source/batch.cpp +++ b/source/batch.cpp @@ -5,8 +5,9 @@ Copyright © 2007 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ -#define GL_GLEXT_PROTOTYPES #include "batch.h" +#include "extension.h" +#include "version_1_2.h" using namespace std; @@ -17,7 +18,9 @@ Batch::Batch(PrimitiveType t): type(t), min_index(0), max_index(0) -{ } +{ + require_version(1, 2); +} Batch &Batch::append(uint i) { diff --git a/source/batch.h b/source/batch.h index 237995dc..4a2e4b34 100644 --- a/source/batch.h +++ b/source/batch.h @@ -9,7 +9,6 @@ Distributed under the LGPL #define MSP_GL_BATCH_H_ #include -#include #include #include "primitivetype.h" #include "types.h" diff --git a/source/color.h b/source/color.h index d3710a9d..2c48cd49 100644 --- a/source/color.h +++ b/source/color.h @@ -8,8 +8,6 @@ Distributed under the LGPL #ifndef MSP_GL_COLOR_H_ #define MSP_GL_COLOR_H_ -#include - namespace Msp { namespace GL { diff --git a/source/ext_framebuffer_object.h b/source/ext_framebuffer_object.h index f541c2ff..a92b3056 100644 --- a/source/ext_framebuffer_object.h +++ b/source/ext_framebuffer_object.h @@ -1,7 +1,8 @@ #ifndef MSP_GL_EXT_FRAMEBUFFER_OBJECT_ #define MSP_GL_EXT_FRAMEBUFFER_OBJECT_ -#include +#include "gl.h" +#include namespace Msp { namespace GL { diff --git a/source/extension.cpp b/source/extension.cpp index e250bb24..a5ad3191 100644 --- a/source/extension.cpp +++ b/source/extension.cpp @@ -6,16 +6,20 @@ Distributed under the LGPL */ #include -#include #ifndef WIN32 #include #endif +#include #include #include "arb_shader_objects.h" +#include "arb_vertex_buffer_object.h" #include "arb_vertex_shader.h" #include "ext_framebuffer_object.h" #include "except.h" #include "extension.h" +#include "gl.h" +#include "version_1_2.h" +#include "version_1_3.h" using namespace std; @@ -43,6 +47,8 @@ bool is_supported(const string &ext) init_arb_vertex_shader(); if(extensions.count("GL_EXT_framebuffer_object")) init_ext_framebuffer_object(); + if(extensions.count("GL_ARB_vertex_buffer_object")) + init_arb_vertex_buffer_object(); init_done=true; } @@ -50,16 +56,47 @@ bool is_supported(const string &ext) return extensions.count(ext); } +const Version &get_gl_version() +{ + static Version version; + static bool init_done=false; + + if(!init_done) + { + string gl_ver=reinterpret_cast(glGetString(GL_VERSION)); + vector parts=split(gl_ver.substr(0, gl_ver.find(' ')), '.'); + version.major=lexical_cast(parts[0]); + version.minor=lexical_cast(parts[1]); + + unsigned combined=version.major*0x100+version.minor; + if(combined>=0x102) + init_version_1_2(); + if(combined>=0x103) + init_version_1_3(); + } + + return version; +} + void require_extension(const string &ext) { if(!is_supported(ext)) - throw UnsupportedExtension(ext+" is not supported"); + throw UnsupportedExtension(ext); +} + +void require_version(unsigned a, unsigned b) +{ + const Version &ver=get_gl_version(); + if(ver.major(name.c_str())); +#else + return reinterpret_cast(wglGetProcAddress(name.c_str())); #endif } diff --git a/source/extension.h b/source/extension.h index d6eb75f6..aec516e2 100644 --- a/source/extension.h +++ b/source/extension.h @@ -13,6 +13,12 @@ Distributed under the LGPL namespace Msp { namespace GL { +struct Version +{ + unsigned short major; + unsigned short minor; +}; + typedef void ExtFunc(); /** @@ -21,11 +27,22 @@ functions of that extension are safe to use. */ bool is_supported(const std::string &); +/** +Returns the OpenGL version number, as reported by the implementation. +Functions up to the returned version are safe to use. +*/ +const Version &get_gl_version(); + /** Checks that an extension is supported and throws if it isn't. */ void require_extension(const std::string &); +/** +Checks that the OpenGL version is at least a.b and throws if it isn't. +*/ +void require_version(unsigned a, unsigned b); + /** Returns the address of an extension function. */ diff --git a/source/font.cpp b/source/font.cpp index 60090e01..637569f2 100644 --- a/source/font.cpp +++ b/source/font.cpp @@ -5,7 +5,7 @@ Copyright © 2007 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ -#include +#include "gl.h" #include "font.h" #include "texture2d.h" @@ -105,6 +105,9 @@ void Font::draw_glyph(unsigned code) const if(i==glyphs.end()) return; + const Glyph &glyph=i->second; + (void)glyph; + glDrawArrays(GL_QUADS, i->second.index*4, 4); glTranslatef(i->second.advance, 0, 0); diff --git a/source/framebuffer.h b/source/framebuffer.h index 8563d2f9..437ac1af 100644 --- a/source/framebuffer.h +++ b/source/framebuffer.h @@ -8,7 +8,7 @@ Distributed under the LGPL #ifndef MSP_GL_FRAMEBUFFER_H_ #define MSP_GL_FRAMEBUFFER_H_ -#include +#include "gl.h" #include "types.h" namespace Msp { diff --git a/source/gl.h b/source/gl.h new file mode 100644 index 00000000..c033a377 --- /dev/null +++ b/source/gl.h @@ -0,0 +1,16 @@ +/* $Id$ + +This file is part of libmspgl +Copyright © 2007 Mikko Rasa, Mikkosoft Productions +Distributed under the LGPL +*/ + +#ifndef MSP_GL_GL_H_ +#define MSP_GL_GL_H_ + +#ifdef WIN32 +#include +#endif +#include + +#endif diff --git a/source/material.cpp b/source/material.cpp index f165c744..0b888ef5 100644 --- a/source/material.cpp +++ b/source/material.cpp @@ -5,6 +5,7 @@ Copyright © 2007 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ +#include "gl.h" #include "material.h" namespace Msp { diff --git a/source/matrix.h b/source/matrix.h index b4cc339c..fe67ad7e 100644 --- a/source/matrix.h +++ b/source/matrix.h @@ -8,7 +8,7 @@ Distributed under the LGPL #ifndef MSP_GL_MATRIX_H_ #define MSP_GL_MATRIX_H_ -#include +#include "gl.h" namespace Msp { namespace GL { diff --git a/source/misc.h b/source/misc.h index 071875cd..8a956a5a 100644 --- a/source/misc.h +++ b/source/misc.h @@ -8,7 +8,7 @@ Distributed under the LGPL #ifndef MSP_GL_MISC_H_ #define MSP_GL_MISC_H_ -#include +#include "gl.h" namespace Msp { namespace GL { diff --git a/source/pixelformat.h b/source/pixelformat.h index 87cbe754..6579700d 100644 --- a/source/pixelformat.h +++ b/source/pixelformat.h @@ -8,7 +8,7 @@ Distributed under the LGPL #ifndef MSP_GL_PIXELFORMAT_H_ #define MSP_GL_PIXELFORMAT_H_ -#include +#include "gl.h" namespace Msp { namespace GL { diff --git a/source/predicate.h b/source/predicate.h index f5ff3b3c..707bc5d5 100644 --- a/source/predicate.h +++ b/source/predicate.h @@ -8,7 +8,7 @@ Distributed under the LGPL #ifndef MSP_GL_PREDICATE_H_ #define MSP_GL_PREDICATE_H_ -#include +#include "gl.h" namespace Msp { namespace GL { diff --git a/source/primitivetype.h b/source/primitivetype.h index 40018525..f4f665e3 100644 --- a/source/primitivetype.h +++ b/source/primitivetype.h @@ -9,7 +9,7 @@ Distributed under the LGPL #define MSP_GL_PRIMITIVETYPE_H_ #include -#include +#include "gl.h" namespace Msp { namespace GL { diff --git a/source/program.h b/source/program.h index 3b86a9c6..82d06a10 100644 --- a/source/program.h +++ b/source/program.h @@ -10,8 +10,8 @@ Distributed under the LGPL #include #include -#include #include +#include "gl.h" #include "types.h" namespace Msp { diff --git a/source/projection.cpp b/source/projection.cpp index 3a8baf84..2c234525 100644 --- a/source/projection.cpp +++ b/source/projection.cpp @@ -6,15 +6,15 @@ Distributed under the LGPL */ #include -#include +#include "gl.h" #include "projection.h" namespace Msp { namespace GL { -void ortho(double left, double right, double bottom, double top, double near, double far) +void ortho(double left, double right, double bottom, double top, double nearr, double farr) { - glOrtho(left, right, bottom, top, near, far); + glOrtho(left, right, bottom, top, nearr, farr); } void ortho_centered(double width, double height) @@ -32,20 +32,20 @@ void ortho_topleft(double width, double height) ortho(0, width, height, 0, 0, 1); } -void frustum(double left, double right, double bottom, double top, double near, double far) +void frustum(double left, double right, double bottom, double top, double nearr, double farr) { - glFrustum(left, right, bottom, top, near, far); + glFrustum(left, right, bottom, top, nearr, farr); } -void frustum_centered(double width, double height, double near, double far) +void frustum_centered(double width, double height, double nearr, double farr) { - glFrustum(-width/2, width/2, -height/2, height/2, near, far); + glFrustum(-width/2, width/2, -height/2, height/2, nearr, farr); } -void perspective(double fov_y, double aspect, double near, double far) +void perspective(double fov_y, double aspect, double nearr, double farr) { - double hh=tan(fov_y*M_PI/360)*near; - frustum(-hh*aspect, hh*aspect, -hh, hh, near, far); + double hh=tan(fov_y*M_PI/360)*nearr; + frustum(-hh*aspect, hh*aspect, -hh, hh, nearr, farr); } } // namespace GL diff --git a/source/rendermode.h b/source/rendermode.h index be893b21..235dde5e 100644 --- a/source/rendermode.h +++ b/source/rendermode.h @@ -8,7 +8,7 @@ Distributed under the LGPL #ifndef MSP_GL_RENDERMODE_H_ #define MSP_GL_RENDERMODE_H_ -#include +#include "gl.h" namespace Msp { namespace GL { diff --git a/source/select.cpp b/source/select.cpp index 67420977..e7037cbf 100644 --- a/source/select.cpp +++ b/source/select.cpp @@ -5,18 +5,16 @@ Copyright © 2007 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ -#include #include "except.h" +#include "gl.h" #include "select.h" using namespace std; namespace { -using namespace Msp::GL; - -vector *select_buf=0; -vector select_buf_int; +vector *select_buf=0; +vector select_buf_int; } diff --git a/source/select.h b/source/select.h index 2ca28193..3964b894 100644 --- a/source/select.h +++ b/source/select.h @@ -9,6 +9,7 @@ Distributed under the LGPL #define MSP_GL_SELECT_H_ #include +#include "types.h" namespace Msp { namespace GL { diff --git a/source/shader.h b/source/shader.h index dfa5af3b..cd01f2ac 100644 --- a/source/shader.h +++ b/source/shader.h @@ -9,7 +9,7 @@ Distributed under the LGPL #define MSP_GL_SHADER_H_ #include -#include +#include "gl.h" #include "types.h" namespace Msp { diff --git a/source/stencil.h b/source/stencil.h index 6efb0577..4d4ee6d3 100644 --- a/source/stencil.h +++ b/source/stencil.h @@ -8,7 +8,7 @@ Distributed under the LGPL #ifndef MSP_GL_STENCIL_H_ #define MSP_GL_STENCIL_H_ -#include +#include "gl.h" #include "predicate.h" #include "types.h" diff --git a/source/tests.h b/source/tests.h index 0fa05b46..223396fe 100644 --- a/source/tests.h +++ b/source/tests.h @@ -8,7 +8,7 @@ Distributed under the LGPL #ifndef MSP_GL_TESTS_H_ #define MSP_GL_TESTS_H_ -#include +#include "gl.h" #include "predicate.h" #include "types.h" diff --git a/source/texture.h b/source/texture.h index 6c3541d4..28f9cb32 100644 --- a/source/texture.h +++ b/source/texture.h @@ -8,7 +8,7 @@ Distributed under the LGPL #ifndef MSP_GL_TEXTURE_H_ #define MSP_GL_TEXTURE_H_ -#include +#include "gl.h" #include "types.h" namespace Msp { diff --git a/source/texture3d.cpp b/source/texture3d.cpp index 858ca478..17adb6a1 100644 --- a/source/texture3d.cpp +++ b/source/texture3d.cpp @@ -5,11 +5,12 @@ Copyright © 2007 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ -#define GL_GLEXT_PROTOTYPES #include #include "except.h" +#include "extension.h" #include "ilwrap.h" #include "texture3d.h" +#include "version_1_2.h" using namespace std; @@ -21,6 +22,8 @@ Texture3D::Texture3D(): height(0), depth(0) { + require_version(1, 3); + target=GL_TEXTURE_3D; bind(); } diff --git a/source/texunit.cpp b/source/texunit.cpp index 91a33ecc..bda75991 100644 --- a/source/texunit.cpp +++ b/source/texunit.cpp @@ -5,10 +5,10 @@ Copyright © 2007 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ -#define GL_GLEXT_PROTOTYPES -#include -#include +#include "extension.h" +#include "gl.h" #include "texunit.h" +#include "version_1_3.h" using namespace std; @@ -17,7 +17,9 @@ namespace GL { TexUnit::TexUnit(): texture(0) -{ } +{ + require_version(1, 3); +} bool TexUnit::set_texture(const Texture *tex) { @@ -31,7 +33,7 @@ TexUnit &TexUnit::activate(unsigned n) if(units.size()<=n) units.resize(n+1); - glActiveTextureARB(GL_TEXTURE0+n); + glActiveTexture(GL_TEXTURE0+n); cur_unit=&units[n]; return units[n]; diff --git a/source/transform.cpp b/source/transform.cpp index 78c3fb0f..98932b83 100644 --- a/source/transform.cpp +++ b/source/transform.cpp @@ -5,7 +5,7 @@ Copyright © 2007 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ -#include +#include "gl.h" #include "transform.h" namespace Msp { diff --git a/source/version_1_2.cpp b/source/version_1_2.cpp new file mode 100644 index 00000000..d7c2734d --- /dev/null +++ b/source/version_1_2.cpp @@ -0,0 +1,89 @@ +#include "extension.h" +#include "version_1_2.h" + +namespace Msp { +namespace GL { + +PFNGLBLENDCOLORPROC glBlendColor=0; +PFNGLBLENDEQUATIONPROC glBlendEquation=0; +PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements=0; +PFNGLCOLORTABLEPROC glColorTable=0; +PFNGLCOLORTABLEPARAMETERFVPROC glColorTableParameterfv=0; +PFNGLCOLORTABLEPARAMETERIVPROC glColorTableParameteriv=0; +PFNGLCOPYCOLORTABLEPROC glCopyColorTable=0; +PFNGLGETCOLORTABLEPROC glGetColorTable=0; +PFNGLGETCOLORTABLEPARAMETERFVPROC glGetColorTableParameterfv=0; +PFNGLGETCOLORTABLEPARAMETERIVPROC glGetColorTableParameteriv=0; +PFNGLCOLORSUBTABLEPROC glColorSubTable=0; +PFNGLCOPYCOLORSUBTABLEPROC glCopyColorSubTable=0; +PFNGLCONVOLUTIONFILTER1DPROC glConvolutionFilter1D=0; +PFNGLCONVOLUTIONFILTER2DPROC glConvolutionFilter2D=0; +PFNGLCONVOLUTIONPARAMETERFPROC glConvolutionParameterf=0; +PFNGLCONVOLUTIONPARAMETERFVPROC glConvolutionParameterfv=0; +PFNGLCONVOLUTIONPARAMETERIPROC glConvolutionParameteri=0; +PFNGLCONVOLUTIONPARAMETERIVPROC glConvolutionParameteriv=0; +PFNGLCOPYCONVOLUTIONFILTER1DPROC glCopyConvolutionFilter1D=0; +PFNGLCOPYCONVOLUTIONFILTER2DPROC glCopyConvolutionFilter2D=0; +PFNGLGETCONVOLUTIONFILTERPROC glGetConvolutionFilter=0; +PFNGLGETCONVOLUTIONPARAMETERFVPROC glGetConvolutionParameterfv=0; +PFNGLGETCONVOLUTIONPARAMETERIVPROC glGetConvolutionParameteriv=0; +PFNGLGETSEPARABLEFILTERPROC glGetSeparableFilter=0; +PFNGLSEPARABLEFILTER2DPROC glSeparableFilter2D=0; +PFNGLGETHISTOGRAMPROC glGetHistogram=0; +PFNGLGETHISTOGRAMPARAMETERFVPROC glGetHistogramParameterfv=0; +PFNGLGETHISTOGRAMPARAMETERIVPROC glGetHistogramParameteriv=0; +PFNGLGETMINMAXPROC glGetMinmax=0; +PFNGLGETMINMAXPARAMETERFVPROC glGetMinmaxParameterfv=0; +PFNGLGETMINMAXPARAMETERIVPROC glGetMinmaxParameteriv=0; +PFNGLHISTOGRAMPROC glHistogram=0; +PFNGLMINMAXPROC glMinmax=0; +PFNGLRESETHISTOGRAMPROC glResetHistogram=0; +PFNGLRESETMINMAXPROC glResetMinmax=0; +PFNGLTEXIMAGE3DPROC glTexImage3D=0; +PFNGLTEXSUBIMAGE3DPROC glTexSubImage3D=0; +PFNGLCOPYTEXSUBIMAGE3DPROC glCopyTexSubImage3D=0; + +void init_version_1_2() +{ + glBlendColor=reinterpret_cast(get_proc_address("glBlendColor")); + glBlendEquation=reinterpret_cast(get_proc_address("glBlendEquation")); + glDrawRangeElements=reinterpret_cast(get_proc_address("glDrawRangeElements")); + glColorTable=reinterpret_cast(get_proc_address("glColorTable")); + glColorTableParameterfv=reinterpret_cast(get_proc_address("glColorTableParameterfv")); + glColorTableParameteriv=reinterpret_cast(get_proc_address("glColorTableParameteriv")); + glCopyColorTable=reinterpret_cast(get_proc_address("glCopyColorTable")); + glGetColorTable=reinterpret_cast(get_proc_address("glGetColorTable")); + glGetColorTableParameterfv=reinterpret_cast(get_proc_address("glGetColorTableParameterfv")); + glGetColorTableParameteriv=reinterpret_cast(get_proc_address("glGetColorTableParameteriv")); + glColorSubTable=reinterpret_cast(get_proc_address("glColorSubTable")); + glCopyColorSubTable=reinterpret_cast(get_proc_address("glCopyColorSubTable")); + glConvolutionFilter1D=reinterpret_cast(get_proc_address("glConvolutionFilter1D")); + glConvolutionFilter2D=reinterpret_cast(get_proc_address("glConvolutionFilter2D")); + glConvolutionParameterf=reinterpret_cast(get_proc_address("glConvolutionParameterf")); + glConvolutionParameterfv=reinterpret_cast(get_proc_address("glConvolutionParameterfv")); + glConvolutionParameteri=reinterpret_cast(get_proc_address("glConvolutionParameteri")); + glConvolutionParameteriv=reinterpret_cast(get_proc_address("glConvolutionParameteriv")); + glCopyConvolutionFilter1D=reinterpret_cast(get_proc_address("glCopyConvolutionFilter1D")); + glCopyConvolutionFilter2D=reinterpret_cast(get_proc_address("glCopyConvolutionFilter2D")); + glGetConvolutionFilter=reinterpret_cast(get_proc_address("glGetConvolutionFilter")); + glGetConvolutionParameterfv=reinterpret_cast(get_proc_address("glGetConvolutionParameterfv")); + glGetConvolutionParameteriv=reinterpret_cast(get_proc_address("glGetConvolutionParameteriv")); + glGetSeparableFilter=reinterpret_cast(get_proc_address("glGetSeparableFilter")); + glSeparableFilter2D=reinterpret_cast(get_proc_address("glSeparableFilter2D")); + glGetHistogram=reinterpret_cast(get_proc_address("glGetHistogram")); + glGetHistogramParameterfv=reinterpret_cast(get_proc_address("glGetHistogramParameterfv")); + glGetHistogramParameteriv=reinterpret_cast(get_proc_address("glGetHistogramParameteriv")); + glGetMinmax=reinterpret_cast(get_proc_address("glGetMinmax")); + glGetMinmaxParameterfv=reinterpret_cast(get_proc_address("glGetMinmaxParameterfv")); + glGetMinmaxParameteriv=reinterpret_cast(get_proc_address("glGetMinmaxParameteriv")); + glHistogram=reinterpret_cast(get_proc_address("glHistogram")); + glMinmax=reinterpret_cast(get_proc_address("glMinmax")); + glResetHistogram=reinterpret_cast(get_proc_address("glResetHistogram")); + glResetMinmax=reinterpret_cast(get_proc_address("glResetMinmax")); + glTexImage3D=reinterpret_cast(get_proc_address("glTexImage3D")); + glTexSubImage3D=reinterpret_cast(get_proc_address("glTexSubImage3D")); + glCopyTexSubImage3D=reinterpret_cast(get_proc_address("glCopyTexSubImage3D")); +} + +} // namespace GL +} // namespace Msp diff --git a/source/version_1_2.h b/source/version_1_2.h new file mode 100644 index 00000000..d10ba532 --- /dev/null +++ b/source/version_1_2.h @@ -0,0 +1,54 @@ +#ifndef MSP_GL_VERSION_1_2_ +#define MSP_GL_VERSION_1_2_ + +#include "gl.h" +#include + +namespace Msp { +namespace GL { + +extern PFNGLBLENDCOLORPROC glBlendColor; +extern PFNGLBLENDEQUATIONPROC glBlendEquation; +extern PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements; +extern PFNGLCOLORTABLEPROC glColorTable; +extern PFNGLCOLORTABLEPARAMETERFVPROC glColorTableParameterfv; +extern PFNGLCOLORTABLEPARAMETERIVPROC glColorTableParameteriv; +extern PFNGLCOPYCOLORTABLEPROC glCopyColorTable; +extern PFNGLGETCOLORTABLEPROC glGetColorTable; +extern PFNGLGETCOLORTABLEPARAMETERFVPROC glGetColorTableParameterfv; +extern PFNGLGETCOLORTABLEPARAMETERIVPROC glGetColorTableParameteriv; +extern PFNGLCOLORSUBTABLEPROC glColorSubTable; +extern PFNGLCOPYCOLORSUBTABLEPROC glCopyColorSubTable; +extern PFNGLCONVOLUTIONFILTER1DPROC glConvolutionFilter1D; +extern PFNGLCONVOLUTIONFILTER2DPROC glConvolutionFilter2D; +extern PFNGLCONVOLUTIONPARAMETERFPROC glConvolutionParameterf; +extern PFNGLCONVOLUTIONPARAMETERFVPROC glConvolutionParameterfv; +extern PFNGLCONVOLUTIONPARAMETERIPROC glConvolutionParameteri; +extern PFNGLCONVOLUTIONPARAMETERIVPROC glConvolutionParameteriv; +extern PFNGLCOPYCONVOLUTIONFILTER1DPROC glCopyConvolutionFilter1D; +extern PFNGLCOPYCONVOLUTIONFILTER2DPROC glCopyConvolutionFilter2D; +extern PFNGLGETCONVOLUTIONFILTERPROC glGetConvolutionFilter; +extern PFNGLGETCONVOLUTIONPARAMETERFVPROC glGetConvolutionParameterfv; +extern PFNGLGETCONVOLUTIONPARAMETERIVPROC glGetConvolutionParameteriv; +extern PFNGLGETSEPARABLEFILTERPROC glGetSeparableFilter; +extern PFNGLSEPARABLEFILTER2DPROC glSeparableFilter2D; +extern PFNGLGETHISTOGRAMPROC glGetHistogram; +extern PFNGLGETHISTOGRAMPARAMETERFVPROC glGetHistogramParameterfv; +extern PFNGLGETHISTOGRAMPARAMETERIVPROC glGetHistogramParameteriv; +extern PFNGLGETMINMAXPROC glGetMinmax; +extern PFNGLGETMINMAXPARAMETERFVPROC glGetMinmaxParameterfv; +extern PFNGLGETMINMAXPARAMETERIVPROC glGetMinmaxParameteriv; +extern PFNGLHISTOGRAMPROC glHistogram; +extern PFNGLMINMAXPROC glMinmax; +extern PFNGLRESETHISTOGRAMPROC glResetHistogram; +extern PFNGLRESETMINMAXPROC glResetMinmax; +extern PFNGLTEXIMAGE3DPROC glTexImage3D; +extern PFNGLTEXSUBIMAGE3DPROC glTexSubImage3D; +extern PFNGLCOPYTEXSUBIMAGE3DPROC glCopyTexSubImage3D; + +void init_version_1_2(); + +} // namespace GL +} // namespace Msp + +#endif diff --git a/source/version_1_3.cpp b/source/version_1_3.cpp new file mode 100644 index 00000000..088d5ba6 --- /dev/null +++ b/source/version_1_3.cpp @@ -0,0 +1,105 @@ +#include "extension.h" +#include "version_1_3.h" + +namespace Msp { +namespace GL { + +PFNGLACTIVETEXTUREPROC glActiveTexture=0; +PFNGLCLIENTACTIVETEXTUREPROC glClientActiveTexture=0; +PFNGLMULTITEXCOORD1DPROC glMultiTexCoord1d=0; +PFNGLMULTITEXCOORD1DVPROC glMultiTexCoord1dv=0; +PFNGLMULTITEXCOORD1FPROC glMultiTexCoord1f=0; +PFNGLMULTITEXCOORD1FVPROC glMultiTexCoord1fv=0; +PFNGLMULTITEXCOORD1IPROC glMultiTexCoord1i=0; +PFNGLMULTITEXCOORD1IVPROC glMultiTexCoord1iv=0; +PFNGLMULTITEXCOORD1SPROC glMultiTexCoord1s=0; +PFNGLMULTITEXCOORD1SVPROC glMultiTexCoord1sv=0; +PFNGLMULTITEXCOORD2DPROC glMultiTexCoord2d=0; +PFNGLMULTITEXCOORD2DVPROC glMultiTexCoord2dv=0; +PFNGLMULTITEXCOORD2FPROC glMultiTexCoord2f=0; +PFNGLMULTITEXCOORD2FVPROC glMultiTexCoord2fv=0; +PFNGLMULTITEXCOORD2IPROC glMultiTexCoord2i=0; +PFNGLMULTITEXCOORD2IVPROC glMultiTexCoord2iv=0; +PFNGLMULTITEXCOORD2SPROC glMultiTexCoord2s=0; +PFNGLMULTITEXCOORD2SVPROC glMultiTexCoord2sv=0; +PFNGLMULTITEXCOORD3DPROC glMultiTexCoord3d=0; +PFNGLMULTITEXCOORD3DVPROC glMultiTexCoord3dv=0; +PFNGLMULTITEXCOORD3FPROC glMultiTexCoord3f=0; +PFNGLMULTITEXCOORD3FVPROC glMultiTexCoord3fv=0; +PFNGLMULTITEXCOORD3IPROC glMultiTexCoord3i=0; +PFNGLMULTITEXCOORD3IVPROC glMultiTexCoord3iv=0; +PFNGLMULTITEXCOORD3SPROC glMultiTexCoord3s=0; +PFNGLMULTITEXCOORD3SVPROC glMultiTexCoord3sv=0; +PFNGLMULTITEXCOORD4DPROC glMultiTexCoord4d=0; +PFNGLMULTITEXCOORD4DVPROC glMultiTexCoord4dv=0; +PFNGLMULTITEXCOORD4FPROC glMultiTexCoord4f=0; +PFNGLMULTITEXCOORD4FVPROC glMultiTexCoord4fv=0; +PFNGLMULTITEXCOORD4IPROC glMultiTexCoord4i=0; +PFNGLMULTITEXCOORD4IVPROC glMultiTexCoord4iv=0; +PFNGLMULTITEXCOORD4SPROC glMultiTexCoord4s=0; +PFNGLMULTITEXCOORD4SVPROC glMultiTexCoord4sv=0; +PFNGLLOADTRANSPOSEMATRIXFPROC glLoadTransposeMatrixf=0; +PFNGLLOADTRANSPOSEMATRIXDPROC glLoadTransposeMatrixd=0; +PFNGLMULTTRANSPOSEMATRIXFPROC glMultTransposeMatrixf=0; +PFNGLMULTTRANSPOSEMATRIXDPROC glMultTransposeMatrixd=0; +PFNGLSAMPLECOVERAGEPROC glSampleCoverage=0; +PFNGLCOMPRESSEDTEXIMAGE3DPROC glCompressedTexImage3D=0; +PFNGLCOMPRESSEDTEXIMAGE2DPROC glCompressedTexImage2D=0; +PFNGLCOMPRESSEDTEXIMAGE1DPROC glCompressedTexImage1D=0; +PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glCompressedTexSubImage3D=0; +PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glCompressedTexSubImage2D=0; +PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glCompressedTexSubImage1D=0; +PFNGLGETCOMPRESSEDTEXIMAGEPROC glGetCompressedTexImage=0; + +void init_version_1_3() +{ + glActiveTexture=reinterpret_cast(get_proc_address("glActiveTexture")); + glClientActiveTexture=reinterpret_cast(get_proc_address("glClientActiveTexture")); + glMultiTexCoord1d=reinterpret_cast(get_proc_address("glMultiTexCoord1d")); + glMultiTexCoord1dv=reinterpret_cast(get_proc_address("glMultiTexCoord1dv")); + glMultiTexCoord1f=reinterpret_cast(get_proc_address("glMultiTexCoord1f")); + glMultiTexCoord1fv=reinterpret_cast(get_proc_address("glMultiTexCoord1fv")); + glMultiTexCoord1i=reinterpret_cast(get_proc_address("glMultiTexCoord1i")); + glMultiTexCoord1iv=reinterpret_cast(get_proc_address("glMultiTexCoord1iv")); + glMultiTexCoord1s=reinterpret_cast(get_proc_address("glMultiTexCoord1s")); + glMultiTexCoord1sv=reinterpret_cast(get_proc_address("glMultiTexCoord1sv")); + glMultiTexCoord2d=reinterpret_cast(get_proc_address("glMultiTexCoord2d")); + glMultiTexCoord2dv=reinterpret_cast(get_proc_address("glMultiTexCoord2dv")); + glMultiTexCoord2f=reinterpret_cast(get_proc_address("glMultiTexCoord2f")); + glMultiTexCoord2fv=reinterpret_cast(get_proc_address("glMultiTexCoord2fv")); + glMultiTexCoord2i=reinterpret_cast(get_proc_address("glMultiTexCoord2i")); + glMultiTexCoord2iv=reinterpret_cast(get_proc_address("glMultiTexCoord2iv")); + glMultiTexCoord2s=reinterpret_cast(get_proc_address("glMultiTexCoord2s")); + glMultiTexCoord2sv=reinterpret_cast(get_proc_address("glMultiTexCoord2sv")); + glMultiTexCoord3d=reinterpret_cast(get_proc_address("glMultiTexCoord3d")); + glMultiTexCoord3dv=reinterpret_cast(get_proc_address("glMultiTexCoord3dv")); + glMultiTexCoord3f=reinterpret_cast(get_proc_address("glMultiTexCoord3f")); + glMultiTexCoord3fv=reinterpret_cast(get_proc_address("glMultiTexCoord3fv")); + glMultiTexCoord3i=reinterpret_cast(get_proc_address("glMultiTexCoord3i")); + glMultiTexCoord3iv=reinterpret_cast(get_proc_address("glMultiTexCoord3iv")); + glMultiTexCoord3s=reinterpret_cast(get_proc_address("glMultiTexCoord3s")); + glMultiTexCoord3sv=reinterpret_cast(get_proc_address("glMultiTexCoord3sv")); + glMultiTexCoord4d=reinterpret_cast(get_proc_address("glMultiTexCoord4d")); + glMultiTexCoord4dv=reinterpret_cast(get_proc_address("glMultiTexCoord4dv")); + glMultiTexCoord4f=reinterpret_cast(get_proc_address("glMultiTexCoord4f")); + glMultiTexCoord4fv=reinterpret_cast(get_proc_address("glMultiTexCoord4fv")); + glMultiTexCoord4i=reinterpret_cast(get_proc_address("glMultiTexCoord4i")); + glMultiTexCoord4iv=reinterpret_cast(get_proc_address("glMultiTexCoord4iv")); + glMultiTexCoord4s=reinterpret_cast(get_proc_address("glMultiTexCoord4s")); + glMultiTexCoord4sv=reinterpret_cast(get_proc_address("glMultiTexCoord4sv")); + glLoadTransposeMatrixf=reinterpret_cast(get_proc_address("glLoadTransposeMatrixf")); + glLoadTransposeMatrixd=reinterpret_cast(get_proc_address("glLoadTransposeMatrixd")); + glMultTransposeMatrixf=reinterpret_cast(get_proc_address("glMultTransposeMatrixf")); + glMultTransposeMatrixd=reinterpret_cast(get_proc_address("glMultTransposeMatrixd")); + glSampleCoverage=reinterpret_cast(get_proc_address("glSampleCoverage")); + glCompressedTexImage3D=reinterpret_cast(get_proc_address("glCompressedTexImage3D")); + glCompressedTexImage2D=reinterpret_cast(get_proc_address("glCompressedTexImage2D")); + glCompressedTexImage1D=reinterpret_cast(get_proc_address("glCompressedTexImage1D")); + glCompressedTexSubImage3D=reinterpret_cast(get_proc_address("glCompressedTexSubImage3D")); + glCompressedTexSubImage2D=reinterpret_cast(get_proc_address("glCompressedTexSubImage2D")); + glCompressedTexSubImage1D=reinterpret_cast(get_proc_address("glCompressedTexSubImage1D")); + glGetCompressedTexImage=reinterpret_cast(get_proc_address("glGetCompressedTexImage")); +} + +} // namespace GL +} // namespace Msp diff --git a/source/version_1_3.h b/source/version_1_3.h new file mode 100644 index 00000000..bd0b4eae --- /dev/null +++ b/source/version_1_3.h @@ -0,0 +1,62 @@ +#ifndef MSP_GL_VERSION_1_3_ +#define MSP_GL_VERSION_1_3_ + +#include "gl.h" +#include + +namespace Msp { +namespace GL { + +extern PFNGLACTIVETEXTUREPROC glActiveTexture; +extern PFNGLCLIENTACTIVETEXTUREPROC glClientActiveTexture; +extern PFNGLMULTITEXCOORD1DPROC glMultiTexCoord1d; +extern PFNGLMULTITEXCOORD1DVPROC glMultiTexCoord1dv; +extern PFNGLMULTITEXCOORD1FPROC glMultiTexCoord1f; +extern PFNGLMULTITEXCOORD1FVPROC glMultiTexCoord1fv; +extern PFNGLMULTITEXCOORD1IPROC glMultiTexCoord1i; +extern PFNGLMULTITEXCOORD1IVPROC glMultiTexCoord1iv; +extern PFNGLMULTITEXCOORD1SPROC glMultiTexCoord1s; +extern PFNGLMULTITEXCOORD1SVPROC glMultiTexCoord1sv; +extern PFNGLMULTITEXCOORD2DPROC glMultiTexCoord2d; +extern PFNGLMULTITEXCOORD2DVPROC glMultiTexCoord2dv; +extern PFNGLMULTITEXCOORD2FPROC glMultiTexCoord2f; +extern PFNGLMULTITEXCOORD2FVPROC glMultiTexCoord2fv; +extern PFNGLMULTITEXCOORD2IPROC glMultiTexCoord2i; +extern PFNGLMULTITEXCOORD2IVPROC glMultiTexCoord2iv; +extern PFNGLMULTITEXCOORD2SPROC glMultiTexCoord2s; +extern PFNGLMULTITEXCOORD2SVPROC glMultiTexCoord2sv; +extern PFNGLMULTITEXCOORD3DPROC glMultiTexCoord3d; +extern PFNGLMULTITEXCOORD3DVPROC glMultiTexCoord3dv; +extern PFNGLMULTITEXCOORD3FPROC glMultiTexCoord3f; +extern PFNGLMULTITEXCOORD3FVPROC glMultiTexCoord3fv; +extern PFNGLMULTITEXCOORD3IPROC glMultiTexCoord3i; +extern PFNGLMULTITEXCOORD3IVPROC glMultiTexCoord3iv; +extern PFNGLMULTITEXCOORD3SPROC glMultiTexCoord3s; +extern PFNGLMULTITEXCOORD3SVPROC glMultiTexCoord3sv; +extern PFNGLMULTITEXCOORD4DPROC glMultiTexCoord4d; +extern PFNGLMULTITEXCOORD4DVPROC glMultiTexCoord4dv; +extern PFNGLMULTITEXCOORD4FPROC glMultiTexCoord4f; +extern PFNGLMULTITEXCOORD4FVPROC glMultiTexCoord4fv; +extern PFNGLMULTITEXCOORD4IPROC glMultiTexCoord4i; +extern PFNGLMULTITEXCOORD4IVPROC glMultiTexCoord4iv; +extern PFNGLMULTITEXCOORD4SPROC glMultiTexCoord4s; +extern PFNGLMULTITEXCOORD4SVPROC glMultiTexCoord4sv; +extern PFNGLLOADTRANSPOSEMATRIXFPROC glLoadTransposeMatrixf; +extern PFNGLLOADTRANSPOSEMATRIXDPROC glLoadTransposeMatrixd; +extern PFNGLMULTTRANSPOSEMATRIXFPROC glMultTransposeMatrixf; +extern PFNGLMULTTRANSPOSEMATRIXDPROC glMultTransposeMatrixd; +extern PFNGLSAMPLECOVERAGEPROC glSampleCoverage; +extern PFNGLCOMPRESSEDTEXIMAGE3DPROC glCompressedTexImage3D; +extern PFNGLCOMPRESSEDTEXIMAGE2DPROC glCompressedTexImage2D; +extern PFNGLCOMPRESSEDTEXIMAGE1DPROC glCompressedTexImage1D; +extern PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glCompressedTexSubImage3D; +extern PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glCompressedTexSubImage2D; +extern PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glCompressedTexSubImage1D; +extern PFNGLGETCOMPRESSEDTEXIMAGEPROC glGetCompressedTexImage; + +void init_version_1_3(); + +} // namespace GL +} // namespace Msp + +#endif diff --git a/source/vertexarray.cpp b/source/vertexarray.cpp index a2d3936c..6da0f9c0 100644 --- a/source/vertexarray.cpp +++ b/source/vertexarray.cpp @@ -5,7 +5,7 @@ Copyright © 2007 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ -#include +#include "gl.h" #include "vertexarray.h" #include "vertexbuffer.h" diff --git a/source/vertexbuffer.cpp b/source/vertexbuffer.cpp index d579a373..e3680811 100644 --- a/source/vertexbuffer.cpp +++ b/source/vertexbuffer.cpp @@ -5,10 +5,8 @@ Copyright © 2007 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ -#define GL_GLEXT_PROTOTYPES -#include -//XXX gl.h seems to include glext.h, but can I rely on this? -//#include +#include "arb_vertex_buffer_object.h" +#include "extension.h" #include "vertexbuffer.h" namespace Msp { @@ -16,12 +14,14 @@ namespace GL { VertexBuffer::VertexBuffer() { - glGenBuffers(1, &id); + require_extension("GL_ARB_vertex_buffer_object"); + + glGenBuffersARB(1, &id); } void VertexBuffer::bind() const { - glBindBuffer(GL_ARRAY_BUFFER, id); + glBindBufferARB(GL_ARRAY_BUFFER, id); bound=this; } @@ -29,19 +29,19 @@ void VertexBuffer::data(sizei size, void *d) { if(bound!=this) bind(); - glBufferData(GL_ARRAY_BUFFER, size, d, GL_STATIC_DRAW); + glBufferDataARB(GL_ARRAY_BUFFER, size, d, GL_STATIC_DRAW); } VertexBuffer::~VertexBuffer() { - glDeleteBuffers(1, &id); + glDeleteBuffersARB(1, &id); } void VertexBuffer::unbind() { if(bound) { - glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBufferARB(GL_ARRAY_BUFFER, 0); bound=0; } } -- 2.43.0