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.gl13;
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.gl12;
15 version(GL_AllowDeprecated)
16     public import bindbc.opengl.bind.dep.dep13;
17 
18 
19 enum : uint {
20     GL_TEXTURE0                       = 0x84C0,
21     GL_TEXTURE1                       = 0x84C1,
22     GL_TEXTURE2                       = 0x84C2,
23     GL_TEXTURE3                       = 0x84C3,
24     GL_TEXTURE4                       = 0x84C4,
25     GL_TEXTURE5                       = 0x84C5,
26     GL_TEXTURE6                       = 0x84C6,
27     GL_TEXTURE7                       = 0x84C7,
28     GL_TEXTURE8                       = 0x84C8,
29     GL_TEXTURE9                       = 0x84C9,
30     GL_TEXTURE10                      = 0x84CA,
31     GL_TEXTURE11                      = 0x84CB,
32     GL_TEXTURE12                      = 0x84CC,
33     GL_TEXTURE13                      = 0x84CD,
34     GL_TEXTURE14                      = 0x84CE,
35     GL_TEXTURE15                      = 0x84CF,
36     GL_TEXTURE16                      = 0x84D0,
37     GL_TEXTURE17                      = 0x84D1,
38     GL_TEXTURE18                      = 0x84D2,
39     GL_TEXTURE19                      = 0x84D3,
40     GL_TEXTURE20                      = 0x84D4,
41     GL_TEXTURE21                      = 0x84D5,
42     GL_TEXTURE22                      = 0x84D6,
43     GL_TEXTURE23                      = 0x84D7,
44     GL_TEXTURE24                      = 0x84D8,
45     GL_TEXTURE25                      = 0x84D9,
46     GL_TEXTURE26                      = 0x84DA,
47     GL_TEXTURE27                      = 0x84DB,
48     GL_TEXTURE28                      = 0x84DC,
49     GL_TEXTURE29                      = 0x84DD,
50     GL_TEXTURE30                      = 0x84DE,
51     GL_TEXTURE31                      = 0x84DF,
52     GL_ACTIVE_TEXTURE                 = 0x84E0,
53     GL_MULTISAMPLE                    = 0x809D,
54     GL_SAMPLE_ALPHA_TO_COVERAGE       = 0x809E,
55     GL_SAMPLE_ALPHA_TO_ONE            = 0x809F,
56     GL_SAMPLE_COVERAGE                = 0x80A0,
57     GL_SAMPLE_BUFFERS                 = 0x80A8,
58     GL_SAMPLES                        = 0x80A9,
59     GL_SAMPLE_COVERAGE_VALUE          = 0x80AA,
60     GL_SAMPLE_COVERAGE_INVERT         = 0x80AB,
61     GL_TEXTURE_CUBE_MAP               = 0x8513,
62     GL_TEXTURE_BINDING_CUBE_MAP       = 0x8514,
63     GL_TEXTURE_CUBE_MAP_POSITIVE_X    = 0x8515,
64     GL_TEXTURE_CUBE_MAP_NEGATIVE_X    = 0x8516,
65     GL_TEXTURE_CUBE_MAP_POSITIVE_Y    = 0x8517,
66     GL_TEXTURE_CUBE_MAP_NEGATIVE_Y    = 0x8518,
67     GL_TEXTURE_CUBE_MAP_POSITIVE_Z    = 0x8519,
68     GL_TEXTURE_CUBE_MAP_NEGATIVE_Z    = 0x851A,
69     GL_PROXY_TEXTURE_CUBE_MAP         = 0x851B,
70     GL_MAX_CUBE_MAP_TEXTURE_SIZE      = 0x851C,
71     GL_COMPRESSED_RGB                 = 0x84ED,
72     GL_COMPRESSED_RGBA                = 0x84EE,
73     GL_TEXTURE_COMPRESSION_HINT       = 0x84EF,
74     GL_TEXTURE_COMPRESSED_IMAGE_SIZE  = 0x86A0,
75     GL_TEXTURE_COMPRESSED             = 0x86A1,
76     GL_NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2,
77     GL_COMPRESSED_TEXTURE_FORMATS     = 0x86A3,
78     GL_CLAMP_TO_BORDER                = 0x812D,
79 }
80 
81 extern(System) @nogc nothrow {
82     alias pglActiveTexture = void function(GLenum);
83     alias pglSampleCoverage = void function(GLclampf,GLboolean);
84     alias pglCompressedTexImage3D = void function(GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLint,GLsizei,const(GLvoid)*);
85     alias pglCompressedTexImage2D = void function(GLenum,GLint,GLenum,GLsizei,GLsizei,GLint,GLsizei,const(GLvoid)*);
86     alias pglCompressedTexImage1D = void function(GLenum,GLint,GLenum,GLsizei,GLint,GLsizei,const(GLvoid)*);
87     alias pglCompressedTexSubImage3D = void function(GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLsizei,const(GLvoid)*);
88     alias pglCompressedTexSubImage2D = void function(GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLsizei,const(GLvoid)*);
89     alias pglCompressedTexSubImage1D = void function(GLenum,GLint,GLint,GLsizei,GLenum,GLsizei,const(GLvoid)*);
90     alias pglGetCompressedTexImage = void function(GLenum,GLint,GLvoid*);
91 }
92 
93 __gshared {
94     pglActiveTexture glActiveTexture;
95     pglSampleCoverage glSampleCoverage;
96     pglCompressedTexImage3D glCompressedTexImage3D;
97     pglCompressedTexImage2D glCompressedTexImage2D;
98     pglCompressedTexImage1D glCompressedTexImage1D;
99     pglCompressedTexSubImage3D glCompressedTexSubImage3D;
100     pglCompressedTexSubImage2D glCompressedTexSubImage2D;
101     pglCompressedTexSubImage1D glCompressedTexSubImage1D;
102     pglGetCompressedTexImage glGetCompressedTexImage;
103 }
104 
105 package(bindbc.opengl) @nogc nothrow
106 bool loadGL13(SharedLib lib, GLSupport contextVersion)
107 {
108     if(contextVersion > GLSupport.gl12) {
109         lib.bindGLSymbol(cast(void**)&glActiveTexture, "glActiveTexture");
110         lib.bindGLSymbol(cast(void**)&glSampleCoverage, "glSampleCoverage");
111         lib.bindGLSymbol(cast(void**)&glCompressedTexImage3D, "glCompressedTexImage3D");
112         lib.bindGLSymbol(cast(void**)&glCompressedTexImage2D, "glCompressedTexImage2D");
113         lib.bindGLSymbol(cast(void**)&glCompressedTexImage1D, "glCompressedTexImage1D");
114         lib.bindGLSymbol(cast(void**)&glCompressedTexSubImage3D, "glCompressedTexSubImage3D");
115         lib.bindGLSymbol(cast(void**)&glCompressedTexSubImage2D, "glCompressedTexSubImage2D");
116         lib.bindGLSymbol(cast(void**)&glCompressedTexSubImage1D, "glCompressedTexSubImage1D");
117         lib.bindGLSymbol(cast(void**)&glGetCompressedTexImage, "glGetCompressedTexImage");
118 
119         if(errorCountGL() == 0) {
120             version(GL_AllowDeprecated) return loadDeprecatedGL13(lib);
121             else return true;
122         }
123     }
124     return false;
125 }