- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
void load_functions(void** functions[], const char* names[], ushort count)
{
for(ushort i=0; i<count; i++)
*functions[i]=wglGetProcAddress(names[i]);
}
...
void* const glslFunctions[]={&glCreateShader, &glShaderSource, &glCompileShader,
&glGetShaderiv, &glGetShaderInfoLog, &glDeleteShader,
&glCreateProgram, &glAttachShader, &glLinkProgram, &glGetProgramiv,
&glGetProgramInfoLog, &glUseProgram, &glDeleteProgram,
&glGetUniformLocation, &glGetActiveUniform, &glBindAttribLocation,
&glGenProgramPipelines, &glBindProgramPipeline, &glDeleteProgramPipelines, &glUseProgramStages,
&glProgramParameteri, &glGetProgramPipelineiv, &glValidateProgramPipeline, &glGetProgramPipelineInfoLog,
&glProgramUniform1i, &glProgramUniform2iv, &glProgramUniform3iv, &glProgramUniform4iv,
&glProgramUniform1ui, &glProgramUniform2uiv, &glProgramUniform3uiv, &glProgramUniform4uiv,
&glProgramUniform1f, &glProgramUniform2fv, &glProgramUniform3fv, &glProgramUniform4fv,
&glProgramUniform1d, &glProgramUniform2dv, &glProgramUniform3dv, &glProgramUniform4dv,
&glProgramUniformMatrix2fv, &glProgramUniformMatrix3fv, &glProgramUniformMatrix4fv,
&glProgramUniformMatrix2x3fv, &glProgramUniformMatrix2x4fv,
&glProgramUniformMatrix3x2fv, &glProgramUniformMatrix3x4fv,
&glProgramUniformMatrix4x2fv, &glProgramUniformMatrix4x3fv,
&glProgramUniformMatrix2dv, &glProgramUniformMatrix3dv, &glProgramUniformMatrix4dv,
&glProgramUniformMatrix2x3dv, &glProgramUniformMatrix2x4dv,
&glProgramUniformMatrix3x2dv, &glProgramUniformMatrix3x4dv,
&glProgramUniformMatrix4x2dv, &glProgramUniformMatrix4x3dv};
const char* glslFuncNames[sizeof(glslFunctions)/sizeof(glslFunctions[0])]=
{"glCreateShader", "glShaderSource", "glCompileShader",
"glGetShaderiv", "glGetShaderInfoLog", "glDeleteShader",
"glCreateProgram", "glAttachShader", "glLinkProgram", "glGetProgramiv",
"glGetProgramInfoLog", "glUseProgram", "glDeleteProgram",
"glGetUniformLocation", "glGetActiveUniform", "glBindAttribLocation",
"glGenProgramPipelines", "glBindProgramPipeline", "glDeleteProgramPipelines", "glUseProgramStages",
"glProgramParameteri", "glGetProgramPipelineiv", "glValidateProgramPipeline", "glGetProgramPipelineInfoLog",
"glProgramUniform1i", "glProgramUniform2iv", "glProgramUniform3iv", "glProgramUniform4iv",
"glProgramUniform1ui", "glProgramUniform2uiv", "glProgramUniform3uiv", "glProgramUniform4uiv",
"glProgramUniform1f", "glProgramUniform2fv", "glProgramUniform3fv", "glProgramUniform4fv",
"glProgramUniform1d", "glProgramUniform2dv", "glProgramUniform3dv", "glProgramUniform4dv",
"glProgramUniformMatrix2fv", "glProgramUniformMatrix3fv", "glProgramUniformMatrix4fv",
"glProgramUniformMatrix2x3fv", "glProgramUniformMatrix2x4fv",
"glProgramUniformMatrix3x2fv", "glProgramUniformMatrix3x4fv",
"glProgramUniformMatrix4x2fv", "glProgramUniformMatrix4x3fv",
"glProgramUniformMatrix2dv", "glProgramUniformMatrix3dv", "glProgramUniformMatrix4dv",
"glProgramUniformMatrix2x3dv", "glProgramUniformMatrix2x4dv",
"glProgramUniformMatrix3x2dv", "glProgramUniformMatrix3x4dv",
"glProgramUniformMatrix4x2dv", "glProgramUniformMatrix4x3dv"};
load_functions((void***)glslFunctions, glslFuncNames, sizeof(glslFunctions)/sizeof(glslFunctions[0]));
...