diff options
author | Julien Cristau <[email protected]> | 2007-04-21 20:27:55 +0200 |
---|---|---|
committer | Julien Cristau <[email protected]> | 2007-04-21 20:27:55 +0200 |
commit | d890ebdd2591c5c09038c8986341da17127ba930 (patch) | |
tree | 46b3b277f2dca3a2ee7741be0f0ec41db7bd5313 /progs/demos | |
parent | 5ee9b3ce729c41dff80dc7ee2db8fdc30585c9e2 (diff) | |
parent | 5ca8d4ccf24af1c174ff791f15cf9f19defd9b7e (diff) |
Merge branch 'upstream-experimental' into debian-experimental
Conflicts:
doxygen/Makefile
doxygen/common.doxy
doxygen/doxy.bat
doxygen/glapi.doxy
doxygen/header.html
doxygen/main.doxy
doxygen/math.doxy
doxygen/shader.doxy
doxygen/swrast.doxy
doxygen/swrast_setup.doxy
doxygen/tnl.doxy
doxygen/tnl_dd.doxy
progs/tests/Makefile
progs/tests/fbotest1.c
progs/tests/fbotest2.c
progs/tests/fbotexture.c
progs/tests/mipmap_limits.c
progs/tests/sharedtex.c
progs/tools/trace/gltrace_support.cc
progs/trivial/Makefile
src/egl/docs/EGL_MESA_screen_surface
src/egl/main/egllog.c
src/glx/mini/Makefile
src/glx/mini/driver.h
src/mesa/drivers/allegro/amesa.c
src/mesa/drivers/windows/gldirect/dx7/gld_driver_dx7.c
src/mesa/drivers/windows/gldirect/dx7/gld_ext_dx7.c
src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c
src/mesa/drivers/windows/gldirect/dx8/gld_driver_dx8.c
src/mesa/drivers/windows/gldirect/dx8/gld_ext_dx8.c
src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c
src/mesa/drivers/windows/gldirect/dx9/gld_driver_dx9.c
src/mesa/drivers/windows/gldirect/dx9/gld_ext_dx9.c
src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c
src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c
Diffstat (limited to 'progs/demos')
-rw-r--r-- | progs/demos/.gitignore (renamed from progs/demos/.cvsignore) | 0 | ||||
-rw-r--r-- | progs/demos/Makefile | 20 | ||||
-rw-r--r-- | progs/demos/fogcoord.c | 364 | ||||
-rw-r--r-- | progs/demos/fslight.c | 393 | ||||
-rw-r--r-- | progs/demos/texdown.c | 8 | ||||
-rw-r--r-- | progs/demos/winpos.c | 2 |
6 files changed, 547 insertions, 240 deletions
diff --git a/progs/demos/.cvsignore b/progs/demos/.gitignore index f764b3d117e..f764b3d117e 100644 --- a/progs/demos/.cvsignore +++ b/progs/demos/.gitignore diff --git a/progs/demos/Makefile b/progs/demos/Makefile index 4623d6c8d91..cf96828ed7f 100644 --- a/progs/demos/Makefile +++ b/progs/demos/Makefile @@ -113,34 +113,46 @@ trackball.o: trackball.c trackball.h $(CC) -c -I$(INCDIR) $(CFLAGS) trackball.c +extfuncs.h: $(TOP)/progs/util/extfuncs.h + cp $< . + + reflect: reflect.o showbuffer.o readtex.o - $(CC) -I$(INCDIR) $(CFLAGS) reflect.o showbuffer.o readtex.o $(APP_LIB_DEPS) -o $@ + $(CC) reflect.o showbuffer.o readtex.o $(APP_LIB_DEPS) -o $@ reflect.o: reflect.c showbuffer.h $(CC) -c -I$(INCDIR) $(CFLAGS) reflect.c shadowtex: shadowtex.o showbuffer.o - $(CC) -I$(INCDIR) $(CFLAGS) shadowtex.o showbuffer.o $(APP_LIB_DEPS) -o $@ + $(CC) shadowtex.o showbuffer.o $(APP_LIB_DEPS) -o $@ shadowtex.o: shadowtex.c showbuffer.h $(CC) -c -I$(INCDIR) $(CFLAGS) shadowtex.c gloss: gloss.o trackball.o readtex.o - $(CC) -I$(INCDIR) $(CFLAGS) gloss.o trackball.o readtex.o $(APP_LIB_DEPS) -o $@ + $(CC) gloss.o trackball.o readtex.o $(APP_LIB_DEPS) -o $@ gloss.o: gloss.c trackball.h $(CC) -c -I$(INCDIR) $(CFLAGS) gloss.c engine: engine.o trackball.o readtex.o - $(CC) -I$(INCDIR) $(CFLAGS) engine.o trackball.o readtex.o $(APP_LIB_DEPS) -o $@ + $(CC) engine.o trackball.o readtex.o $(APP_LIB_DEPS) -o $@ engine.o: engine.c trackball.h $(CC) -c -I$(INCDIR) $(CFLAGS) engine.c +fslight: fslight.o + $(CC) fslight.o $(APP_LIB_DEPS) -o $@ + +fslight.o: fslight.c extfuncs.h + $(CC) -c -I$(INCDIR) $(CFLAGS) fslight.c + + + clean: -rm -f $(PROGS) -rm -f *.o *~ diff --git a/progs/demos/fogcoord.c b/progs/demos/fogcoord.c index 19a15f05b87..00c73c6f048 100644 --- a/progs/demos/fogcoord.c +++ b/progs/demos/fogcoord.c @@ -7,151 +7,136 @@ * Daniel Borca */ - +#define GL_GLEXT_PROTOTYPES #include <stdio.h> #include <stdlib.h> #include <math.h> #include <GL/glut.h> -#include "readtex.h" - -#define TEXTURE_FILE "../images/bw.rgb" - -#define ARRAYS 0 /* use glDrawElements */ - -#define VERBOSE 1 /* tell me what happens */ +#define DEPTH 5.0f -#define DEPTH 15.0f +static PFNGLFOGCOORDFEXTPROC glFogCoordf_ext; +static PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointer_ext; -#if !defined(GLAPIENTRYP) -# define GLAPIENTRYP * -#endif - -typedef void (GLAPIENTRYP GLFOGCOORDFEXTPROC) (GLfloat f); -typedef void (GLAPIENTRYP GLFOGCOORDPOINTEREXTPROC) (GLenum, GLsizei, const GLvoid *); - -static GLFOGCOORDFEXTPROC glFogCoordf_ext; -#if ARRAYS -static GLFOGCOORDPOINTEREXTPROC glFogCoordPointer_ext; -#endif static GLboolean have_fog_coord; static GLfloat camz; -static GLuint texture[1]; static GLint fogMode; static GLboolean fogCoord; static GLfloat fogDensity = 0.75; -static GLfloat fogStart = 1.0, fogEnd = 40.0; +static GLfloat fogStart = 1.0, fogEnd = DEPTH; static GLfloat fogColor[4] = {0.6f, 0.3f, 0.0f, 1.0f}; +static const char *ModeStr = NULL; +static GLboolean Arrays = GL_FALSE; +static GLboolean Texture = GL_TRUE; -static void APIENTRY glFogCoordf_nop (GLfloat f) +static void +Reset(void) { - (void)f; + fogMode = 1; + fogCoord = 1; + fogDensity = 0.75; + fogStart = 1.0; + fogEnd = DEPTH; + Arrays = GL_FALSE; + Texture = GL_TRUE; } -static int BuildTexture (const char *filename, GLuint texid[]) +static void APIENTRY +glFogCoordf_nop (GLfloat f) { - GLubyte *tex_data; - GLenum tex_format; - GLint tex_width, tex_height; + (void)f; +} - tex_data = LoadRGBImage(filename, &tex_width, &tex_height, &tex_format); - if (tex_data == NULL) { - return -1; - } - { - GLint tex_max; - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &tex_max); - if ((tex_width > tex_max) || (tex_height > tex_max)) { - return -1; - } +static void +PrintString(const char *s) +{ + while (*s) { + glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s); + s++; } +} - glGenTextures(1, texid); - - glBindTexture(GL_TEXTURE_2D, texid[0]); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - - glTexImage2D(GL_TEXTURE_2D, 0, tex_format, tex_width, tex_height, 0, - tex_format, GL_UNSIGNED_BYTE, tex_data); - return 0; +static void +PrintInfo(void) +{ + char s[100]; + + glDisable(GL_FOG); + glColor3f(0, 1, 1); + + sprintf(s, "Mode(m): %s Start(s/S): %g End(e/E): %g Density(d/D): %g", + ModeStr, fogStart, fogEnd, fogDensity); + glWindowPos2iARB(5, 20); + PrintString(s); + + sprintf(s, "Arrays(a): %s glFogCoord(c): %s EyeZ(z/z): %g", + (Arrays ? "Yes" : "No"), + (fogCoord ? "Yes" : "No"), + camz); + glWindowPos2iARB(5, 5); + PrintString(s); } -static int SetFogMode (GLint fogMode) +static int +SetFogMode(GLint fogMode) { fogMode &= 3; switch (fogMode) { case 0: + ModeStr = "Off"; glDisable(GL_FOG); -#if VERBOSE - printf("fog(disable)\n"); -#endif break; case 1: + ModeStr = "GL_LINEAR"; glEnable(GL_FOG); glFogi(GL_FOG_MODE, GL_LINEAR); glFogf(GL_FOG_START, fogStart); glFogf(GL_FOG_END, fogEnd); -#if VERBOSE - printf("fog(GL_LINEAR, %.2f, %.2f)\n", fogStart, fogEnd); -#endif break; case 2: + ModeStr = "GL_EXP"; glEnable(GL_FOG); glFogi(GL_FOG_MODE, GL_EXP); glFogf(GL_FOG_DENSITY, fogDensity); -#if VERBOSE - printf("fog(GL_EXP, %.2f)\n", fogDensity); -#endif break; case 3: + ModeStr = "GL_EXP2"; glEnable(GL_FOG); glFogi(GL_FOG_MODE, GL_EXP2); glFogf(GL_FOG_DENSITY, fogDensity); -#if VERBOSE - printf("fog(GL_EXP2, %.2f)\n", fogDensity); -#endif break; } return fogMode; } -static GLboolean SetFogCoord (GLboolean fogCoord) +static GLboolean +SetFogCoord(GLboolean fogCoord) { glFogCoordf_ext = glFogCoordf_nop; if (!have_fog_coord) { -#if VERBOSE - printf("fog(GL_FRAGMENT_DEPTH_EXT)%s\n", fogCoord ? " EXT_fog_coord not available!" : ""); -#endif return GL_FALSE; } if (fogCoord) { - glFogCoordf_ext = (GLFOGCOORDFEXTPROC)glutGetProcAddress("glFogCoordfEXT"); + glFogCoordf_ext = (PFNGLFOGCOORDFEXTPROC)glutGetProcAddress("glFogCoordfEXT"); glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT); -#if VERBOSE - printf("fog(GL_FOG_COORDINATE_EXT)\n"); -#endif - } else { + } + else { glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT); -#if VERBOSE - printf("fog(GL_FRAGMENT_DEPTH_EXT)\n"); -#endif } return fogCoord; } -#if ARRAYS /* could reuse vertices */ static GLuint vertex_index[] = { /* Back */ @@ -172,19 +157,19 @@ static GLuint vertex_index[] = { static GLfloat vertex_pointer[][3] = { /* Back */ - {-2.5f,-2.5f,-DEPTH}, { 2.5f,-2.5f,-DEPTH}, { 2.5f, 2.5f,-DEPTH}, {-2.5f, 2.5f,-DEPTH}, + {-1.0f,-1.0f,-DEPTH}, { 1.0f,-1.0f,-DEPTH}, { 1.0f, 1.0f,-DEPTH}, {-1.0f, 1.0f,-DEPTH}, /* Floor */ - {-2.5f,-2.5f,-DEPTH}, { 2.5f,-2.5f,-DEPTH}, { 2.5f,-2.5f, DEPTH}, {-2.5f,-2.5f, DEPTH}, + {-1.0f,-1.0f,-DEPTH}, { 1.0f,-1.0f,-DEPTH}, { 1.0f,-1.0f, 0.0}, {-1.0f,-1.0f, 0.0}, /* Roof */ - {-2.5f, 2.5f,-DEPTH}, { 2.5f, 2.5f,-DEPTH}, { 2.5f, 2.5f, DEPTH}, {-2.5f, 2.5f, DEPTH}, + {-1.0f, 1.0f,-DEPTH}, { 1.0f, 1.0f,-DEPTH}, { 1.0f, 1.0f, 0.0}, {-1.0f, 1.0f, 0.0}, /* Right */ - { 2.5f,-2.5f, DEPTH}, { 2.5f, 2.5f, DEPTH}, { 2.5f, 2.5f,-DEPTH}, { 2.5f,-2.5f,-DEPTH}, + { 1.0f,-1.0f, 0.0}, { 1.0f, 1.0f, 0.0}, { 1.0f, 1.0f,-DEPTH}, { 1.0f,-1.0f,-DEPTH}, /* Left */ - {-2.5f,-2.5f, DEPTH}, {-2.5f, 2.5f, DEPTH}, {-2.5f, 2.5f,-DEPTH}, {-2.5f,-2.5f,-DEPTH} + {-1.0f,-1.0f, 0.0}, {-1.0f, 1.0f, 0.0}, {-1.0f, 1.0f,-DEPTH}, {-1.0f,-1.0f,-DEPTH} }; static GLfloat texcoord_pointer[][2] = { @@ -192,118 +177,139 @@ static GLfloat texcoord_pointer[][2] = { {0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f}, /* Floor */ - {0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f}, + {0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, DEPTH}, {0.0f, DEPTH}, /* Roof */ - {0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f}, + {1.0f, 0.0f}, {0.0f, 0.0f}, {0.0f, DEPTH}, {1.0f, DEPTH}, /* Right */ - {0.0f, 0.0f}, {0.0f, 1.0f}, {1.0f, 1.0f}, {1.0f, 0.0f}, + {0.0f, 1.0f}, {0.0f, 0.0f}, {DEPTH, 0.0f}, {DEPTH, 1.0f}, /* Left */ - {0.0f, 0.0f}, {0.0f, 1.0f}, {1.0f, 1.0f}, {1.0f, 0.0f} + {0.0f, 0.0f}, {0.0f, 1.0f}, {DEPTH, 1.0f}, {DEPTH, 0.0f} }; -static GLfloat fogcoord_pointer[][1] = { +static GLfloat fogcoord_pointer[] = { /* Back */ - {1.0f}, {1.0f}, {1.0f}, {1.0f}, + DEPTH, DEPTH, DEPTH, DEPTH, /* Floor */ - {1.0f}, {1.0f}, {0.0f}, {0.0f}, + DEPTH, DEPTH, 0.0, 0.0, /* Roof */ - {1.0f}, {1.0f}, {0.0f}, {0.0f}, + DEPTH, DEPTH, 0.0, 0.0, /* Right */ - {0.0f}, {0.0f}, {1.0f}, {1.0f}, + 0.0, 0.0, DEPTH, DEPTH, /* Left */ - {0.0f}, {0.0f}, {1.0f}, {1.0f} + 0.0, 0.0, DEPTH, DEPTH }; -#endif -static void Display( void ) +static void +Display( void ) { glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity (); - glTranslatef(0.0f, 0.0f, camz); + glTranslatef(0.0f, 0.0f, -camz); -#if ARRAYS - glDrawElements(GL_QUADS, sizeof(vertex_index) / sizeof(vertex_index[0]), GL_UNSIGNED_INT, vertex_index); -#else - /* Back */ - glBegin(GL_QUADS); - glFogCoordf_ext(1.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(-2.5f,-2.5f,-DEPTH); - glFogCoordf_ext(1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f( 2.5f,-2.5f,-DEPTH); - glFogCoordf_ext(1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f( 2.5f, 2.5f,-DEPTH); - glFogCoordf_ext(1.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-2.5f, 2.5f,-DEPTH); - glEnd(); + SetFogMode(fogMode); - /* Floor */ - glBegin(GL_QUADS); - glFogCoordf_ext(1.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(-2.5f,-2.5f,-DEPTH); - glFogCoordf_ext(1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f( 2.5f,-2.5f,-DEPTH); - glFogCoordf_ext(0.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f( 2.5f,-2.5f, DEPTH); - glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-2.5f,-2.5f, DEPTH); - glEnd(); + glColor3f(1, 1, 1); - /* Roof */ - glBegin(GL_QUADS); - glFogCoordf_ext(1.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(-2.5f, 2.5f,-DEPTH); - glFogCoordf_ext(1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f( 2.5f, 2.5f,-DEPTH); - glFogCoordf_ext(0.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f( 2.5f, 2.5f, DEPTH); - glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-2.5f, 2.5f, DEPTH); - glEnd(); + if (Texture) + glEnable(GL_TEXTURE_2D); - /* Right */ - glBegin(GL_QUADS); - glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f( 2.5f,-2.5f, DEPTH); - glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f( 2.5f, 2.5f, DEPTH); - glFogCoordf_ext(1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f( 2.5f, 2.5f,-DEPTH); - glFogCoordf_ext(1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f( 2.5f,-2.5f,-DEPTH); - glEnd(); + if (Arrays) { + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glDrawElements(GL_QUADS, sizeof(vertex_index) / sizeof(vertex_index[0]), + GL_UNSIGNED_INT, vertex_index); + glDisableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + } + else { + /* Back */ + glBegin(GL_QUADS); + glFogCoordf_ext(DEPTH); glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f,-1.0f,-DEPTH); + glFogCoordf_ext(DEPTH); glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f,-1.0f,-DEPTH); + glFogCoordf_ext(DEPTH); glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f,-DEPTH); + glFogCoordf_ext(DEPTH); glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f,-DEPTH); + glEnd(); + + /* Floor */ + glBegin(GL_QUADS); + glFogCoordf_ext(DEPTH); glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f,-1.0f,-DEPTH); + glFogCoordf_ext(DEPTH); glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f,-1.0f,-DEPTH); + glFogCoordf_ext(0.0f); glTexCoord2f(1.0f, DEPTH); glVertex3f( 1.0f,-1.0f,0.0); + glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, DEPTH); glVertex3f(-1.0f,-1.0f,0.0); + glEnd(); + + /* Roof */ + glBegin(GL_QUADS); + glFogCoordf_ext(DEPTH); glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, 1.0f,-DEPTH); + glFogCoordf_ext(DEPTH); glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, 1.0f,-DEPTH); + glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, DEPTH); glVertex3f( 1.0f, 1.0f,0.0); + glFogCoordf_ext(0.0f); glTexCoord2f(1.0f, DEPTH); glVertex3f(-1.0f, 1.0f,0.0); + glEnd(); + + /* Right */ + glBegin(GL_QUADS); + glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f,-1.0f,0.0); + glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, 1.0f,0.0); + glFogCoordf_ext(DEPTH); glTexCoord2f(DEPTH, 0.0f); glVertex3f( 1.0f, 1.0f,-DEPTH); + glFogCoordf_ext(DEPTH); glTexCoord2f(DEPTH, 1.0f); glVertex3f( 1.0f,-1.0f,-DEPTH); + glEnd(); + + /* Left */ + glBegin(GL_QUADS); + glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f,-1.0f,0.0); + glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f,0.0); + glFogCoordf_ext(DEPTH); glTexCoord2f(DEPTH, 1.0f); glVertex3f(-1.0f, 1.0f,-DEPTH); + glFogCoordf_ext(DEPTH); glTexCoord2f(DEPTH, 0.0f); glVertex3f(-1.0f,-1.0f,-DEPTH); + glEnd(); + } - /* Left */ - glBegin(GL_QUADS); - glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(-2.5f,-2.5f, DEPTH); - glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-2.5f, 2.5f, DEPTH); - glFogCoordf_ext(1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f(-2.5f, 2.5f,-DEPTH); - glFogCoordf_ext(1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(-2.5f,-2.5f,-DEPTH); - glEnd(); -#endif + glDisable(GL_TEXTURE_2D); + + PrintInfo(); glutSwapBuffers(); } -static void Reshape( int width, int height ) +static void +Reshape( int width, int height ) { glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); - gluPerspective(45.0f, (GLfloat)(width)/(GLfloat)(height), 0.1f, 100.0f); + glFrustum(-1, 1, -1, 1, 1.0, 100); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } -static void Key( unsigned char key, int x, int y ) +static void +Key( unsigned char key, int x, int y ) { (void) x; (void) y; switch (key) { + case 'a': + Arrays = !Arrays; + break; case 'f': + case 'm': fogMode = SetFogMode(fogMode + 1); break; - case '+': - if (fogDensity < 1.0) { - fogDensity += 0.05; - } + case 'D': + fogDensity += 0.05; SetFogMode(fogMode); break; - case '-': + case 'd': if (fogDensity > 0.0) { fogDensity -= 0.05; } @@ -311,31 +317,43 @@ static void Key( unsigned char key, int x, int y ) break; case 's': if (fogStart > 0.0) { - fogStart -= 1.0; + fogStart -= 0.25; } SetFogMode(fogMode); break; case 'S': - if (fogStart < fogEnd) { - fogStart += 1.0; + if (fogStart < 100.0) { + fogStart += 0.25; } SetFogMode(fogMode); break; case 'e': - if (fogEnd > fogStart) { - fogEnd -= 1.0; + if (fogEnd > 0.0) { + fogEnd -= 0.25; } SetFogMode(fogMode); break; case 'E': if (fogEnd < 100.0) { - fogEnd += 1.0; + fogEnd += 0.25; } SetFogMode(fogMode); break; case 'c': fogCoord = SetFogCoord(fogCoord ^ GL_TRUE); break; + case 't': + Texture = !Texture; + break; + case 'z': + camz -= 0.1; + break; + case 'Z': + camz += 0.1; + break; + case 'r': + Reset(); + break; case 27: exit(0); break; @@ -344,37 +362,28 @@ static void Key( unsigned char key, int x, int y ) } -static void SpecialKey( int key, int x, int y ) +static void +Init(void) { - (void) x; - (void) y; - switch (key) { - case GLUT_KEY_UP: - if (camz < (DEPTH - 1.0)) { - camz += 1.0f; - } - break; - case GLUT_KEY_DOWN: - if (camz > -19.0) { - camz -= 1.0f; - } - break; - } - glutPostRedisplay(); -} + static const GLubyte teximage[2][2][4] = { + { { 255, 255, 255, 255}, { 128, 128, 128, 255} }, + { { 128, 128, 128, 255}, { 255, 255, 255, 255} } + }; + printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); -static void Init( void ) -{ have_fog_coord = glutExtensionSupported("GL_EXT_fog_coord"); - - if (BuildTexture(TEXTURE_FILE, texture) == -1) { - exit(1); + if (!have_fog_coord) { + printf("GL_EXT_fog_coord not supported!\n"); } - glEnable(GL_TEXTURE_2D); - glClearColor(0.0f, 0.0f, 0.0f, 0.5f); - glClearDepth(1.0f); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, + GL_RGBA, GL_UNSIGNED_BYTE, teximage); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + + glClearColor(0.1f, 0.1f, 0.1f, 0.0f); + glDepthFunc(GL_LEQUAL); glEnable(GL_DEPTH_TEST); glShadeModel(GL_SMOOTH); @@ -383,11 +392,8 @@ static void Init( void ) glFogfv(GL_FOG_COLOR, fogColor); glHint(GL_FOG_HINT, GL_NICEST); fogCoord = SetFogCoord(GL_TRUE); /* try to enable fog_coord */ - fogMode = SetFogMode(2); /* GL_EXP */ - - camz = -19.0f; + fogMode = SetFogMode(1); -#if ARRAYS glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(3, GL_FLOAT, 0, vertex_pointer); @@ -395,24 +401,24 @@ static void Init( void ) glTexCoordPointer(2, GL_FLOAT, 0, texcoord_pointer); if (have_fog_coord) { - glFogCoordPointer_ext = (GLFOGCOORDPOINTEREXTPROC)glutGetProcAddress("glFogCoordPointerEXT"); + glFogCoordPointer_ext = (PFNGLFOGCOORDPOINTEREXTPROC)glutGetProcAddress("glFogCoordPointerEXT"); glEnableClientState(GL_FOG_COORDINATE_ARRAY_EXT); glFogCoordPointer_ext(GL_FLOAT, 0, fogcoord_pointer); } -#endif + + Reset(); } -int main( int argc, char *argv[] ) +int +main( int argc, char *argv[] ) { glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 640, 480 ); + glutInitWindowSize( 600, 600 ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); glutCreateWindow(argv[0]); glutReshapeFunc( Reshape ); glutKeyboardFunc( Key ); - glutSpecialFunc( SpecialKey ); glutDisplayFunc( Display ); Init(); glutMainLoop(); diff --git a/progs/demos/fslight.c b/progs/demos/fslight.c index 1c016cc75e9..493ce0e90f1 100644 --- a/progs/demos/fslight.c +++ b/progs/demos/fslight.c @@ -20,20 +20,30 @@ #include <GL/gl.h> #include <GL/glut.h> #include <GL/glext.h> +#include "extfuncs.h" + + +#define TEXTURE 0 + +static GLint CoordAttrib = 0; + +static char *FragProgFile = NULL; +static char *VertProgFile = NULL; static GLfloat diffuse[4] = { 0.5f, 0.5f, 1.0f, 1.0f }; static GLfloat specular[4] = { 0.8f, 0.8f, 0.8f, 1.0f }; -static GLfloat lightPos[4] = { 0.0f, 10.0f, 20.0f, 1.0f }; +static GLfloat lightPos[4] = { 0.0f, 10.0f, 20.0f, 0.0f }; static GLfloat delta = 1.0f; static GLuint fragShader; static GLuint vertShader; static GLuint program; -static GLint uLightPos; static GLint uDiffuse; static GLint uSpecular; +static GLint uTexture; +static GLuint SphereList, RectList, CurList; static GLint win = 0; static GLboolean anim = GL_TRUE; static GLboolean wire = GL_FALSE; @@ -42,24 +52,7 @@ static GLboolean pixelLight = GL_TRUE; static GLint t0 = 0; static GLint frames = 0; -static GLfloat xRot = 0.0f, yRot = 0.0f; - -static PFNGLCREATESHADERPROC glCreateShader_func = NULL; -static PFNGLSHADERSOURCEPROC glShaderSource_func = NULL; -static PFNGLGETSHADERSOURCEPROC glGetShaderSource_func = NULL; -static PFNGLCOMPILESHADERPROC glCompileShader_func = NULL; -static PFNGLCREATEPROGRAMPROC glCreateProgram_func = NULL; -static PFNGLDELETEPROGRAMPROC glDeleteProgram_func = NULL; -static PFNGLDELETESHADERPROC glDeleteShader_func = NULL; -static PFNGLATTACHSHADERPROC glAttachShader_func = NULL; -static PFNGLLINKPROGRAMPROC glLinkProgram_func = NULL; -static PFNGLUSEPROGRAMPROC glUseProgram_func = NULL; -static PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation_func = NULL; -static PFNGLISPROGRAMPROC glIsProgram_func = NULL; -static PFNGLISSHADERPROC glIsShader_func = NULL; -static PFNGLUNIFORM3FVPROC glUniform3fv_func = NULL; -static PFNGLUNIFORM3FVPROC glUniform4fv_func = NULL; - +static GLfloat xRot = 90.0f, yRot = 0.0f; static void @@ -69,31 +62,37 @@ normalize(GLfloat *dst, const GLfloat *src) dst[0] = src[0] / len; dst[1] = src[1] / len; dst[2] = src[2] / len; + dst[3] = src[3]; } static void Redisplay(void) { + GLfloat vec[4]; + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + /* update light position */ + normalize(vec, lightPos); + glLightfv(GL_LIGHT0, GL_POSITION, vec); if (pixelLight) { - GLfloat vec[3]; glUseProgram_func(program); - normalize(vec, lightPos); - glUniform3fv_func(uLightPos, 1, vec); glDisable(GL_LIGHTING); } else { glUseProgram_func(0); - glLightfv(GL_LIGHT0, GL_POSITION, lightPos); glEnable(GL_LIGHTING); } glPushMatrix(); glRotatef(xRot, 1.0f, 0.0f, 0.0f); glRotatef(yRot, 0.0f, 1.0f, 0.0f); + /* glutSolidSphere(2.0, 10, 5); + */ + glCallList(CurList); glPopMatrix(); glutSwapBuffers(); @@ -174,6 +173,12 @@ Key(unsigned char key, int x, int y) else glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); break; + case 'o': + if (CurList == SphereList) + CurList = RectList; + else + CurList = SphereList; + break; case 'p': pixelLight = !pixelLight; if (pixelLight) @@ -217,16 +222,248 @@ SpecialKey(int key, int x, int y) 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)); + assert(glIsShader_func(vertShader)); + + /* attached shaders */ + { + GLuint shaders[20]; + GLsizei count; + int i; + glGetAttachedShaders_func(program, 20, &count, shaders); + for (i = 0; i < count; i++) { + printf("Attached: %u\n", shaders[i]); + assert(shaders[i] == fragShader || + shaders[i] == vertShader); + } + } + + { + GLchar log[1000]; + GLsizei len; + glGetShaderInfoLog_func(vertShader, 1000, &len, log); + printf("Vert Shader Info Log: %s\n", log); + glGetShaderInfoLog_func(fragShader, 1000, &len, log); + printf("Frag Shader Info Log: %s\n", log); + glGetProgramInfoLog_func(program, 1000, &len, log); + printf("Program Info Log: %s\n", log); + } +} + + +#if TEXTURE +static void +MakeTexture(void) +{ +#define SZ0 64 +#define SZ1 32 + GLubyte image0[SZ0][SZ0][SZ0][4]; + GLubyte image1[SZ1][SZ1][SZ1][4]; + GLuint i, j, k; + + /* level 0: two-tone gray checkboard */ + for (i = 0; i < SZ0; i++) { + for (j = 0; j < SZ0; j++) { + for (k = 0; k < SZ0; k++) { + if ((i/8 + j/8 + k/8) & 1) { + image0[i][j][k][0] = + image0[i][j][k][1] = + image0[i][j][k][2] = 200; + } + else { + image0[i][j][k][0] = + image0[i][j][k][1] = + image0[i][j][k][2] = 100; + } + image0[i][j][k][3] = 255; + } + } + } + + /* level 1: two-tone green checkboard */ + for (i = 0; i < SZ1; i++) { + for (j = 0; j < SZ1; j++) { + for (k = 0; k < SZ1; k++) { + if ((i/8 + j/8 + k/8) & 1) { + image1[i][j][k][0] = 0; + image1[i][j][k][1] = 250; + image1[i][j][k][2] = 0; + } + else { + image1[i][j][k][0] = 0; + image1[i][j][k][1] = 200; + image1[i][j][k][2] = 0; + } + image1[i][j][k][3] = 255; + } + } + } + + glActiveTexture(GL_TEXTURE2); /* unit 2 */ + glBindTexture(GL_TEXTURE_2D, 42); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SZ0, SZ0, 0, + GL_RGBA, GL_UNSIGNED_BYTE, image0); + glTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA, SZ1, SZ1, 0, + GL_RGBA, GL_UNSIGNED_BYTE, image1); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + + glActiveTexture(GL_TEXTURE4); /* unit 4 */ + glBindTexture(GL_TEXTURE_3D, 43); + glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, SZ0, SZ0, SZ0, 0, + GL_RGBA, GL_UNSIGNED_BYTE, image0); + glTexImage3D(GL_TEXTURE_3D, 1, GL_RGBA, SZ1, SZ1, SZ1, 0, + GL_RGBA, GL_UNSIGNED_BYTE, image1); + glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAX_LEVEL, 1); + glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); +} +#endif + + +static void +MakeSphere(void) +{ + GLUquadricObj *obj = gluNewQuadric(); + SphereList = glGenLists(1); + gluQuadricTexture(obj, GL_TRUE); + glNewList(SphereList, GL_COMPILE); + gluSphere(obj, 2.0f, 10, 5); + glEndList(); +} + +static void +VertAttrib(GLint index, float x, float y) +{ +#if 1 + glVertexAttrib2f_func(index, x, y); +#else + glTexCoord2f(x, y); +#endif +} + +static void +MakeRect(void) +{ + RectList = glGenLists(1); + glNewList(RectList, GL_COMPILE); + glNormal3f(0, 0, 1); + glBegin(GL_POLYGON); + VertAttrib(CoordAttrib, 0, 0); glVertex2f(-2, -2); + VertAttrib(CoordAttrib, 1, 0); glVertex2f( 2, -2); + VertAttrib(CoordAttrib, 1, 1); glVertex2f( 2, 2); + VertAttrib(CoordAttrib, 0, 1); glVertex2f(-2, 2); + glEnd(); /* XXX omit this and crash! */ + glEndList(); +} + + + +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); + if (!stat) { + GLchar log[1000]; + GLsizei len; + glGetShaderInfoLog_func(shader, 1000, &len, log); + fprintf(stderr, "fslight: problem compiling shader:\n%s\n", log); + exit(1); + } +} + + +/** + * Read a shader from a file. + */ +static void +ReadShader(GLuint shader, const char *filename) +{ + const int max = 100*1000; + int n; + char *buffer = (char*) malloc(max); + FILE *f = fopen(filename, "r"); + if (!f) { + fprintf(stderr, "fslight: Unable to open shader file %s\n", filename); + exit(1); + } + + n = fread(buffer, 1, max, f); + printf("fslight: read %d bytes from shader file %s\n", n, filename); + if (n > 0) { + buffer[n] = 0; + LoadAndCompileShader(shader, buffer); + } + + fclose(f); + free(buffer); +} + + +static void +CheckLink(GLuint prog) +{ + GLint stat; + glGetProgramiv_func(prog, GL_LINK_STATUS, &stat); + if (!stat) { + GLchar log[1000]; + GLsizei len; + glGetProgramInfoLog_func(prog, 1000, &len, log); + fprintf(stderr, "Linker error:\n%s\n", log); + } +} + + +static void Init(void) { static const char *fragShaderText = - "uniform vec3 lightPos;\n" "uniform vec4 diffuse;\n" "uniform vec4 specular;\n" "varying vec3 normal;\n" "void main() {\n" " // Compute dot product of light direction and normal vector\n" - " float dotProd = max(dot(lightPos, normalize(normal)), 0.0);\n" + " float dotProd = max(dot(gl_LightSource[0].position.xyz, \n" + " normalize(normal)), 0.0);\n" " // Compute diffuse and specular contributions\n" " gl_FragColor = diffuse * dotProd + specular * pow(dotProd, 20.0);\n" "}\n"; @@ -236,53 +473,63 @@ Init(void) " gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" " normal = gl_NormalMatrix * gl_Normal;\n" "}\n"; - - const char *version; version = (const char *) glGetString(GL_VERSION); if (version[0] != '2' || version[1] != '.') { - printf("Warning: this program expects OpenGL 2.0\n"); - /*exit(1);*/ + printf("This program requires OpenGL 2.x, found %s\n", version); + exit(1); } - - glCreateShader_func = (PFNGLCREATESHADERPROC) glutGetProcAddress("glCreateShader"); - glDeleteShader_func = (PFNGLDELETESHADERPROC) glutGetProcAddress("glDeleteShader"); - glDeleteProgram_func = (PFNGLDELETEPROGRAMPROC) glutGetProcAddress("glDeleteProgram"); - glShaderSource_func = (PFNGLSHADERSOURCEPROC) glutGetProcAddress("glShaderSource"); - glGetShaderSource_func = (PFNGLGETSHADERSOURCEPROC) glutGetProcAddress("glGetShaderSource"); - glCompileShader_func = (PFNGLCOMPILESHADERPROC) glutGetProcAddress("glCompileShader"); - glCreateProgram_func = (PFNGLCREATEPROGRAMPROC) glutGetProcAddress("glCreateProgram"); - glAttachShader_func = (PFNGLATTACHSHADERPROC) glutGetProcAddress("glAttachShader"); - glLinkProgram_func = (PFNGLLINKPROGRAMPROC) glutGetProcAddress("glLinkProgram"); - glUseProgram_func = (PFNGLUSEPROGRAMPROC) glutGetProcAddress("glUseProgram"); - glGetUniformLocation_func = (PFNGLGETUNIFORMLOCATIONPROC) glutGetProcAddress("glGetUniformLocation"); - glIsProgram_func = (PFNGLISPROGRAMPROC) glutGetProcAddress("glIsProgram"); - glIsShader_func = (PFNGLISSHADERPROC) glutGetProcAddress("glIsShader"); - glUniform3fv_func = (PFNGLUNIFORM3FVPROC) glutGetProcAddress("glUniform3fv"); - glUniform4fv_func = (PFNGLUNIFORM3FVPROC) glutGetProcAddress("glUniform4fv"); + GetExtensionFuncs(); fragShader = glCreateShader_func(GL_FRAGMENT_SHADER); - glShaderSource_func(fragShader, 1, &fragShaderText, NULL); - glCompileShader_func(fragShader); + if (FragProgFile) + ReadShader(fragShader, FragProgFile); + else + LoadAndCompileShader(fragShader, fragShaderText); + vertShader = glCreateShader_func(GL_VERTEX_SHADER); - glShaderSource_func(vertShader, 1, &vertShaderText, NULL); - glCompileShader_func(vertShader); + if (VertProgFile) + ReadShader(vertShader, VertProgFile); + else + LoadAndCompileShader(vertShader, vertShaderText); program = glCreateProgram_func(); glAttachShader_func(program, fragShader); glAttachShader_func(program, vertShader); glLinkProgram_func(program); + CheckLink(program); glUseProgram_func(program); - uLightPos = glGetUniformLocation_func(program, "lightPos"); uDiffuse = glGetUniformLocation_func(program, "diffuse"); uSpecular = glGetUniformLocation_func(program, "specular"); + uTexture = glGetUniformLocation_func(program, "texture"); + printf("DiffusePos %d SpecularPos %d TexturePos %d\n", + uDiffuse, uSpecular, uTexture); glUniform4fv_func(uDiffuse, 1, diffuse); glUniform4fv_func(uSpecular, 1, specular); + /* assert(glGetError() == 0);*/ + glUniform1i_func(uTexture, 2); /* use texture unit 2 */ + /*assert(glGetError() == 0);*/ + + if (CoordAttrib) { + int i; + glBindAttribLocation_func(program, CoordAttrib, "coord"); + i = glGetAttribLocation_func(program, "coord"); + assert(i >= 0); + if (i != CoordAttrib) { + printf("Hmmm, NVIDIA bug?\n"); + CoordAttrib = i; + } + else { + printf("Mesa bind attrib: coord = %d\n", i); + } + } + + /*assert(glGetError() == 0);*/ glClearColor(0.3f, 0.3f, 0.3f, 0.0f); glEnable(GL_DEPTH_TEST); @@ -292,11 +539,20 @@ Init(void) glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular); glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 20.0f); + MakeSphere(); + MakeRect(); + + CurList = SphereList; + +#if TEXTURE + MakeTexture(); +#endif + printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); printf("Press p to toggle between per-pixel and per-vertex lighting\n"); /* test glGetShaderSource() */ - { + if (0) { GLsizei len = strlen(fragShaderText) + 1; GLsizei lenOut; GLchar *src =(GLchar *) malloc(len * sizeof(GLchar)); @@ -310,6 +566,37 @@ Init(void) assert(glIsProgram_func(program)); assert(glIsShader_func(fragShader)); assert(glIsShader_func(vertShader)); + + glColor3f(1, 0, 0); + + /* for testing state vars */ + { + static GLfloat fc[4] = { 1, 1, 0, 0 }; + static GLfloat amb[4] = { 1, 0, 1, 0 }; + glFogfv(GL_FOG_COLOR, fc); + glLightfv(GL_LIGHT1, GL_AMBIENT, amb); + } + +#if 0 + TestFunctions(); +#else + (void) TestFunctions; +#endif +} + + +static void +ParseOptions(int argc, char *argv[]) +{ + int i; + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-fs") == 0) { + FragProgFile = argv[i+1]; + } + else if (strcmp(argv[i], "-vs") == 0) { + VertProgFile = argv[i+1]; + } + } } @@ -327,8 +614,10 @@ main(int argc, char *argv[]) glutDisplayFunc(Redisplay); if (anim) glutIdleFunc(Idle); + ParseOptions(argc, argv); Init(); glutMainLoop(); return 0; } + diff --git a/progs/demos/texdown.c b/progs/demos/texdown.c index fc98fddb310..5fecd9a1489 100644 --- a/progs/demos/texdown.c +++ b/progs/demos/texdown.c @@ -149,7 +149,7 @@ TypeStr(GLenum type) */ #define ALIGN (1<<12) -static unsigned align(unsigned value, unsigned a) +static unsigned long align(unsigned long value, unsigned long a) { return (value + a - 1) & ~(a-1); } @@ -186,10 +186,10 @@ MeasureDownloadRate(void) printf("alloc %p %p\n", orig_texImage, orig_getImage); - texImage = (GLubyte *)align((unsigned)orig_texImage, ALIGN); - getImage = (GLubyte *)align((unsigned)orig_getImage, ALIGN); + texImage = (GLubyte *)align((unsigned long)orig_texImage, ALIGN); + getImage = (GLubyte *)align((unsigned long)orig_getImage, ALIGN); - for (i = 1; !(((unsigned)texImage) & i); i<<=1) + for (i = 1; !(((unsigned long)texImage) & i); i<<=1) ; printf("texture image alignment: %d bytes (%p)\n", i, texImage); diff --git a/progs/demos/winpos.c b/progs/demos/winpos.c index 2ee1df69fbc..3a1a19ecdb9 100644 --- a/progs/demos/winpos.c +++ b/progs/demos/winpos.c @@ -77,7 +77,7 @@ static void init( void ) WindowPosFunc = &glWindowPos2fARB; } else -#elif defined(GL_ARB_window_pos) +#elif defined(GL_MESA_window_pos) if (glutExtensionSupported("GL_MESA_window_pos")) { printf("Using GL_MESA_window_pos\n"); WindowPosFunc = &glWindowPos2fMESA; |