]> git.tdb.fi Git - libs/gl.git/blob - source/arb_vertex_buffer_object.cpp
Force some c'tors and d'tors to be emitted in the library
[libs/gl.git] / source / arb_vertex_buffer_object.cpp
1 #include "arb_vertex_buffer_object.h"
2
3 namespace Msp {
4 namespace GL {
5
6 PFNGLBINDBUFFERPROC glBindBuffer = 0;
7 PFNGLBUFFERDATAPROC glBufferData = 0;
8 PFNGLBUFFERSUBDATAPROC glBufferSubData = 0;
9 PFNGLDELETEBUFFERSPROC glDeleteBuffers = 0;
10 PFNGLGENBUFFERSPROC glGenBuffers = 0;
11 PFNGLGETBUFFERPARAMETERIVPROC glGetBufferParameteriv = 0;
12 PFNGLGETBUFFERPOINTERVPROC glGetBufferPointerv = 0;
13 PFNGLGETBUFFERSUBDATAPROC glGetBufferSubData = 0;
14 PFNGLISBUFFERPROC glIsBuffer = 0;
15 PFNGLMAPBUFFERPROC glMapBuffer = 0;
16 PFNGLUNMAPBUFFERPROC glUnmapBuffer = 0;
17
18 Extension::SupportLevel init_arb_vertex_buffer_object()
19 {
20         if(is_version_at_least(1, 5))
21         {
22                 glBindBuffer = reinterpret_cast<PFNGLBINDBUFFERPROC>(get_proc_address("glBindBuffer"));
23                 glBufferData = reinterpret_cast<PFNGLBUFFERDATAPROC>(get_proc_address("glBufferData"));
24                 glBufferSubData = reinterpret_cast<PFNGLBUFFERSUBDATAPROC>(get_proc_address("glBufferSubData"));
25                 glDeleteBuffers = reinterpret_cast<PFNGLDELETEBUFFERSPROC>(get_proc_address("glDeleteBuffers"));
26                 glGenBuffers = reinterpret_cast<PFNGLGENBUFFERSPROC>(get_proc_address("glGenBuffers"));
27                 glGetBufferParameteriv = reinterpret_cast<PFNGLGETBUFFERPARAMETERIVPROC>(get_proc_address("glGetBufferParameteriv"));
28                 glGetBufferPointerv = reinterpret_cast<PFNGLGETBUFFERPOINTERVPROC>(get_proc_address("glGetBufferPointerv"));
29                 glGetBufferSubData = reinterpret_cast<PFNGLGETBUFFERSUBDATAPROC>(get_proc_address("glGetBufferSubData"));
30                 glIsBuffer = reinterpret_cast<PFNGLISBUFFERPROC>(get_proc_address("glIsBuffer"));
31                 glMapBuffer = reinterpret_cast<PFNGLMAPBUFFERPROC>(get_proc_address("glMapBuffer"));
32                 glUnmapBuffer = reinterpret_cast<PFNGLUNMAPBUFFERPROC>(get_proc_address("glUnmapBuffer"));
33                 return Extension::CORE;
34         }
35         if(is_supported("GL_ARB_vertex_buffer_object"))
36         {
37                 glBindBuffer = reinterpret_cast<PFNGLBINDBUFFERPROC>(get_proc_address("glBindBufferARB"));
38                 glBufferData = reinterpret_cast<PFNGLBUFFERDATAPROC>(get_proc_address("glBufferDataARB"));
39                 glBufferSubData = reinterpret_cast<PFNGLBUFFERSUBDATAPROC>(get_proc_address("glBufferSubDataARB"));
40                 glDeleteBuffers = reinterpret_cast<PFNGLDELETEBUFFERSPROC>(get_proc_address("glDeleteBuffersARB"));
41                 glGenBuffers = reinterpret_cast<PFNGLGENBUFFERSPROC>(get_proc_address("glGenBuffersARB"));
42                 glGetBufferParameteriv = reinterpret_cast<PFNGLGETBUFFERPARAMETERIVPROC>(get_proc_address("glGetBufferParameterivARB"));
43                 glGetBufferPointerv = reinterpret_cast<PFNGLGETBUFFERPOINTERVPROC>(get_proc_address("glGetBufferPointervARB"));
44                 glGetBufferSubData = reinterpret_cast<PFNGLGETBUFFERSUBDATAPROC>(get_proc_address("glGetBufferSubDataARB"));
45                 glIsBuffer = reinterpret_cast<PFNGLISBUFFERPROC>(get_proc_address("glIsBufferARB"));
46                 glMapBuffer = reinterpret_cast<PFNGLMAPBUFFERPROC>(get_proc_address("glMapBufferARB"));
47                 glUnmapBuffer = reinterpret_cast<PFNGLUNMAPBUFFERPROC>(get_proc_address("glUnmapBufferARB"));
48                 return Extension::EXTENSION;
49         }
50         return Extension::UNSUPPORTED;
51 }
52
53 Extension ARB_vertex_buffer_object("GL_ARB_vertex_buffer_object", init_arb_vertex_buffer_object);
54
55 } // namespace GL
56 } // namespace Msp