diff options
Diffstat (limited to 'progs/glsl/multinoise.c')
-rw-r--r-- | progs/glsl/multinoise.c | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/progs/glsl/multinoise.c b/progs/glsl/multinoise.c index 2351863aff..0d4026e29c 100644 --- a/progs/glsl/multinoise.c +++ b/progs/glsl/multinoise.c @@ -8,10 +8,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" static const char *VertShaderText = "void main() {\n" @@ -107,10 +105,10 @@ CleanUp(void) { GLint i; - glDeleteShader_func(vertShader); + glDeleteShader(vertShader); for( i = 0; i < 4; i++ ) { - glDeleteShader_func(fragShader[ i ]); - glDeleteProgram_func(program[ i ]); + glDeleteShader(fragShader[ i ]); + glDeleteProgram(program[ i ]); } glutDestroyWindow(win); } @@ -143,7 +141,7 @@ Key(unsigned char key, int x, int y) case '2': case '3': case '4': - glUseProgram_func(program[ key - '1' ]); + glUseProgram(program[ key - '1' ]); break; case 27: CleanUp(); @@ -186,15 +184,15 @@ LoadAndCompileShader(GLuint shader, const char *text) { GLint stat; - glShaderSource_func(shader, 1, (const GLchar **) &text, NULL); + glShaderSource(shader, 1, (const GLchar **) &text, NULL); - glCompileShader_func(shader); + glCompileShader(shader); - glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat); + 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, "noise: problem compiling shader: %s\n", log); exit(1); } @@ -208,11 +206,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); } else { @@ -233,22 +231,20 @@ Init(void) /*exit(1);*/ } - GetExtensionFuncs(); - - vertShader = glCreateShader_func(GL_VERTEX_SHADER); + vertShader = glCreateShader(GL_VERTEX_SHADER); LoadAndCompileShader(vertShader, VertShaderText); for( i = 0; i < 4; i++ ) { - fragShader[ i ] = glCreateShader_func(GL_FRAGMENT_SHADER); + fragShader[ i ] = glCreateShader(GL_FRAGMENT_SHADER); LoadAndCompileShader(fragShader[ i ], FragShaderText[ i ]); - program[ i ] = glCreateProgram_func(); - glAttachShader_func(program[ i ], fragShader[ i ]); - glAttachShader_func(program[ i ], vertShader); - glLinkProgram_func(program[ i ]); + program[ i ] = glCreateProgram(); + glAttachShader(program[ i ], fragShader[ i ]); + glAttachShader(program[ i ], vertShader); + glLinkProgram(program[ i ]); CheckLink(program[ i ]); } - glUseProgram_func(program[ 0 ]); + glUseProgram(program[ 0 ]); assert(glGetError() == 0); @@ -266,10 +262,10 @@ int main(int argc, char *argv[]) { glutInit(&argc, argv); - glutInitWindowPosition( 0, 0); glutInitWindowSize(400, 400); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); win = glutCreateWindow(argv[0]); + glewInit(); glutReshapeFunc(Reshape); glutKeyboardFunc(Key); glutSpecialFunc(SpecialKey); |