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.gl14;
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.gl13;
15 version(GL_AllowDeprecated)
16 public import bindbc.opengl.bind.dep.dep14;
17
18 enum : uint {
19 GL_BLEND_DST_RGB = 0x80C8,
20 GL_BLEND_SRC_RGB = 0x80C9,
21 GL_BLEND_DST_ALPHA = 0x80CA,
22 GL_BLEND_SRC_ALPHA = 0x80CB,
23 GL_POINT_FADE_THRESHOLD_SIZE = 0x8128,
24 GL_DEPTH_COMPONENT16 = 0x81A5,
25 GL_DEPTH_COMPONENT24 = 0x81A6,
26 GL_DEPTH_COMPONENT32 = 0x81A7,
27 GL_MIRRORED_REPEAT = 0x8370,
28 GL_MAX_TEXTURE_LOD_BIAS = 0x84FD,
29 GL_TEXTURE_LOD_BIAS = 0x8501,
30 GL_INCR_WRAP = 0x8507,
31 GL_DECR_WRAP = 0x8508,
32 GL_TEXTURE_DEPTH_SIZE = 0x884A,
33 GL_TEXTURE_COMPARE_MODE = 0x884C,
34 GL_TEXTURE_COMPARE_FUNC = 0x884D,
35 GL_CONSTANT_COLOR = 0x8001,
36 GL_ONE_MINUS_CONSTANT_COLOR = 0x8002,
37 GL_CONSTANT_ALPHA = 0x8003,
38 GL_ONE_MINUS_CONSTANT_ALPHA = 0x8004,
39 GL_FUNC_ADD = 0x8006,
40 GL_MIN = 0x8007,
41 GL_MAX = 0x8008,
42 GL_FUNC_SUBTRACT = 0x800A,
43 GL_FUNC_REVERSE_SUBTRACT = 0x800B,
44 }
45
46 extern(System) @nogc nothrow {
47 alias pglBlendFuncSeparate = void function(GLenum,GLenum,GLenum,GLenum);
48 alias pglMultiDrawArrays = void function(GLenum,const(GLint)*,const(GLsizei)*,GLsizei);
49 alias pglMultiDrawElements = void function(GLenum,const(GLsizei)*,GLenum,const(GLvoid)*,GLsizei);
50 alias pglPointParameterf = void function(GLenum,GLfloat);
51 alias pglPointParameterfv = void function(GLenum,const(GLfloat)*);
52 alias pglPointParameteri = void function(GLenum,GLint);
53 alias pglPointParameteriv = void function(GLenum,const(GLint)*);
54 alias pglBlendColor = void function(GLclampf,GLclampf,GLclampf,GLclampf);
55 alias pglBlendEquation = void function(GLenum);
56 }
57
58 __gshared {
59 pglBlendFuncSeparate glBlendFuncSeparate;
60 pglMultiDrawArrays glMultiDrawArrays;
61 pglMultiDrawElements glMultiDrawElements;
62 pglPointParameterf glPointParameterf;
63 pglPointParameterfv glPointParameterfv;
64 pglPointParameteri glPointParameteri;
65 pglPointParameteriv glPointParameteriv;
66 pglBlendColor glBlendColor;
67 pglBlendEquation glBlendEquation;
68 }
69
70 package(bindbc.opengl) @nogc nothrow
71 bool loadGL14(SharedLib lib, GLSupport contextVersion)
72 {
73 if(contextVersion > GLSupport.gl13) {
74 lib.bindGLSymbol(cast(void**)&glBlendFuncSeparate, "glBlendFuncSeparate");
75 lib.bindGLSymbol(cast(void**)&glMultiDrawArrays, "glMultiDrawArrays");
76 lib.bindGLSymbol(cast(void**)&glMultiDrawElements, "glMultiDrawElements");
77 lib.bindGLSymbol(cast(void**)&glPointParameterf, "glPointParameterf");
78 lib.bindGLSymbol(cast(void**)&glPointParameterfv, "glPointParameterfv");
79 lib.bindGLSymbol(cast(void**)&glPointParameteri, "glPointParameteri");
80 lib.bindGLSymbol(cast(void**)&glPointParameteriv, "glPointParameteriv");
81 lib.bindGLSymbol(cast(void**)&glBlendColor, "glBlendColor");
82 lib.bindGLSymbol(cast(void**)&glBlendEquation, "glBlendEquation");
83
84 if(errorCountGL() == 0) {
85 version(GL_AllowDeprecated) return loadDeprecatedGL14(lib);
86 else return true;
87 }
88 }
89 return false;
90 }