projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'mesa_7_7_branch'
[mesa.git]
/
progs
/
glsl
/
samplers.c
diff --git
a/progs/glsl/samplers.c
b/progs/glsl/samplers.c
index 3fb8577d5e3afafef956acf09d6dc6df884610e0..87dad5d85752daaeab1632fe2d96aa813bd3dbbf 100644
(file)
--- a/
progs/glsl/samplers.c
+++ b/
progs/glsl/samplers.c
@@
-39,9
+39,9
@@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <GL/glew.h>
#include "GL/glut.h"
#include "readtex.h"
#include "GL/glut.h"
#include "readtex.h"
-#include "extfuncs.h"
#include "shaderutil.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);
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);
assert(vertShader);
program = LinkShaders(vertShader, fragShader);
- glUseProgram
_func
(program);
+ glUseProgram(program);
free(fragShaderText);
free(fragShaderText);
@@
-315,10
+323,10
@@
InitProgram(void)
#else
sprintf(uname, "tex[%d]", s);
#endif
#else
sprintf(uname, "tex[%d]", s);
#endif
- loc = glGetUniformLocation
_func
(Program, uname);
+ loc = glGetUniformLocation(Program, uname);
assert(loc >= 0);
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));
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;
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);
glutInitWindowSize(500, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
glutCreateWindow(Demo);
+ glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(key);
glutSpecialFunc(specialkey);
glutReshapeFunc(Reshape);
glutKeyboardFunc(key);
glutSpecialFunc(specialkey);