1 
2 //          Copyright 2018 - 2021 Michael D. Parker
3 // Distributed under the Boost Software License, Version 1.0.
4 //    (See accompanying file LICENSE_1_0.txt or copy at
5 //          http://www.boost.org/LICENSE_1_0.txt)
6 
7 module bindbc.opengl.bind.gl21;
8 
9 import bindbc.loader : SharedLib;
10 import bindbc.opengl.config,
11        bindbc.opengl.context;
12 import bindbc.opengl.bind.types;
13 
14 public import bindbc.opengl.bind.gl20;
15 version(GL_AllowDeprecated)
16     public import bindbc.opengl.bind.dep.dep21;
17 
18 enum : uint {
19     GL_PIXEL_PACK_BUFFER              = 0x88EB,
20     GL_PIXEL_UNPACK_BUFFER            = 0x88EC,
21     GL_PIXEL_PACK_BUFFER_BINDING      = 0x88ED,
22     GL_PIXEL_UNPACK_BUFFER_BINDING    = 0x88EF,
23     GL_FLOAT_MAT2x3                   = 0x8B65,
24     GL_FLOAT_MAT2x4                   = 0x8B66,
25     GL_FLOAT_MAT3x2                   = 0x8B67,
26     GL_FLOAT_MAT3x4                   = 0x8B68,
27     GL_FLOAT_MAT4x2                   = 0x8B69,
28     GL_FLOAT_MAT4x3                   = 0x8B6A,
29     GL_SRGB                           = 0x8C40,
30     GL_SRGB8                          = 0x8C41,
31     GL_SRGB_ALPHA                     = 0x8C42,
32     GL_SRGB8_ALPHA8                   = 0x8C43,
33     GL_COMPRESSED_SRGB                = 0x8C48,
34     GL_COMPRESSED_SRGB_ALPHA          = 0x8C49,
35 }
36 
37 extern(System) @nogc nothrow {
38     alias pglUniformMatrix2x3fv = void function(GLint,GLsizei,GLboolean,const(GLfloat)*);
39     alias pglUniformMatrix3x2fv = void function(GLint,GLsizei,GLboolean,const(GLfloat)*);
40     alias pglUniformMatrix2x4fv = void function(GLint,GLsizei,GLboolean,const(GLfloat)*);
41     alias pglUniformMatrix4x2fv = void function(GLint,GLsizei,GLboolean,const(GLfloat)*);
42     alias pglUniformMatrix3x4fv = void function(GLint,GLsizei,GLboolean,const(GLfloat)*);
43     alias pglUniformMatrix4x3fv = void function(GLint,GLsizei,GLboolean,const(GLfloat)*);
44 }
45 
46 __gshared {
47     pglUniformMatrix2x3fv glUniformMatrix2x3fv;
48     pglUniformMatrix3x2fv glUniformMatrix3x2fv;
49     pglUniformMatrix2x4fv glUniformMatrix2x4fv;
50     pglUniformMatrix4x2fv glUniformMatrix4x2fv;
51     pglUniformMatrix3x4fv glUniformMatrix3x4fv;
52     pglUniformMatrix4x3fv glUniformMatrix4x3fv;
53 }
54 
55 package(bindbc.opengl) @nogc nothrow
56 bool loadGL21(SharedLib lib, GLSupport contextVersion)
57 {
58     if(contextVersion > GLSupport.gl20) {
59         lib.bindGLSymbol(cast(void**)&glUniformMatrix2x3fv, "glUniformMatrix2x3fv");
60         lib.bindGLSymbol(cast(void**)&glUniformMatrix3x2fv, "glUniformMatrix3x2fv");
61         lib.bindGLSymbol(cast(void**)&glUniformMatrix2x4fv, "glUniformMatrix2x4fv");
62         lib.bindGLSymbol(cast(void**)&glUniformMatrix4x2fv, "glUniformMatrix4x2fv");
63         lib.bindGLSymbol(cast(void**)&glUniformMatrix3x4fv, "glUniformMatrix3x4fv");
64         lib.bindGLSymbol(cast(void**)&glUniformMatrix4x3fv, "glUniformMatrix4x3fv");
65         if(errorCountGL() == 0) return true;
66     }
67     return false;
68 }