diff options
Diffstat (limited to 'progs')
-rw-r--r-- | progs/demos/fslight.c | 45 | ||||
-rw-r--r-- | progs/tests/getprocaddress.c | 26 | ||||
-rw-r--r-- | progs/trivial/dlist-edgeflag-dangling.c | 2 | ||||
-rw-r--r-- | progs/trivial/dlist-edgeflag.c | 2 | ||||
-rw-r--r-- | progs/util/extfuncs.h | 24 |
5 files changed, 72 insertions, 27 deletions
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) { diff --git a/progs/tests/getprocaddress.c b/progs/tests/getprocaddress.c index 8b000d234a3..ca66025d2dc 100644 --- a/progs/tests/getprocaddress.c +++ b/progs/tests/getprocaddress.c @@ -269,6 +269,32 @@ test_VertexAttrib4dvNV(generic_func func) static GLboolean +test_StencilFuncSeparateATI(generic_func func) +{ +#ifdef GL_ATI_separate_stencil + PFNGLSTENCILFUNCSEPARATEATIPROC stencilFuncSeparateATI = (PFNGLSTENCILFUNCSEPARATEATIPROC) func; + GLint frontFunc, backFunc; + GLint frontRef, backRef; + GLint frontMask, backMask; + (*stencilFuncSeparateATI)(GL_LESS, GL_GREATER, 2, 0xa); + glGetIntegerv(GL_STENCIL_FUNC, &frontFunc); + glGetIntegerv(GL_STENCIL_BACK_FUNC, &backFunc); + glGetIntegerv(GL_STENCIL_REF, &frontRef); + glGetIntegerv(GL_STENCIL_BACK_REF, &backRef); + glGetIntegerv(GL_STENCIL_VALUE_MASK, &frontMask); + glGetIntegerv(GL_STENCIL_BACK_VALUE_MASK, &backMask); + if (frontFunc != GL_LESS || + backFunc != GL_GREATER || + frontRef != 2 || + backRef != 2 || + frontMask != 0xa || + backMask != 0xa) + return GL_FALSE; +#endif + return GL_TRUE; +} + +static GLboolean test_StencilFuncSeparate(generic_func func) { #ifdef GL_VERSION_2_0 diff --git a/progs/trivial/dlist-edgeflag-dangling.c b/progs/trivial/dlist-edgeflag-dangling.c index b993946320f..08fae549c31 100644 --- a/progs/trivial/dlist-edgeflag-dangling.c +++ b/progs/trivial/dlist-edgeflag-dangling.c @@ -88,6 +88,7 @@ static void Draw(void) { glClear(GL_COLOR_BUFFER_BIT); + glPushMatrix(); glColor3f(0,.9,0); glEdgeFlag(0); glCallList(list); @@ -95,6 +96,7 @@ static void Draw(void) glRotatef(45,0,0,1); glColor3f(1,0,1); glCallList(list); + glPopMatrix(); glFlush(); diff --git a/progs/trivial/dlist-edgeflag.c b/progs/trivial/dlist-edgeflag.c index 9e190db7001..ae799dc3557 100644 --- a/progs/trivial/dlist-edgeflag.c +++ b/progs/trivial/dlist-edgeflag.c @@ -93,12 +93,14 @@ static void Draw(void) { glClear(GL_COLOR_BUFFER_BIT); + glPushMatrix(); glColor3f(0,.9,0); glCallList(list); glRotatef(45,0,0,1); glColor3f(1,0,1); glCallList(list); + glPopMatrix(); glFlush(); diff --git a/progs/util/extfuncs.h b/progs/util/extfuncs.h index 5d647cdae7f..cf6b29d0e32 100644 --- a/progs/util/extfuncs.h +++ b/progs/util/extfuncs.h @@ -12,6 +12,7 @@ static PFNGLCREATESHADERPROC glCreateShader_func = NULL; static PFNGLDELETEPROGRAMPROC glDeleteProgram_func = NULL; static PFNGLDELETESHADERPROC glDeleteShader_func = NULL; static PFNGLGETACTIVEATTRIBPROC glGetActiveAttrib_func = NULL; +static PFNGLGETACTIVEUNIFORMPROC glGetActiveUniform_func = NULL; static PFNGLGETATTACHEDSHADERSPROC glGetAttachedShaders_func = NULL; static PFNGLGETATTRIBLOCATIONPROC glGetAttribLocation_func = NULL; static PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog_func = NULL; @@ -26,6 +27,13 @@ static PFNGLISSHADERPROC glIsShader_func = NULL; static PFNGLLINKPROGRAMPROC glLinkProgram_func = NULL; static PFNGLSHADERSOURCEPROC glShaderSource_func = NULL; static PFNGLUNIFORM1IPROC glUniform1i_func = NULL; +static PFNGLUNIFORM2IPROC glUniform2i_func = NULL; +static PFNGLUNIFORM3IPROC glUniform3i_func = NULL; +static PFNGLUNIFORM4IPROC glUniform4i_func = NULL; +static PFNGLUNIFORM1FPROC glUniform1f_func = NULL; +static PFNGLUNIFORM2FPROC glUniform2f_func = NULL; +static PFNGLUNIFORM3FPROC glUniform3f_func = NULL; +static PFNGLUNIFORM4FPROC glUniform4f_func = NULL; static PFNGLUNIFORM1FVPROC glUniform1fv_func = NULL; static PFNGLUNIFORM2FVPROC glUniform2fv_func = NULL; static PFNGLUNIFORM3FVPROC glUniform3fv_func = NULL; @@ -47,6 +55,10 @@ static PFNGLUNIFORMMATRIX4X2FVPROC glUniformMatrix4x2fv_func = NULL; static PFNGLUNIFORMMATRIX3X4FVPROC glUniformMatrix3x4fv_func = NULL; static PFNGLUNIFORMMATRIX4X3FVPROC glUniformMatrix4x3fv_func = NULL; +/* OpenGL 1.4 */ +static PFNGLPOINTPARAMETERFVPROC glPointParameterfv_func = NULL; +static PFNGLSECONDARYCOLOR3FVPROC glSecondaryColor3fv_func = NULL; + /* GL_ARB_vertex/fragment_program */ static PFNGLBINDPROGRAMARBPROC glBindProgramARB_func = NULL; static PFNGLDELETEPROGRAMSARBPROC glDeleteProgramsARB_func = NULL; @@ -80,6 +92,7 @@ GetExtensionFuncs(void) glDeleteProgram_func = (PFNGLDELETEPROGRAMPROC) glutGetProcAddress("glDeleteProgram"); glDeleteShader_func = (PFNGLDELETESHADERPROC) glutGetProcAddress("glDeleteShader"); glGetActiveAttrib_func = (PFNGLGETACTIVEATTRIBPROC) glutGetProcAddress("glGetActiveAttrib"); + glGetActiveUniform_func = (PFNGLGETACTIVEUNIFORMPROC) glutGetProcAddress("glGetActiveUniform"); glGetAttachedShaders_func = (PFNGLGETATTACHEDSHADERSPROC) glutGetProcAddress("glGetAttachedShaders"); glGetAttribLocation_func = (PFNGLGETATTRIBLOCATIONPROC) glutGetProcAddress("glGetAttribLocation"); glGetProgramInfoLog_func = (PFNGLGETPROGRAMINFOLOGPROC) glutGetProcAddress("glGetProgramInfoLog"); @@ -94,6 +107,13 @@ GetExtensionFuncs(void) glLinkProgram_func = (PFNGLLINKPROGRAMPROC) glutGetProcAddress("glLinkProgram"); glShaderSource_func = (PFNGLSHADERSOURCEPROC) glutGetProcAddress("glShaderSource"); glUniform1i_func = (PFNGLUNIFORM1IPROC) glutGetProcAddress("glUniform1i"); + glUniform2i_func = (PFNGLUNIFORM2IPROC) glutGetProcAddress("glUniform2i"); + glUniform3i_func = (PFNGLUNIFORM3IPROC) glutGetProcAddress("glUniform3i"); + glUniform4i_func = (PFNGLUNIFORM4IPROC) glutGetProcAddress("glUniform3i"); + glUniform1f_func = (PFNGLUNIFORM1FPROC) glutGetProcAddress("glUniform1f"); + glUniform2f_func = (PFNGLUNIFORM2FPROC) glutGetProcAddress("glUniform2f"); + glUniform3f_func = (PFNGLUNIFORM3FPROC) glutGetProcAddress("glUniform3f"); + glUniform4f_func = (PFNGLUNIFORM4FPROC) glutGetProcAddress("glUniform4f"); glUniform1fv_func = (PFNGLUNIFORM1FVPROC) glutGetProcAddress("glUniform1fv"); glUniform2fv_func = (PFNGLUNIFORM2FVPROC) glutGetProcAddress("glUniform2fv"); glUniform3fv_func = (PFNGLUNIFORM3FVPROC) glutGetProcAddress("glUniform3fv"); @@ -115,6 +135,10 @@ GetExtensionFuncs(void) glUniformMatrix3x4fv_func = (PFNGLUNIFORMMATRIX3X4FVPROC) glutGetProcAddress("glUniformMatrix3x4fv"); glUniformMatrix4x3fv_func = (PFNGLUNIFORMMATRIX4X3FVPROC) glutGetProcAddress("glUniformMatrix4x3fv"); + /* OpenGL 1.4 */ + glPointParameterfv_func = (PFNGLPOINTPARAMETERFVPROC) glutGetProcAddress("glPointParameterfv"); + glSecondaryColor3fv_func = (PFNGLSECONDARYCOLOR3FVPROC) glutGetProcAddress("glSecondaryColor3fv"); + /* GL_ARB_vertex/fragment_program */ glBindProgramARB_func = (PFNGLBINDPROGRAMARBPROC) glutGetProcAddress("glBindProgramARB"); glDeleteProgramsARB_func = (PFNGLDELETEPROGRAMSARBPROC) glutGetProcAddress("glDeleteProgramsARB"); |