diff options
Diffstat (limited to 'progs/glsl/linktest.c')
-rw-r--r-- | progs/glsl/linktest.c | 55 |
1 files changed, 26 insertions, 29 deletions
diff --git a/progs/glsl/linktest.c b/progs/glsl/linktest.c index 988d082341..ec3fffbf9c 100644 --- a/progs/glsl/linktest.c +++ b/progs/glsl/linktest.c @@ -9,10 +9,8 @@ #include <stdio.h> #include <stdlib.h> #include <math.h> -#include <GL/gl.h> +#include <GL/glew.h> #include <GL/glut.h> -#include <GL/glext.h> -#include "extfuncs.h" #include "shaderutil.h" @@ -132,11 +130,11 @@ Reshape(int width, int height) static void CleanUp(void) { - glDeleteShader_func(VertShader1); - glDeleteShader_func(VertShader2); - glDeleteShader_func(FragShader1); - glDeleteShader_func(FragShader2); - glDeleteProgram_func(Program); + glDeleteShader(VertShader1); + glDeleteShader(VertShader2); + glDeleteShader(FragShader1); + glDeleteShader(FragShader2); + glDeleteProgram(Program); glutDestroyWindow(Win); } @@ -175,11 +173,11 @@ static void CheckLink(GLuint prog) { GLint stat; - glGetProgramiv_func(prog, GL_LINK_STATUS, &stat); + glGetProgramiv(prog, GL_LINK_STATUS, &stat); if (!stat) { GLchar log[1000]; GLsizei len; - glGetProgramInfoLog_func(prog, 1000, &len, log); + glGetProgramInfoLog(prog, 1000, &len, log); fprintf(stderr, "Linker error:\n%s\n", log); } } @@ -191,8 +189,6 @@ Init(void) if (!ShadersSupported()) exit(1); - GetExtensionFuncs(); - printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); VertShader1 = CompileShaderText(GL_VERTEX_SHADER, VertShaderSource1); @@ -200,26 +196,26 @@ Init(void) FragShader1 = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderSource1); FragShader2 = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderSource2); - Program = glCreateProgram_func(); - glAttachShader_func(Program, VertShader1); - glAttachShader_func(Program, VertShader2); - glAttachShader_func(Program, FragShader1); - glAttachShader_func(Program, FragShader2); + Program = glCreateProgram(); + glAttachShader(Program, VertShader1); + glAttachShader(Program, VertShader2); + glAttachShader(Program, FragShader1); + glAttachShader(Program, FragShader2); - glLinkProgram_func(Program); + glLinkProgram(Program); CheckLink(Program); - glUseProgram_func(Program); + glUseProgram(Program); - uDiffuse = glGetUniformLocation_func(Program, "diffuse"); - uSpecular = glGetUniformLocation_func(Program, "specular"); - uTexture = glGetUniformLocation_func(Program, "texture"); + uDiffuse = glGetUniformLocation(Program, "diffuse"); + uSpecular = glGetUniformLocation(Program, "specular"); + uTexture = glGetUniformLocation(Program, "texture"); printf("DiffusePos %d SpecularPos %d TexturePos %d\n", uDiffuse, uSpecular, uTexture); - glUniform4fv_func(uDiffuse, 1, diffuse); - glUniform4fv_func(uSpecular, 1, specular); + glUniform4fv(uDiffuse, 1, diffuse); + glUniform4fv(uSpecular, 1, specular); glClearColor(0.3f, 0.3f, 0.3f, 0.0f); glEnable(GL_DEPTH_TEST); @@ -228,11 +224,11 @@ Init(void) glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular); glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 10.0f); - assert(glIsProgram_func(Program)); - assert(glIsShader_func(VertShader1)); - assert(glIsShader_func(VertShader2)); - assert(glIsShader_func(FragShader1)); - assert(glIsShader_func(FragShader2)); + assert(glIsProgram(Program)); + assert(glIsShader(VertShader1)); + assert(glIsShader(VertShader2)); + assert(glIsShader(FragShader1)); + assert(glIsShader(FragShader2)); glColor3f(1, 0, 0); } @@ -245,6 +241,7 @@ main(int argc, char *argv[]) glutInitWindowSize(300, 300); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); Win = glutCreateWindow(argv[0]); + glewInit(); glutReshapeFunc(Reshape); glutKeyboardFunc(Key); glutDisplayFunc(Redisplay); |