#include <stdlib.h>
#include <GL/glew.h>
#include <GL/glut.h>
-#include "extfuncs.h"
#include "shaderutil.h"
{
static GLboolean firstCall = GL_TRUE;
if (firstCall) {
- GetExtensionFuncs();
firstCall = GL_FALSE;
}
}
Init();
- shader = glCreateShader_func(shaderType);
- glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
- glCompileShader_func(shader);
- glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
+ shader = glCreateShader(shaderType);
+ glShaderSource(shader, 1, (const GLchar **) &text, NULL);
+ glCompileShader(shader);
+ glGetShaderiv(shader, GL_COMPILE_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
- glGetShaderInfoLog_func(shader, 1000, &len, log);
+ glGetShaderInfoLog(shader, 1000, &len, log);
fprintf(stderr, "Error: problem compiling shader: %s\n", log);
exit(1);
}
GLuint
LinkShaders(GLuint vertShader, GLuint fragShader)
{
- GLuint program = glCreateProgram_func();
+ GLuint program = glCreateProgram();
assert(vertShader || fragShader);
if (fragShader)
- glAttachShader_func(program, fragShader);
+ glAttachShader(program, fragShader);
if (vertShader)
- glAttachShader_func(program, vertShader);
- glLinkProgram_func(program);
+ glAttachShader(program, vertShader);
+ glLinkProgram(program);
/* check link */
{
GLint stat;
- glGetProgramiv_func(program, GL_LINK_STATUS, &stat);
+ glGetProgramiv(program, GL_LINK_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
- glGetProgramInfoLog_func(program, 1000, &len, log);
+ glGetProgramInfoLog(program, 1000, &len, log);
fprintf(stderr, "Shader link error:\n%s\n", log);
return 0;
}
for (i = 0; uniforms[i].name; i++) {
uniforms[i].location
- = glGetUniformLocation_func(program, uniforms[i].name);
+ = glGetUniformLocation(program, uniforms[i].name);
printf("Uniform %s location: %d\n", uniforms[i].name,
uniforms[i].location);
switch (uniforms[i].size) {
case 1:
if (uniforms[i].type == GL_INT)
- glUniform1i_func(uniforms[i].location,
+ glUniform1i(uniforms[i].location,
(GLint) uniforms[i].value[0]);
else
- glUniform1fv_func(uniforms[i].location, 1, uniforms[i].value);
+ glUniform1fv(uniforms[i].location, 1, uniforms[i].value);
break;
case 2:
- glUniform2fv_func(uniforms[i].location, 1, uniforms[i].value);
+ glUniform2fv(uniforms[i].location, 1, uniforms[i].value);
break;
case 3:
- glUniform3fv_func(uniforms[i].location, 1, uniforms[i].value);
+ glUniform3fv(uniforms[i].location, 1, uniforms[i].value);
break;
case 4:
- glUniform4fv_func(uniforms[i].location, 1, uniforms[i].value);
+ glUniform4fv(uniforms[i].location, 1, uniforms[i].value);
break;
default:
abort();