From 8a8e7b22c0cf3df7ee1fe598d20c48c593d9804d Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 4 Apr 2008 18:56:22 -0600 Subject: mesa: test code to exercise more GLSL functions --- progs/demos/fslight.c | 45 ++++++++++++++++++--------------------------- 1 file changed, 18 insertions(+), 27 deletions(-) (limited to 'progs/demos/fslight.c') diff --git a/progs/demos/fslight.c b/progs/demos/fslight.c index e6d83bf8fb3..e79b5cc1970 100644 --- a/progs/demos/fslight.c +++ b/progs/demos/fslight.c @@ -225,33 +225,6 @@ static void TestFunctions(void) { printf("Error 0x%x at line %d\n", glGetError(), __LINE__); - { - GLfloat pos[3]; - printf("Error 0x%x at line %d\n", glGetError(), __LINE__); - printf("Light pos %g %g %g\n", pos[0], pos[1], pos[2]); - } - - - { - GLfloat m[16], result[16]; - GLint mPos; - int i; - - for (i = 0; i < 16; i++) - m[i] = (float) i; - - mPos = glGetUniformLocation_func(program, "m"); - printf("Error 0x%x at line %d\n", glGetError(), __LINE__); - glUniformMatrix4fv_func(mPos, 1, GL_FALSE, m); - printf("Error 0x%x at line %d\n", glGetError(), __LINE__); - - glGetUniformfv_func(program, mPos, result); - printf("Error 0x%x at line %d\n", glGetError(), __LINE__); - - for (i = 0; i < 16; i++) { - printf("%8g %8g\n", m[i], result[i]); - } - } assert(glIsProgram_func(program)); assert(glIsShader_func(fragShader)); @@ -280,6 +253,22 @@ TestFunctions(void) glGetProgramInfoLog_func(program, 1000, &len, log); printf("Program Info Log: %s\n", log); } + + /* active uniforms */ + { + GLint n, max, i; + glGetProgramiv_func(program, GL_ACTIVE_UNIFORMS, &n); + glGetProgramiv_func(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &max); + printf("Num uniforms: %d Max name length: %d\n", n, max); + for (i = 0; i < n; i++) { + GLint size, len; + GLenum type; + char name[100]; + glGetActiveUniform_func(program, i, 100, &len, &size, &type, name); + printf(" %d: %s nameLen=%d size=%d type=0x%x\n", + i, name, len, size, type); + } + } } @@ -512,7 +501,9 @@ Init(void) glUniform4fv_func(uDiffuse, 1, diffuse); glUniform4fv_func(uSpecular, 1, specular); /* assert(glGetError() == 0);*/ +#if TEXTURE glUniform1i_func(uTexture, 2); /* use texture unit 2 */ +#endif /*assert(glGetError() == 0);*/ if (CoordAttrib) { -- cgit v1.2.3