Merge branch 'mesa_7_7_branch'
[mesa.git] / progs / glsl / samplers.c
index 3fb8577d5e3afafef956acf09d6dc6df884610e0..87dad5d85752daaeab1632fe2d96aa813bd3dbbf 100644 (file)
@@ -39,9 +39,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <GL/glew.h>
 #include "GL/glut.h"
 #include "readtex.h"
-#include "extfuncs.h"
 #include "shaderutil.h"
 
 
@@ -211,10 +211,18 @@ InitTextures(void)
       for (y = 0; y < stripeSize; y++) {
          for (x = 0; x < size; x++) {
             GLint k = 4 * ((ypos + y) * size + x);
-            texImage[k + 0] = intensity;
-            texImage[k + 1] = intensity;
-            texImage[k + 2] = 0;
-            texImage[k + 3] = 255;
+            if (x < size / 2) {
+               texImage[k + 0] = intensity;
+               texImage[k + 1] = intensity;
+               texImage[k + 2] = 0;
+               texImage[k + 3] = 255;
+            }
+            else {
+               texImage[k + 0] = 255 - intensity;
+               texImage[k + 1] = 0;
+               texImage[k + 2] = 0;
+               texImage[k + 3] = 255;
+            }
          }
       }
 
@@ -290,7 +298,7 @@ CreateProgram(void)
    assert(vertShader);
    program = LinkShaders(vertShader, fragShader);
 
-   glUseProgram_func(program);
+   glUseProgram(program);
 
    free(fragShaderText);
 
@@ -315,10 +323,10 @@ InitProgram(void)
 #else
       sprintf(uname, "tex[%d]", s);
 #endif
-      loc = glGetUniformLocation_func(Program, uname);
+      loc = glGetUniformLocation(Program, uname);
       assert(loc >= 0);
 
-      glUniform1i_func(loc, s);
+      glUniform1i(loc, s);
    }
 }
 
@@ -333,8 +341,6 @@ InitGL(void)
 
    printf("GL_RENDERER = %s\n", (const char *) glGetString(GL_RENDERER));
 
-   GetExtensionFuncs();
-
    glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &NumSamplers);
    if (NumSamplers > MAX_SAMPLERS)
       NumSamplers = MAX_SAMPLERS;
@@ -357,6 +363,7 @@ main(int argc, char *argv[])
    glutInitWindowSize(500, 400);
    glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
    glutCreateWindow(Demo);
+   glewInit();
    glutReshapeFunc(Reshape);
    glutKeyboardFunc(key);
    glutSpecialFunc(specialkey);