From a36b9987cd0e6930e8db91322801854206cc1800 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sun, 14 Jun 2009 01:04:00 +0200 Subject: progs/tests: Add yet another mipmap test --- progs/tests/.gitignore | 4 + progs/tests/Makefile | 1 + progs/tests/SConscript | 1 + progs/tests/mipmap_comp_tests.c | 313 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 319 insertions(+) create mode 100644 progs/tests/mipmap_comp_tests.c (limited to 'progs') diff --git a/progs/tests/.gitignore b/progs/tests/.gitignore index 7c6c245d39..3479ff8b33 100644 --- a/progs/tests/.gitignore +++ b/progs/tests/.gitignore @@ -5,6 +5,7 @@ arbfpspec arbfptest1 arbfptexture arbfptrig +arbgpuprog arbnpot arbnpot-mipmap arbvptest1 @@ -38,6 +39,7 @@ fptest1 fptexture getprocaddress getproclist.h +getteximage glutfx interleave invert @@ -49,11 +51,13 @@ mapvbo minmag mipgen mipmap_comp +mipmap_comp_tests mipmap_limits mipmap_view multipal no_s3tc packedpixels +persp_hint pbo prim prog_parameter diff --git a/progs/tests/Makefile b/progs/tests/Makefile index f74a408523..b58d7b25e4 100644 --- a/progs/tests/Makefile +++ b/progs/tests/Makefile @@ -59,6 +59,7 @@ SOURCES = \ minmag.c \ mipgen.c \ mipmap_comp.c \ + mipmap_comp_tests.c \ mipmap_limits.c \ mipmap_view.c \ multipal.c \ diff --git a/progs/tests/SConscript b/progs/tests/SConscript index bd48a6ac80..a4b5a45573 100644 --- a/progs/tests/SConscript +++ b/progs/tests/SConscript @@ -82,6 +82,7 @@ progs = [ 'minmag', 'mipgen', 'mipmap_comp', + 'mipmap_comp_tests', 'mipmap_limits', 'mipmap_view', 'multipal', diff --git a/progs/tests/mipmap_comp_tests.c b/progs/tests/mipmap_comp_tests.c new file mode 100644 index 0000000000..8f20625378 --- /dev/null +++ b/progs/tests/mipmap_comp_tests.c @@ -0,0 +1,313 @@ +/* Copyright (c) Mark J. Kilgard, 1994. */ +/* + * (c) Copyright 1993, Silicon Graphics, Inc. + * ALL RIGHTS RESERVED + * Permission to use, copy, modify, and distribute this software for + * any purpose and without fee is hereby granted, provided that the above + * copyright notice appear in all copies and that both the copyright notice + * and this permission notice appear in supporting documentation, and that + * the name of Silicon Graphics, Inc. not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. + * + * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" + * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR + * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON + * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, + * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY + * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, + * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF + * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN + * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE + * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. + * + * US Government Users Restricted Rights + * Use, duplication, or disclosure by the Government is subject to + * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph + * (c)(1)(ii) of the Rights in Technical Data and Computer Software + * clause at DFARS 252.227-7013 and/or in similar or successor + * clauses in the FAR or the DOD or NASA FAR Supplement. + * Unpublished-- rights reserved under the copyright laws of the + * United States. Contractor/manufacturer is Silicon Graphics, + * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. + * + * OpenGL(TM) is a trademark of Silicon Graphics, Inc. + */ + +/* mipmap_comp + * Test compressed texture mipmaps + * + * Based on mipmap_limits + */ + +#include +#include +#include +#include +#include + +#include "readtex.h" + +#define SIZE 16 /* not larger then 16 */ + +static GLint BaseLevel = 0, MaxLevel ; +static GLfloat MinLod, MaxLod; +static GLfloat LodBias; +static GLboolean NearestFilter; +static GLuint texImage; +static GLuint View; + +struct view { + GLfloat minLod; + GLfloat maxLod; + const char *string; +}; + +static struct view views[] = +{ + { 0, 0, "Green" }, + { 0, 1, "Green, Red" }, + { 0, 2, "Green, Red, Blue" }, + { 0, 3, "Green, Red, Blue, Black" }, + { 0, 4, "Green, Red, Blue, Black, White" }, + { 1, 4, "Red, Blue, Black, White" }, + { 2, 4, "Blue, Black, White" }, + { 3, 4, "Black, White" }, + { 4, 4, "White" }, + { 1, 3, "Red, Blue, Black" }, + { 1, 2, "Red, Blue" }, + { 2, 3, "Blue, Black" }, + { 0, 0, NULL }, +}; + +static void +initValues(void) +{ + View = 9; + BaseLevel = 0; + MaxLevel = 9; + MinLod = views[View].minLod; + MaxLod = views[View].maxLod; + LodBias = 5.0; + NearestFilter = GL_TRUE; +} + + +static void +changeView(void) +{ + if (views[++View].string == NULL) + View = 0; + + MinLod = views[View].minLod; + MaxLod = views[View].maxLod; +} + + +static void +makeImage(int level, int width, int height) +{ + GLubyte img[SIZE*SIZE*3]; + GLubyte color[5][3] = { + { 0, 255, 0 }, + { 255, 0, 0 }, + { 0, 0, 255 }, + { 0, 0, 0 }, + { 255, 255, 255 }, + }; + int i, j; + + for (i = 0; i < height; i++) { + for (j = 0; j < width; j++) { + int k = (i * width + j) * 3; + img[k + 0] = color[level][0]; + img[k + 1] = color[level][1]; + img[k + 2] = color[level][2]; + } + } + + glTexImage2D(GL_TEXTURE_2D, level, 3, width, height, 0, + GL_RGB, GL_UNSIGNED_BYTE, img); +} + + +static void +makeImages(void) +{ + int i, sz; + + for (i = 0, sz = SIZE; sz >= 1; i++, sz /= 2) { + makeImage(i, sz, sz); + printf("Level %d size: %d x %d\n", i, sz, sz); + } +} + + +static void +myInit(void) +{ + + initValues(); + + glEnable(GL_DEPTH_TEST); + glDepthFunc(GL_LESS); + glShadeModel(GL_FLAT); + + glTranslatef(0.0, 0.0, -3.6); + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glGenTextures(1, &texImage); + glBindTexture(GL_TEXTURE_2D, texImage); + makeImages(); + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); + glEnable(GL_TEXTURE_2D); +} + + +static void +display(void) +{ + GLfloat tcm = 1.0; + glBindTexture(GL_TEXTURE_2D, texImage); + + printf("BASE_LEVEL=%d MAX_LEVEL=%d MIN_LOD=%.2g MAX_LOD=%.2g Bias=%.2g Filter=%s\n", + BaseLevel, MaxLevel, MinLod, MaxLod, LodBias, + NearestFilter ? "NEAREST" : "LINEAR"); + printf("You should see: %s\n", views[View].string ); + fflush(stdout); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, BaseLevel); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, MaxLevel); + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, MinLod); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, MaxLod); + + if (NearestFilter) { + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_NEAREST_MIPMAP_NEAREST); + } + else { + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_LINEAR_MIPMAP_LINEAR); + } + + glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, LodBias); + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glBegin(GL_QUADS); + glTexCoord2f(0.0, 0.0); glVertex3f(-2.0, -1.0, 0.0); + glTexCoord2f(0.0, tcm); glVertex3f(-2.0, 1.0, 0.0); + glTexCoord2f(tcm * 3000.0, tcm); glVertex3f(3000.0, 1.0, -6000.0); + glTexCoord2f(tcm * 3000.0, 0.0); glVertex3f(3000.0, -1.0, -6000.0); + glEnd(); + glFlush(); +} + + +static void +myReshape(int w, int h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(60.0, 1.0*(GLfloat)w/(GLfloat)h, 1.0, 30000.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + + +static void +key(unsigned char k, int x, int y) +{ + (void) x; + (void) y; + switch (k) { +#if 0 + case 'b': + BaseLevel--; + if (BaseLevel < 0) + BaseLevel = 0; + break; + case 'B': + BaseLevel++; + if (BaseLevel > 10) + BaseLevel = 10; + break; + case 'm': + MaxLevel--; + if (MaxLevel < 0) + MaxLevel = 0; + break; + case 'M': + MaxLevel++; + if (MaxLevel > 10) + MaxLevel = 10; + break; + case 'l': + LodBias -= 0.25; + break; + case 'L': + LodBias += 0.25; + break; + case 'n': + MinLod -= 0.25; + break; + case 'N': + MinLod += 0.25; + break; + case 'x': + MaxLod -= 0.25; + break; + case 'X': + MaxLod += 0.25; + break; + case 'f': + NearestFilter = !NearestFilter; + break; +#endif + case ' ': + initValues(); + break; + case 27: /* Escape */ + exit(0); + break; + default: + changeView(); + break; + } + glutPostRedisplay(); +} + + +static void +usage(void) +{ + printf("usage:\n"); + printf(" Any Change view\n"); + printf(" SPACE reset values\n"); +} + + +int +main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutInitWindowSize (600, 600); + glutCreateWindow (argv[0]); + glewInit(); + myInit(); + glutReshapeFunc (myReshape); + glutDisplayFunc(display); + glutKeyboardFunc(key); + usage(); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} -- cgit v1.2.3 From b0a17581e20c6993e1ec3ef85801f351366f949b Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sat, 4 Jul 2009 07:40:34 +0200 Subject: progs/tests: Tests more views in mipmap_comp_tests --- progs/tests/mipmap_comp_tests.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/tests/mipmap_comp_tests.c b/progs/tests/mipmap_comp_tests.c index 8f20625378..080b81cba0 100644 --- a/progs/tests/mipmap_comp_tests.c +++ b/progs/tests/mipmap_comp_tests.c @@ -76,6 +76,9 @@ static struct view views[] = { 2, 4, "Blue, Black, White" }, { 3, 4, "Black, White" }, { 4, 4, "White" }, + { 3, 3, "Black" }, + { 2, 2, "Blue" }, + { 1, 1, "Red" }, { 1, 3, "Red, Blue, Black" }, { 1, 2, "Red, Blue" }, { 2, 3, "Blue, Black" }, @@ -85,7 +88,7 @@ static struct view views[] = static void initValues(void) { - View = 9; + View = 12; BaseLevel = 0; MaxLevel = 9; MinLod = views[View].minLod; -- cgit v1.2.3 From 26e58a42b0faa8f4eb2794a1ddee6b66d0ce0efe Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sat, 4 Jul 2009 16:01:45 +0200 Subject: progs/tests: Use compressed texture in mipmap_comp_tests --- progs/tests/mipmap_comp_tests.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/tests/mipmap_comp_tests.c b/progs/tests/mipmap_comp_tests.c index 080b81cba0..e865b30ad0 100644 --- a/progs/tests/mipmap_comp_tests.c +++ b/progs/tests/mipmap_comp_tests.c @@ -131,7 +131,9 @@ makeImage(int level, int width, int height) } } - glTexImage2D(GL_TEXTURE_2D, level, 3, width, height, 0, + glTexImage2D(GL_TEXTURE_2D, level, + GL_COMPRESSED_RGB_S3TC_DXT1_EXT, + width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, img); } -- cgit v1.2.3 From ee0b1bc7d3fe659e0ed2f34a61b322f2bd2b8843 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 17 Jul 2009 13:23:11 -0600 Subject: progs/glsl: finish conversion to GLEW This is a follow-on to b799af91d5ffbee1481161fec29eb4c92b161272. Remove _func function suffix and unneeded #includes. --- progs/glsl/array.c | 16 +++++-------- progs/glsl/bitmap.c | 27 +++++++++------------ progs/glsl/brick.c | 19 ++++++--------- progs/glsl/bump.c | 24 ++++++++----------- progs/glsl/deriv.c | 19 ++++++--------- progs/glsl/fragcoord.c | 19 ++++++--------- progs/glsl/identity.c | 19 ++++++--------- progs/glsl/linktest.c | 53 +++++++++++++++++++----------------------- progs/glsl/mandelbrot.c | 31 +++++++++++------------- progs/glsl/multinoise.c | 39 ++++++++++++++----------------- progs/glsl/multitex.c | 35 +++++++++++++--------------- progs/glsl/noise.c | 21 +++++++---------- progs/glsl/pointcoord.c | 23 +++++++----------- progs/glsl/points.c | 23 +++++++----------- progs/glsl/samplers.c | 9 +++---- progs/glsl/shadow_sampler.c | 49 ++++++++++++++++++-------------------- progs/glsl/skinning.c | 27 +++++++++------------ progs/glsl/texaaline.c | 5 ---- progs/glsl/texdemo1.c | 9 +++---- progs/glsl/toyball.c | 13 ++++------- progs/glsl/trirast.c | 31 +++++++++++------------- progs/glsl/twoside.c | 27 +++++++++------------ progs/glsl/vert-or-frag-only.c | 25 ++++++++------------ progs/glsl/vert-tex.c | 13 ++++------- 24 files changed, 232 insertions(+), 344 deletions(-) (limited to 'progs') diff --git a/progs/glsl/array.c b/progs/glsl/array.c index 6da15b2fcc..4ed18485ea 100644 --- a/progs/glsl/array.c +++ b/progs/glsl/array.c @@ -10,9 +10,7 @@ #include #include #include -#include #include -#include "extfuncs.h" #include "shaderutil.h" @@ -144,9 +142,9 @@ Reshape(int width, int height) static void CleanUp(void) { - glDeleteShader_func(fragShader); - glDeleteShader_func(vertShader); - glDeleteProgram_func(program); + glDeleteShader(fragShader); + glDeleteShader(vertShader); + glDeleteProgram(program); glutDestroyWindow(win); } @@ -219,19 +217,17 @@ Init(void) if (!ShadersSupported()) exit(1); - GetExtensionFuncs(); - vertShader = CompileShaderText(GL_VERTEX_SHADER, VertShaderText); fragShader = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderText); program = LinkShaders(vertShader, fragShader); - glUseProgram_func(program); + glUseProgram(program); /* Setup the HeightArray[] uniform */ for (i = 0; i < 20; i++) HeightArray[i] = i / 20.0; - u = glGetUniformLocation_func(program, "HeightArray"); - glUniform1fv_func(u, 20, HeightArray); + u = glGetUniformLocation(program, "HeightArray"); + glUniform1fv(u, 20, HeightArray); assert(glGetError() == 0); diff --git a/progs/glsl/bitmap.c b/progs/glsl/bitmap.c index 08fac15c89..8b1853d9ab 100644 --- a/progs/glsl/bitmap.c +++ b/progs/glsl/bitmap.c @@ -10,10 +10,7 @@ #include #include #include -#include #include -#include -#include "extfuncs.h" #include "shaderutil.h" @@ -79,11 +76,11 @@ Redisplay(void) BitmapText("-X"); } else { - glUseProgram_func(Program); + glUseProgram(Program); /* vertex positions (deltas) depend on texture size and window size */ if (uScale != -1) { - glUniform2f_func(uScale, + glUniform2f(uScale, 2.0 * TEX_WIDTH / WinWidth, 2.0 * TEX_HEIGHT / WinHeight); } @@ -106,7 +103,7 @@ Redisplay(void) glTexCoord2f(0, 1); glVertex3fv(nx); glEnd(); - glUseProgram_func(0); + glUseProgram(0); } glPopMatrix(); @@ -161,9 +158,9 @@ Key(unsigned char key, int x, int y) printf("Using billboard texture\n"); break; case 27: - glDeleteShader_func(FragShader); - glDeleteShader_func(VertShader); - glDeleteProgram_func(Program); + glDeleteShader(FragShader); + glDeleteShader(VertShader); + glDeleteProgram(Program); glutDestroyWindow(Win); exit(0); } @@ -278,21 +275,19 @@ Init(void) if (!ShadersSupported()) exit(1); - GetExtensionFuncs(); - VertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText); FragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText); Program = LinkShaders(VertShader, FragShader); - glUseProgram_func(Program); + glUseProgram(Program); - uScale = glGetUniformLocation_func(Program, "scale"); - uTex = glGetUniformLocation_func(Program, "tex2d"); + uScale = glGetUniformLocation(Program, "scale"); + uTex = glGetUniformLocation(Program, "tex2d"); if (uTex != -1) { - glUniform1i_func(uTex, 0); /* tex unit 0 */ + glUniform1i(uTex, 0); /* tex unit 0 */ } - glUseProgram_func(0); + glUseProgram(0); glClearColor(0.3f, 0.3f, 0.3f, 0.0f); glEnable(GL_DEPTH_TEST); diff --git a/progs/glsl/brick.c b/progs/glsl/brick.c index 607acd0597..1d08b231e7 100644 --- a/progs/glsl/brick.c +++ b/progs/glsl/brick.c @@ -10,10 +10,7 @@ #include #include #include -#include #include -#include -#include "extfuncs.h" #include "shaderutil.h" @@ -83,9 +80,9 @@ Reshape(int width, int height) static void CleanUp(void) { - glDeleteShader_func(fragShader); - glDeleteShader_func(vertShader); - glDeleteProgram_func(program); + glDeleteShader(fragShader); + glDeleteShader(vertShader); + glDeleteProgram(program); glutDestroyWindow(win); } @@ -145,13 +142,11 @@ Init(void) if (!ShadersSupported()) exit(1); - GetExtensionFuncs(); - vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile); fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile); program = LinkShaders(vertShader, fragShader); - glUseProgram_func(program); + glUseProgram(program); InitUniforms(program, Uniforms); @@ -161,9 +156,9 @@ Init(void) printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); - assert(glIsProgram_func(program)); - assert(glIsShader_func(fragShader)); - assert(glIsShader_func(vertShader)); + assert(glIsProgram(program)); + assert(glIsShader(fragShader)); + assert(glIsShader(vertShader)); glColor3f(1, 0, 0); } diff --git a/progs/glsl/bump.c b/progs/glsl/bump.c index c401e590f7..ddb986abcb 100644 --- a/progs/glsl/bump.c +++ b/progs/glsl/bump.c @@ -9,10 +9,8 @@ #include #include #include +#include #include -#include -#include -#include "extfuncs.h" #include "shaderutil.h" @@ -60,7 +58,7 @@ static void Square(GLfloat size) { glNormal3f(0, 0, 1); - glVertexAttrib3f_func(tangentAttrib, 1, 0, 0); + glVertexAttrib3f(tangentAttrib, 1, 0, 0); glBegin(GL_POLYGON); glTexCoord2f(0, 0); glVertex2f(-size, -size); glTexCoord2f(1, 0); glVertex2f( size, -size); @@ -164,9 +162,9 @@ Reshape(int width, int height) static void CleanUp(void) { - glDeleteShader_func(fragShader); - glDeleteShader_func(vertShader); - glDeleteProgram_func(program); + glDeleteShader(fragShader); + glDeleteShader(vertShader); + glDeleteProgram(program); glutDestroyWindow(win); } @@ -230,17 +228,15 @@ Init(void) if (!ShadersSupported()) exit(1); - GetExtensionFuncs(); - vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile); fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile); program = LinkShaders(vertShader, fragShader); - glUseProgram_func(program); + glUseProgram(program); - assert(glIsProgram_func(program)); - assert(glIsShader_func(fragShader)); - assert(glIsShader_func(vertShader)); + assert(glIsProgram(program)); + assert(glIsShader(fragShader)); + assert(glIsShader(vertShader)); assert(glGetError() == 0); @@ -250,7 +246,7 @@ Init(void) CheckError(__LINE__); - tangentAttrib = glGetAttribLocation_func(program, "Tangent"); + tangentAttrib = glGetAttribLocation(program, "Tangent"); printf("Tangent Attrib: %d\n", tangentAttrib); assert(tangentAttrib >= 0); diff --git a/progs/glsl/deriv.c b/progs/glsl/deriv.c index 3fd674c331..9cf1e40e3e 100644 --- a/progs/glsl/deriv.c +++ b/progs/glsl/deriv.c @@ -14,10 +14,7 @@ #include #include #include -#include #include -#include -#include "extfuncs.h" #include "shaderutil.h" @@ -71,9 +68,9 @@ Reshape(int width, int height) static void CleanUp(void) { - glDeleteShader_func(fragShader); - glDeleteShader_func(vertShader); - glDeleteProgram_func(program); + glDeleteShader(fragShader); + glDeleteShader(vertShader); + glDeleteProgram(program); glutDestroyWindow(win); } @@ -178,13 +175,11 @@ Init(void) if (!ShadersSupported()) exit(1); - GetExtensionFuncs(); - vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText); fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText); program = LinkShaders(vertShader, fragShader); - glUseProgram_func(program); + glUseProgram(program); /*assert(glGetError() == 0);*/ @@ -198,9 +193,9 @@ Init(void) printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); - assert(glIsProgram_func(program)); - assert(glIsShader_func(fragShader)); - assert(glIsShader_func(vertShader)); + assert(glIsProgram(program)); + assert(glIsShader(fragShader)); + assert(glIsShader(vertShader)); glColor3f(1, 0, 0); } diff --git a/progs/glsl/fragcoord.c b/progs/glsl/fragcoord.c index 509ad47e7f..9f56a038c9 100644 --- a/progs/glsl/fragcoord.c +++ b/progs/glsl/fragcoord.c @@ -13,10 +13,7 @@ #include #include #include -#include #include -#include -#include "extfuncs.h" #include "shaderutil.h" @@ -86,9 +83,9 @@ Reshape(int width, int height) static void CleanUp(void) { - glDeleteShader_func(fragShader); - glDeleteShader_func(vertShader); - glDeleteProgram_func(program); + glDeleteShader(fragShader); + glDeleteShader(vertShader); + glDeleteProgram(program); glutDestroyWindow(win); } @@ -130,13 +127,11 @@ Init(void) if (!ShadersSupported()) exit(1); - GetExtensionFuncs(); - vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText); fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText); program = LinkShaders(vertShader, fragShader); - glUseProgram_func(program); + glUseProgram(program); /*assert(glGetError() == 0);*/ @@ -144,9 +139,9 @@ Init(void) printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); - assert(glIsProgram_func(program)); - assert(glIsShader_func(fragShader)); - assert(glIsShader_func(vertShader)); + assert(glIsProgram(program)); + assert(glIsShader(fragShader)); + assert(glIsShader(vertShader)); glColor3f(1, 0, 0); } diff --git a/progs/glsl/identity.c b/progs/glsl/identity.c index 5ba7468cc4..a772ccd716 100644 --- a/progs/glsl/identity.c +++ b/progs/glsl/identity.c @@ -10,10 +10,7 @@ #include #include #include -#include #include -#include -#include "extfuncs.h" #include "shaderutil.h" @@ -70,9 +67,9 @@ Reshape(int width, int height) static void CleanUp(void) { - glDeleteShader_func(fragShader); - glDeleteShader_func(vertShader); - glDeleteProgram_func(program); + glDeleteShader(fragShader); + glDeleteShader(vertShader); + glDeleteProgram(program); glutDestroyWindow(win); } @@ -142,8 +139,6 @@ Init(void) if (!ShadersSupported()) exit(1); - GetExtensionFuncs(); - if (FragProgFile) fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile); else @@ -156,7 +151,7 @@ Init(void) program = LinkShaders(vertShader, fragShader); - glUseProgram_func(program); + glUseProgram(program); /*assert(glGetError() == 0);*/ @@ -165,9 +160,9 @@ Init(void) printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); - assert(glIsProgram_func(program)); - assert(glIsShader_func(fragShader)); - assert(glIsShader_func(vertShader)); + assert(glIsProgram(program)); + assert(glIsShader(fragShader)); + assert(glIsShader(vertShader)); glColor3f(1, 0, 0); } diff --git a/progs/glsl/linktest.c b/progs/glsl/linktest.c index fe5d1564e0..ec3fffbf9c 100644 --- a/progs/glsl/linktest.c +++ b/progs/glsl/linktest.c @@ -10,10 +10,7 @@ #include #include #include -#include #include -#include -#include "extfuncs.h" #include "shaderutil.h" @@ -133,11 +130,11 @@ Reshape(int width, int height) static void CleanUp(void) { - glDeleteShader_func(VertShader1); - glDeleteShader_func(VertShader2); - glDeleteShader_func(FragShader1); - glDeleteShader_func(FragShader2); - glDeleteProgram_func(Program); + glDeleteShader(VertShader1); + glDeleteShader(VertShader2); + glDeleteShader(FragShader1); + glDeleteShader(FragShader2); + glDeleteProgram(Program); glutDestroyWindow(Win); } @@ -176,11 +173,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); } } @@ -192,8 +189,6 @@ Init(void) if (!ShadersSupported()) exit(1); - GetExtensionFuncs(); - printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); VertShader1 = CompileShaderText(GL_VERTEX_SHADER, VertShaderSource1); @@ -201,26 +196,26 @@ Init(void) FragShader1 = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderSource1); FragShader2 = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderSource2); - Program = glCreateProgram_func(); - glAttachShader_func(Program, VertShader1); - glAttachShader_func(Program, VertShader2); - glAttachShader_func(Program, FragShader1); - glAttachShader_func(Program, FragShader2); + Program = glCreateProgram(); + glAttachShader(Program, VertShader1); + glAttachShader(Program, VertShader2); + glAttachShader(Program, FragShader1); + glAttachShader(Program, FragShader2); - glLinkProgram_func(Program); + glLinkProgram(Program); CheckLink(Program); - glUseProgram_func(Program); + glUseProgram(Program); - uDiffuse = glGetUniformLocation_func(Program, "diffuse"); - uSpecular = glGetUniformLocation_func(Program, "specular"); - uTexture = glGetUniformLocation_func(Program, "texture"); + uDiffuse = glGetUniformLocation(Program, "diffuse"); + uSpecular = glGetUniformLocation(Program, "specular"); + uTexture = glGetUniformLocation(Program, "texture"); printf("DiffusePos %d SpecularPos %d TexturePos %d\n", uDiffuse, uSpecular, uTexture); - glUniform4fv_func(uDiffuse, 1, diffuse); - glUniform4fv_func(uSpecular, 1, specular); + glUniform4fv(uDiffuse, 1, diffuse); + glUniform4fv(uSpecular, 1, specular); glClearColor(0.3f, 0.3f, 0.3f, 0.0f); glEnable(GL_DEPTH_TEST); @@ -229,11 +224,11 @@ Init(void) glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular); glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 10.0f); - assert(glIsProgram_func(Program)); - assert(glIsShader_func(VertShader1)); - assert(glIsShader_func(VertShader2)); - assert(glIsShader_func(FragShader1)); - assert(glIsShader_func(FragShader2)); + assert(glIsProgram(Program)); + assert(glIsShader(VertShader1)); + assert(glIsShader(VertShader2)); + assert(glIsShader(FragShader1)); + assert(glIsShader(FragShader2)); glColor3f(1, 0, 0); } diff --git a/progs/glsl/mandelbrot.c b/progs/glsl/mandelbrot.c index eeea4eb52a..38dffc3e74 100644 --- a/progs/glsl/mandelbrot.c +++ b/progs/glsl/mandelbrot.c @@ -10,10 +10,7 @@ #include #include #include -#include #include -#include -#include "extfuncs.h" #include "shaderutil.h" @@ -57,9 +54,9 @@ Redisplay(void) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); /* set interactive uniform parameters */ - glUniform1fv_func(uZoom, 1, &zoom); - glUniform1fv_func(uXcenter, 1, &xCenter); - glUniform1fv_func(uYcenter, 1, &yCenter); + glUniform1fv(uZoom, 1, &zoom); + glUniform1fv(uXcenter, 1, &xCenter); + glUniform1fv(uYcenter, 1, &yCenter); glPushMatrix(); glRotatef(xRot, 1.0f, 0.0f, 0.0f); @@ -95,9 +92,9 @@ Reshape(int width, int height) static void CleanUp(void) { - glDeleteShader_func(fragShader); - glDeleteShader_func(vertShader); - glDeleteProgram_func(program); + glDeleteShader(fragShader); + glDeleteShader(vertShader); + glDeleteProgram(program); glutDestroyWindow(win); } @@ -156,19 +153,17 @@ Init(void) if (!ShadersSupported()) exit(1); - GetExtensionFuncs(); - vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile); fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile); program = LinkShaders(vertShader, fragShader); - glUseProgram_func(program); + glUseProgram(program); InitUniforms(program, Uniforms); - uZoom = glGetUniformLocation_func(program, "Zoom"); - uXcenter = glGetUniformLocation_func(program, "Xcenter"); - uYcenter = glGetUniformLocation_func(program, "Ycenter"); + uZoom = glGetUniformLocation(program, "Zoom"); + uXcenter = glGetUniformLocation(program, "Xcenter"); + uYcenter = glGetUniformLocation(program, "Ycenter"); assert(glGetError() == 0); @@ -176,9 +171,9 @@ Init(void) printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); - assert(glIsProgram_func(program)); - assert(glIsShader_func(fragShader)); - assert(glIsShader_func(vertShader)); + assert(glIsProgram(program)); + assert(glIsShader(fragShader)); + assert(glIsShader(vertShader)); glColor3f(1, 0, 0); } diff --git a/progs/glsl/multinoise.c b/progs/glsl/multinoise.c index 400511508e..0afe230801 100644 --- a/progs/glsl/multinoise.c +++ b/progs/glsl/multinoise.c @@ -9,10 +9,7 @@ #include #include #include -#include #include -#include -#include "extfuncs.h" static const char *VertShaderText = "void main() {\n" @@ -108,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); } @@ -144,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(); @@ -187,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); } @@ -209,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 { @@ -234,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); diff --git a/progs/glsl/multitex.c b/progs/glsl/multitex.c index 724f15e1a3..913f73be17 100644 --- a/progs/glsl/multitex.c +++ b/progs/glsl/multitex.c @@ -31,7 +31,6 @@ #include #include "GL/glut.h" #include "readtex.h" -#include "extfuncs.h" #include "shaderutil.h" static const char *Demo = "multitex"; @@ -81,22 +80,22 @@ static void DrawPolygonArray(void) { if (VertCoord_attr >= 0) { - glVertexAttribPointer_func(VertCoord_attr, 2, GL_FLOAT, GL_FALSE, + glVertexAttribPointer(VertCoord_attr, 2, GL_FLOAT, GL_FALSE, 0, VertCoords); - glEnableVertexAttribArray_func(VertCoord_attr); + glEnableVertexAttribArray(VertCoord_attr); } else { glVertexPointer(2, GL_FLOAT, 0, VertCoords); glEnable(GL_VERTEX_ARRAY); } - glVertexAttribPointer_func(TexCoord0_attr, 2, GL_FLOAT, GL_FALSE, + glVertexAttribPointer(TexCoord0_attr, 2, GL_FLOAT, GL_FALSE, 0, Tex0Coords); - glEnableVertexAttribArray_func(TexCoord0_attr); + glEnableVertexAttribArray(TexCoord0_attr); - glVertexAttribPointer_func(TexCoord1_attr, 2, GL_FLOAT, GL_FALSE, + glVertexAttribPointer(TexCoord1_attr, 2, GL_FLOAT, GL_FALSE, 0, Tex1Coords); - glEnableVertexAttribArray_func(TexCoord1_attr); + glEnableVertexAttribArray(TexCoord1_attr); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); } @@ -110,11 +109,11 @@ DrawPolygonVert(void) glBegin(GL_TRIANGLE_FAN); for (i = 0; i < 4; i++) { - glVertexAttrib2fv_func(TexCoord0_attr, Tex0Coords[i]); - glVertexAttrib2fv_func(TexCoord1_attr, Tex1Coords[i]); + glVertexAttrib2fv(TexCoord0_attr, Tex0Coords[i]); + glVertexAttrib2fv(TexCoord1_attr, Tex1Coords[i]); if (VertCoord_attr >= 0) - glVertexAttrib2fv_func(VertCoord_attr, VertCoords[i]); + glVertexAttrib2fv(VertCoord_attr, VertCoords[i]); else glVertex2fv(VertCoords[i]); } @@ -268,27 +267,27 @@ CreateProgram(const char *vertProgFile, const char *fragProgFile, assert(vertShader); program = LinkShaders(vertShader, fragShader); - glUseProgram_func(program); + glUseProgram(program); InitUniforms(program, uniforms); - VertCoord_attr = glGetAttribLocation_func(program, "VertCoord"); + VertCoord_attr = glGetAttribLocation(program, "VertCoord"); if (VertCoord_attr > 0) { /* We want the VertCoord attrib to have position zero so that * the call to glVertexAttrib(0, xyz) triggers vertex processing. * Otherwise, if TexCoord0 or TexCoord1 gets position 0 we'd have * to set that attribute last (which is a PITA to manage). */ - glBindAttribLocation_func(program, 0, "VertCoord"); + glBindAttribLocation(program, 0, "VertCoord"); /* re-link */ - glLinkProgram_func(program); + glLinkProgram(program); /* VertCoord_attr should be zero now */ - VertCoord_attr = glGetAttribLocation_func(program, "VertCoord"); + VertCoord_attr = glGetAttribLocation(program, "VertCoord"); assert(VertCoord_attr == 0); } - TexCoord0_attr = glGetAttribLocation_func(program, "TexCoord0"); - TexCoord1_attr = glGetAttribLocation_func(program, "TexCoord1"); + TexCoord0_attr = glGetAttribLocation(program, "TexCoord0"); + TexCoord1_attr = glGetAttribLocation(program, "TexCoord1"); printf("TexCoord0_attr = %d\n", TexCoord0_attr); printf("TexCoord1_attr = %d\n", TexCoord1_attr); @@ -316,8 +315,6 @@ InitGL(void) } printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); - GetExtensionFuncs(); - InitTextures(); InitPrograms(); diff --git a/progs/glsl/noise.c b/progs/glsl/noise.c index 83e4696fc9..59f594e78b 100644 --- a/progs/glsl/noise.c +++ b/progs/glsl/noise.c @@ -9,10 +9,7 @@ #include #include #include -#include #include -#include -#include "extfuncs.h" #include "shaderutil.h" @@ -68,7 +65,7 @@ Redisplay(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glUniform1fv_func(Uniforms[2].location, 1, &Slice); + glUniform1fv(Uniforms[2].location, 1, &Slice); glPushMatrix(); glRotatef(xRot, 1.0f, 0.0f, 0.0f); @@ -104,9 +101,9 @@ Reshape(int width, int height) static void CleanUp(void) { - glDeleteShader_func(fragShader); - glDeleteShader_func(vertShader); - glDeleteProgram_func(program); + glDeleteShader(fragShader); + glDeleteShader(vertShader); + glDeleteProgram(program); glutDestroyWindow(win); } @@ -176,13 +173,11 @@ Init(void) if (!ShadersSupported()) exit(1); - GetExtensionFuncs(); - vertShader = CompileShaderText(GL_VERTEX_SHADER, VertShaderText); fragShader = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderText); program = LinkShaders(vertShader, fragShader); - glUseProgram_func(program); + glUseProgram(program); InitUniforms(program, Uniforms); @@ -192,9 +187,9 @@ Init(void) printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); - assert(glIsProgram_func(program)); - assert(glIsShader_func(fragShader)); - assert(glIsShader_func(vertShader)); + assert(glIsProgram(program)); + assert(glIsShader(fragShader)); + assert(glIsShader(vertShader)); glColor3f(1, 0, 0); } diff --git a/progs/glsl/pointcoord.c b/progs/glsl/pointcoord.c index aa01e2166d..27b73a05de 100644 --- a/progs/glsl/pointcoord.c +++ b/progs/glsl/pointcoord.c @@ -11,10 +11,7 @@ #include #include #include -#include #include -#include -#include "extfuncs.h" #include "shaderutil.h" @@ -65,9 +62,9 @@ Reshape(int width, int height) static void CleanUp(void) { - glDeleteShader_func(fragShader); - glDeleteShader_func(vertShader); - glDeleteProgram_func(program); + glDeleteShader(fragShader); + glDeleteShader(vertShader); + glDeleteProgram(program); glutDestroyWindow(win); } @@ -142,18 +139,16 @@ Init(void) if (!ShadersSupported()) exit(1); - GetExtensionFuncs(); - vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText); fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText); program = LinkShaders(vertShader, fragShader); - glUseProgram_func(program); + glUseProgram(program); - tex0 = glGetUniformLocation_func(program, "tex0"); + tex0 = glGetUniformLocation(program, "tex0"); printf("Uniforms: tex0: %d\n", tex0); - glUniform1i_func(tex0, 0); /* tex unit 0 */ + glUniform1i(tex0, 0); /* tex unit 0 */ /*assert(glGetError() == 0);*/ @@ -161,9 +156,9 @@ Init(void) printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); - assert(glIsProgram_func(program)); - assert(glIsShader_func(fragShader)); - assert(glIsShader_func(vertShader)); + assert(glIsProgram(program)); + assert(glIsShader(fragShader)); + assert(glIsShader(vertShader)); MakeTexture(); diff --git a/progs/glsl/points.c b/progs/glsl/points.c index 1b346228aa..e5ee38c449 100644 --- a/progs/glsl/points.c +++ b/progs/glsl/points.c @@ -11,10 +11,7 @@ #include #include #include -#include #include -#include -#include "extfuncs.h" #include "shaderutil.h" @@ -100,7 +97,7 @@ Redisplay(void) */ glPushMatrix(); glTranslatef(0, 1.2, 0); - glUseProgram_func(0); + glUseProgram(0); DrawPoints(GL_FALSE); glPopMatrix(); @@ -109,9 +106,9 @@ Redisplay(void) */ glPushMatrix(); glTranslatef(0, -1.2, 0); - glUseProgram_func(Program); + glUseProgram(Program); if (uViewportInv != -1) { - glUniform2f_func(uViewportInv, 1.0 / WinWidth, 1.0 / WinHeight); + glUniform2f(uViewportInv, 1.0 / WinWidth, 1.0 / WinHeight); } DrawPoints(GL_TRUE); glPopMatrix(); @@ -151,9 +148,9 @@ Key(unsigned char key, int x, int y) Smooth = !Smooth; break; case 27: - glDeleteShader_func(FragShader); - glDeleteShader_func(VertShader); - glDeleteProgram_func(Program); + glDeleteShader(FragShader); + glDeleteShader(VertShader); + glDeleteProgram(Program); glutDestroyWindow(Win); exit(0); } @@ -226,17 +223,15 @@ Init(void) if (!ShadersSupported()) exit(1); - GetExtensionFuncs(); - VertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText); FragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText); Program = LinkShaders(VertShader, FragShader); - glUseProgram_func(Program); + glUseProgram(Program); - uViewportInv = glGetUniformLocation_func(Program, "viewportInv"); + uViewportInv = glGetUniformLocation(Program, "viewportInv"); - glUseProgram_func(0); + glUseProgram(0); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } diff --git a/progs/glsl/samplers.c b/progs/glsl/samplers.c index cbb264dad1..113e5bbeff 100644 --- a/progs/glsl/samplers.c +++ b/progs/glsl/samplers.c @@ -42,7 +42,6 @@ #include #include "GL/glut.h" #include "readtex.h" -#include "extfuncs.h" #include "shaderutil.h" @@ -291,7 +290,7 @@ CreateProgram(void) assert(vertShader); program = LinkShaders(vertShader, fragShader); - glUseProgram_func(program); + glUseProgram(program); free(fragShaderText); @@ -316,10 +315,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); } } @@ -334,8 +333,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; diff --git a/progs/glsl/shadow_sampler.c b/progs/glsl/shadow_sampler.c index 673ad465ad..0a4d04dd8c 100644 --- a/progs/glsl/shadow_sampler.c +++ b/progs/glsl/shadow_sampler.c @@ -11,10 +11,7 @@ #include #include #include -#include #include -#include -#include "extfuncs.h" /** Use GL_RECTANGLE texture (with projective texcoords)? */ @@ -67,7 +64,7 @@ Redisplay(void) glPushMatrix(); CheckError(__LINE__); - glUseProgram_func(program); + glUseProgram(program); CheckError(__LINE__); glBegin(GL_POLYGON); @@ -87,7 +84,7 @@ Redisplay(void) glPopMatrix(); - glUseProgram_func(0); + glUseProgram(0); glWindowPos2iARB(80, 20); PrintString("white black white black"); @@ -111,9 +108,9 @@ Reshape(int width, int height) static void CleanUp(void) { - glDeleteShader_func(fragShader); - glDeleteShader_func(vertShader); - glDeleteProgram_func(program); + glDeleteShader(fragShader); + glDeleteShader(vertShader); + glDeleteProgram(program); glutDestroyWindow(win); } @@ -179,13 +176,13 @@ static void LoadAndCompileShader(GLuint shader, const char *text) { GLint stat; - glShaderSource_func(shader, 1, (const GLchar **) &text, NULL); - glCompileShader_func(shader); - glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat); + glShaderSource(shader, 1, (const GLchar **) &text, NULL); + glCompileShader(shader); + 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, "fslight: problem compiling shader:\n%s\n", log); exit(1); } @@ -223,11 +220,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); } } @@ -267,35 +264,33 @@ Init(void) } printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); - GetExtensionFuncs(); - - fragShader = glCreateShader_func(GL_FRAGMENT_SHADER); + fragShader = glCreateShader(GL_FRAGMENT_SHADER); if (FragProgFile) ReadShader(fragShader, FragProgFile); else LoadAndCompileShader(fragShader, fragShaderText); - vertShader = glCreateShader_func(GL_VERTEX_SHADER); + vertShader = glCreateShader(GL_VERTEX_SHADER); if (VertProgFile) ReadShader(vertShader, VertProgFile); else LoadAndCompileShader(vertShader, vertShaderText); - program = glCreateProgram_func(); - glAttachShader_func(program, fragShader); - glAttachShader_func(program, vertShader); - glLinkProgram_func(program); + program = glCreateProgram(); + glAttachShader(program, fragShader); + glAttachShader(program, vertShader); + glLinkProgram(program); CheckLink(program); - glUseProgram_func(program); + glUseProgram(program); - uTexture2D = glGetUniformLocation_func(program, "shadowTex2D"); - uTextureRect = glGetUniformLocation_func(program, "shadowTexRect"); + uTexture2D = glGetUniformLocation(program, "shadowTex2D"); + uTextureRect = glGetUniformLocation(program, "shadowTexRect"); printf("uTexture2D %d uTextureRect %d\n", uTexture2D, uTextureRect); if (uTexture2D >= 0) { - glUniform1i_func(uTexture2D, 0); /* use texture unit 0 */ + glUniform1i(uTexture2D, 0); /* use texture unit 0 */ } if (uTextureRect >= 0) { - glUniform1i_func(uTextureRect, 1); /* use texture unit 0 */ + glUniform1i(uTextureRect, 1); /* use texture unit 0 */ } CheckError(__LINE__); diff --git a/progs/glsl/skinning.c b/progs/glsl/skinning.c index d7b968fed0..65ba98348b 100644 --- a/progs/glsl/skinning.c +++ b/progs/glsl/skinning.c @@ -13,10 +13,7 @@ #include #include #include -#include #include -#include -#include "extfuncs.h" #include "shaderutil.h" @@ -65,11 +62,11 @@ Cylinder(GLfloat length, GLfloat radius, GLint slices, GLint stacks) float a = (float) i / (slices - 1) * M_PI * 2.0; float x = radius * cos(a); float y = radius * sin(a); - glVertexAttrib1f_func(WeightAttr, w0); + glVertexAttrib1f(WeightAttr, w0); glNormal3f(x, y, 0.0); glVertex3f(x, y, z0); - glVertexAttrib1f_func(WeightAttr, w0 + dw); + glVertexAttrib1f(WeightAttr, w0 + dw); glNormal3f(x, y, 0.0); glVertex3f(x, y, z0 + dz); } @@ -107,8 +104,8 @@ Redisplay(void) { UpdateMatrices(); - glUniformMatrix4fv_func(uMat0, 1, GL_FALSE, Matrices[0]); - glUniformMatrix4fv_func(uMat1, 1, GL_FALSE, Matrices[1]); + glUniformMatrix4fv(uMat0, 1, GL_FALSE, Matrices[0]); + glUniformMatrix4fv(uMat1, 1, GL_FALSE, Matrices[1]); if (WireFrame) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); @@ -149,9 +146,9 @@ Reshape(int width, int height) static void CleanUp(void) { - glDeleteShader_func(fragShader); - glDeleteShader_func(vertShader); - glDeleteProgram_func(program); + glDeleteShader(fragShader); + glDeleteShader(vertShader); + glDeleteProgram(program); glutDestroyWindow(win); } @@ -222,18 +219,16 @@ Init(void) if (!ShadersSupported()) exit(1); - GetExtensionFuncs(); - vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile); fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile); program = LinkShaders(vertShader, fragShader); - glUseProgram_func(program); + glUseProgram(program); - uMat0 = glGetUniformLocation_func(program, "mat0"); - uMat1 = glGetUniformLocation_func(program, "mat1"); + uMat0 = glGetUniformLocation(program, "mat0"); + uMat1 = glGetUniformLocation(program, "mat1"); - WeightAttr = glGetAttribLocation_func(program, "weight"); + WeightAttr = glGetAttribLocation(program, "weight"); assert(glGetError() == 0); diff --git a/progs/glsl/texaaline.c b/progs/glsl/texaaline.c index 6720941a6e..1f566c86a6 100644 --- a/progs/glsl/texaaline.c +++ b/progs/glsl/texaaline.c @@ -12,10 +12,7 @@ #include #include #include -#include #include -#include -#include "extfuncs.h" static GLint WinWidth = 300, WinHeight = 300; @@ -329,8 +326,6 @@ Init(void) exit(1); } - GetExtensionFuncs(); - glClearColor(0.3f, 0.3f, 0.3f, 0.0f); printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); diff --git a/progs/glsl/texdemo1.c b/progs/glsl/texdemo1.c index 08a87a5152..d55f9e7dd9 100644 --- a/progs/glsl/texdemo1.c +++ b/progs/glsl/texdemo1.c @@ -31,7 +31,6 @@ #include #include "GL/glut.h" #include "readtex.h" -#include "extfuncs.h" #include "shaderutil.h" static const char *Demo = "texdemo1"; @@ -98,7 +97,7 @@ draw(void) /* sphere w/ reflection map */ glPushMatrix(); glTranslatef(0, 1, 0); - glUseProgram_func(Program1); + glUseProgram(Program1); /* setup texture matrix */ glActiveTexture(GL_TEXTURE0); @@ -117,7 +116,7 @@ draw(void) glPopMatrix(); /* ground */ - glUseProgram_func(Program2); + glUseProgram(Program2); glTranslatef(0, -1.0, 0); DrawGround(5); @@ -381,7 +380,7 @@ CreateProgram(const char *vertProgFile, const char *fragProgFile, fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, fragProgFile); program = LinkShaders(vertShader, fragShader); - glUseProgram_func(program); + glUseProgram(program); InitUniforms(program, uniforms); @@ -408,8 +407,6 @@ Init(GLboolean useImageFiles) } printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); - GetExtensionFuncs(); - InitTextures(useImageFiles); InitPrograms(); diff --git a/progs/glsl/toyball.c b/progs/glsl/toyball.c index 2b644acb6d..7fe27aebfe 100644 --- a/progs/glsl/toyball.c +++ b/progs/glsl/toyball.c @@ -10,10 +10,7 @@ #include #include #include -#include #include -#include -#include "extfuncs.h" #include "shaderutil.h" @@ -100,9 +97,9 @@ Reshape(int width, int height) static void CleanUp(void) { - glDeleteShader_func(fragShader); - glDeleteShader_func(vertShader); - glDeleteProgram_func(program); + glDeleteShader(fragShader); + glDeleteShader(vertShader); + glDeleteProgram(program); glutDestroyWindow(win); } @@ -170,13 +167,11 @@ Init(void) if (!ShadersSupported()) exit(1); - GetExtensionFuncs(); - vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile); fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile); program = LinkShaders(vertShader, fragShader); - glUseProgram_func(program); + glUseProgram(program); InitUniforms(program, Uniforms); diff --git a/progs/glsl/trirast.c b/progs/glsl/trirast.c index 3d4decaa2f..f7546f25a2 100644 --- a/progs/glsl/trirast.c +++ b/progs/glsl/trirast.c @@ -16,10 +16,7 @@ #include #include #include -#include #include -#include -#include "extfuncs.h" #include "shaderutil.h" @@ -86,9 +83,9 @@ Redisplay(void) RotateVerts(Zrot, 3, TriVerts, v); ComputeBounds(3, v, &xmin, &ymin, &xmax, &ymax); - glUniform2fv_func(uv0, 1, v[0]); - glUniform2fv_func(uv1, 1, v[1]); - glUniform2fv_func(uv2, 1, v[2]); + glUniform2fv(uv0, 1, v[0]); + glUniform2fv(uv1, 1, v[1]); + glUniform2fv(uv2, 1, v[2]); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -133,9 +130,9 @@ Reshape(int width, int height) static void CleanUp(void) { - glDeleteShader_func(fragShader); - glDeleteShader_func(vertShader); - glDeleteProgram_func(program); + glDeleteShader(fragShader); + glDeleteShader(vertShader); + glDeleteProgram(program); glutDestroyWindow(win); } @@ -197,17 +194,15 @@ Init(void) if (!ShadersSupported()) exit(1); - GetExtensionFuncs(); - vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText); fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText); program = LinkShaders(vertShader, fragShader); - glUseProgram_func(program); + glUseProgram(program); - uv0 = glGetUniformLocation_func(program, "v0"); - uv1 = glGetUniformLocation_func(program, "v1"); - uv2 = glGetUniformLocation_func(program, "v2"); + uv0 = glGetUniformLocation(program, "v0"); + uv1 = glGetUniformLocation(program, "v1"); + uv2 = glGetUniformLocation(program, "v2"); printf("Uniforms: %d %d %d\n", uv0, uv1, uv2); /*assert(glGetError() == 0);*/ @@ -217,9 +212,9 @@ Init(void) printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); - assert(glIsProgram_func(program)); - assert(glIsShader_func(fragShader)); - assert(glIsShader_func(vertShader)); + assert(glIsProgram(program)); + assert(glIsShader(fragShader)); + assert(glIsShader(vertShader)); glColor3f(1, 0, 0); } diff --git a/progs/glsl/twoside.c b/progs/glsl/twoside.c index 9ebc4ec360..b6c1b477dd 100644 --- a/progs/glsl/twoside.c +++ b/progs/glsl/twoside.c @@ -13,10 +13,7 @@ #include #include #include -#include #include -#include -#include "extfuncs.h" #include "shaderutil.h" @@ -60,11 +57,11 @@ Redisplay(void) glFrontFace(FrontWinding); if (DetermineFacingInFragProg) { - glUniform1i_func(u_fragface, 1); + glUniform1i(u_fragface, 1); glDisable(GL_VERTEX_PROGRAM_TWO_SIDE); } else { - glUniform1i_func(u_fragface, 0); + glUniform1i(u_fragface, 0); glEnable(GL_VERTEX_PROGRAM_TWO_SIDE); } @@ -76,7 +73,7 @@ Redisplay(void) /* Draw a tristrip ring */ glBegin(GL_TRIANGLE_STRIP); glColor4fv(Red); - glSecondaryColor3fv_func(Green); + glSecondaryColor3fv(Green); for (i = 0; i <= sections; i++) { float a = (float) i / (sections) * M_PI * 2.0; float x = radius * cos(a); @@ -126,9 +123,9 @@ Reshape(int width, int height) static void CleanUp(void) { - glDeleteShader_func(fragShader); - glDeleteShader_func(vertShader); - glDeleteProgram_func(program); + glDeleteShader(fragShader); + glDeleteShader(vertShader); + glDeleteProgram(program); glutDestroyWindow(win); } @@ -230,15 +227,13 @@ Init(void) if (!ShadersSupported()) exit(1); - GetExtensionFuncs(); - vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText); fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText); program = LinkShaders(vertShader, fragShader); - glUseProgram_func(program); + glUseProgram(program); - u_fragface = glGetUniformLocation_func(program, "fragface"); + u_fragface = glGetUniformLocation(program, "fragface"); printf("Uniforms: %d\n", u_fragface); /*assert(glGetError() == 0);*/ @@ -247,9 +242,9 @@ Init(void) printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); - assert(glIsProgram_func(program)); - assert(glIsShader_func(fragShader)); - assert(glIsShader_func(vertShader)); + assert(glIsProgram(program)); + assert(glIsShader(fragShader)); + assert(glIsShader(vertShader)); glEnable(GL_DEPTH_TEST); diff --git a/progs/glsl/vert-or-frag-only.c b/progs/glsl/vert-or-frag-only.c index 8e1612aca4..81fcab8c5b 100644 --- a/progs/glsl/vert-or-frag-only.c +++ b/progs/glsl/vert-or-frag-only.c @@ -12,10 +12,7 @@ #include #include #include -#include #include -#include -#include "extfuncs.h" #include "shaderutil.h" @@ -59,14 +56,14 @@ Redisplay(void) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); /* render with vertex shader only */ - glUseProgram_func(VertProgram); + glUseProgram(VertProgram); glPushMatrix(); glTranslatef(-1.5, 0, 0); DrawQuadTex(); glPopMatrix(); /* render with fragment shader only */ - glUseProgram_func(FragProgram); + glUseProgram(FragProgram); glPushMatrix(); glTranslatef(+1.5, 0, 0); DrawQuadColor(); @@ -91,10 +88,10 @@ Reshape(int width, int height) static void CleanUp(void) { - glDeleteShader_func(FragShader); - glDeleteShader_func(VertShader); - glDeleteProgram_func(VertProgram); - glDeleteProgram_func(FragProgram); + glDeleteShader(FragShader); + glDeleteShader(VertShader); + glDeleteProgram(VertProgram); + glDeleteProgram(FragProgram); glutDestroyWindow(Win); } @@ -130,8 +127,6 @@ Init(void) if (!ShadersSupported()) exit(1); - GetExtensionFuncs(); - if (FragProgFile) FragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile); else @@ -150,10 +145,10 @@ Init(void) printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); - assert(glIsProgram_func(VertProgram)); - assert(glIsProgram_func(FragProgram)); - assert(glIsShader_func(FragShader)); - assert(glIsShader_func(VertShader)); + assert(glIsProgram(VertProgram)); + assert(glIsProgram(FragProgram)); + assert(glIsShader(FragShader)); + assert(glIsShader(VertShader)); glColor3f(1, 0, 0); } diff --git a/progs/glsl/vert-tex.c b/progs/glsl/vert-tex.c index b74bf50679..e791a5759a 100644 --- a/progs/glsl/vert-tex.c +++ b/progs/glsl/vert-tex.c @@ -10,10 +10,7 @@ #include #include #include -#include #include -#include -#include "extfuncs.h" #include "shaderutil.h" @@ -134,9 +131,9 @@ Reshape(int width, int height) static void CleanUp(void) { - glDeleteShader_func(fragShader); - glDeleteShader_func(vertShader); - glDeleteProgram_func(program); + glDeleteShader(fragShader); + glDeleteShader(vertShader); + glDeleteProgram(program); glutDestroyWindow(win); } @@ -240,13 +237,11 @@ Init(void) if (!ShadersSupported()) exit(1); - GetExtensionFuncs(); - vertShader = CompileShaderText(GL_VERTEX_SHADER, VertShaderText); fragShader = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderText); program = LinkShaders(vertShader, fragShader); - glUseProgram_func(program); + glUseProgram(program); assert(glGetError() == 0); -- cgit v1.2.3 From cd10996d4f517c69e306eaf6dfb0654432651b3a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 17 Jul 2009 14:43:29 -0600 Subject: progs/util: remove extfuncs.h (we use GLEW instead) --- progs/util/shaderutil.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) (limited to 'progs') diff --git a/progs/util/shaderutil.c b/progs/util/shaderutil.c index 5cef84eb49..13b68d90e0 100644 --- a/progs/util/shaderutil.c +++ b/progs/util/shaderutil.c @@ -11,7 +11,6 @@ #include #include #include -#include "extfuncs.h" #include "shaderutil.h" @@ -20,7 +19,6 @@ Init(void) { static GLboolean firstCall = GL_TRUE; if (firstCall) { - GetExtensionFuncs(); firstCall = GL_FALSE; } } @@ -51,14 +49,14 @@ CompileShaderText(GLenum shaderType, const char *text) Init(); - shader = glCreateShader_func(shaderType); - glShaderSource_func(shader, 1, (const GLchar **) &text, NULL); - glCompileShader_func(shader); - glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat); + shader = glCreateShader(shaderType); + glShaderSource(shader, 1, (const GLchar **) &text, NULL); + glCompileShader(shader); + 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, "Error: problem compiling shader: %s\n", log); exit(1); } @@ -110,24 +108,24 @@ CompileShaderFile(GLenum shaderType, const char *filename) GLuint LinkShaders(GLuint vertShader, GLuint fragShader) { - GLuint program = glCreateProgram_func(); + GLuint program = glCreateProgram(); assert(vertShader || fragShader); if (fragShader) - glAttachShader_func(program, fragShader); + glAttachShader(program, fragShader); if (vertShader) - glAttachShader_func(program, vertShader); - glLinkProgram_func(program); + glAttachShader(program, vertShader); + glLinkProgram(program); /* check link */ { GLint stat; - glGetProgramiv_func(program, GL_LINK_STATUS, &stat); + glGetProgramiv(program, GL_LINK_STATUS, &stat); if (!stat) { GLchar log[1000]; GLsizei len; - glGetProgramInfoLog_func(program, 1000, &len, log); + glGetProgramInfoLog(program, 1000, &len, log); fprintf(stderr, "Shader link error:\n%s\n", log); return 0; } @@ -144,7 +142,7 @@ InitUniforms(GLuint program, struct uniform_info uniforms[]) for (i = 0; uniforms[i].name; i++) { uniforms[i].location - = glGetUniformLocation_func(program, uniforms[i].name); + = glGetUniformLocation(program, uniforms[i].name); printf("Uniform %s location: %d\n", uniforms[i].name, uniforms[i].location); @@ -152,19 +150,19 @@ InitUniforms(GLuint program, struct uniform_info uniforms[]) switch (uniforms[i].size) { case 1: if (uniforms[i].type == GL_INT) - glUniform1i_func(uniforms[i].location, + glUniform1i(uniforms[i].location, (GLint) uniforms[i].value[0]); else - glUniform1fv_func(uniforms[i].location, 1, uniforms[i].value); + glUniform1fv(uniforms[i].location, 1, uniforms[i].value); break; case 2: - glUniform2fv_func(uniforms[i].location, 1, uniforms[i].value); + glUniform2fv(uniforms[i].location, 1, uniforms[i].value); break; case 3: - glUniform3fv_func(uniforms[i].location, 1, uniforms[i].value); + glUniform3fv(uniforms[i].location, 1, uniforms[i].value); break; case 4: - glUniform4fv_func(uniforms[i].location, 1, uniforms[i].value); + glUniform4fv(uniforms[i].location, 1, uniforms[i].value); break; default: abort(); -- cgit v1.2.3