summaryrefslogtreecommitdiff
path: root/progs
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2002-12-03 03:13:17 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2002-12-03 03:13:17 +0000
commit66fa33e5767ff4fb1f6e689cebe8963083bf29ad (patch)
tree6c35217427c429b04ac2b2b92b46d19d4af0e7b5 /progs
parent2a7243481a40dee437d4a95ac39b84e550aa98f6 (diff)
updated to use ARB extensions
Diffstat (limited to 'progs')
-rw-r--r--progs/demos/pointblast.c20
-rw-r--r--progs/demos/winpos.c40
2 files changed, 34 insertions, 26 deletions
diff --git a/progs/demos/pointblast.c b/progs/demos/pointblast.c
index 29f977eff1..72e51bccae 100644
--- a/progs/demos/pointblast.c
+++ b/progs/demos/pointblast.c
@@ -18,7 +18,7 @@
#ifdef _WIN32
#include <windows.h>
#endif
-#define GL_GLEXT_LEGACY
+#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
/* Some <math.h> files do not define M_PI... */
@@ -264,15 +264,15 @@ menu(int option)
case 0:
makePointList();
break;
-#if GL_EXT_point_parameters
+#if GL_ARB_point_parameters
case 1:
- glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, constant);
+ glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, constant);
break;
case 2:
- glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, linear);
+ glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, linear);
break;
case 3:
- glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, theQuad);
+ glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, theQuad);
break;
#endif
case 4:
@@ -281,12 +281,12 @@ menu(int option)
case 5:
blend = 0;
break;
-#if GL_EXT_point_parameters
+#if GL_ARB_point_parameters
case 6:
- glPointParameterfEXT(GL_POINT_FADE_THRESHOLD_SIZE_EXT, 1.0);
+ glPointParameterfARB(GL_POINT_FADE_THRESHOLD_SIZE_ARB, 1.0);
break;
case 7:
- glPointParameterfEXT(GL_POINT_FADE_THRESHOLD_SIZE_EXT, 10.0);
+ glPointParameterfARB(GL_POINT_FADE_THRESHOLD_SIZE_ARB, 10.0);
break;
#endif
case 8:
@@ -468,8 +468,8 @@ main(int argc, char **argv)
glEnable(GL_POINT_SMOOTH);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glPointSize(8.0);
-#if GL_EXT_point_parameters
- glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, theQuad);
+#if GL_ARB_point_parameters
+ glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, theQuad);
#endif
glMatrixMode(GL_PROJECTION);
gluPerspective( /* field of view in degree */ 40.0,
diff --git a/progs/demos/winpos.c b/progs/demos/winpos.c
index 2dfa9af600..f6415263d4 100644
--- a/progs/demos/winpos.c
+++ b/progs/demos/winpos.c
@@ -1,4 +1,4 @@
-/* $Id: winpos.c,v 1.5 2002/04/22 16:03:37 brianp Exp $ */
+/* $Id: winpos.c,v 1.6 2002/12/03 03:13:17 brianp Exp $ */
/*
* Example of how to use the GL_MESA_window_pos extension.
@@ -12,7 +12,7 @@
#ifdef _WIN32
#include <windows.h>
#endif
-#define GL_GLEXT_LEGACY
+#define GL_GLEXT_PROTOTYPES
#include "GL/glut.h"
#include "readtex.c" /* a hack, I know */
@@ -30,18 +30,12 @@ static GLubyte *Image;
static int ImgWidth, ImgHeight;
static GLenum ImgFormat;
+static void (*WindowPosFunc)(GLfloat x, GLfloat y);
static void draw( void )
{
GLfloat angle;
- char *extensions;
-
- extensions = (char *) glGetString( GL_EXTENSIONS );
- if (strstr( extensions, "GL_MESA_window_pos")==NULL) {
- printf("Sorry, GL_MESA_window_pos extension not available.\n");
- return;
- }
glClear( GL_COLOR_BUFFER_BIT );
@@ -50,16 +44,14 @@ static void draw( void )
GLfloat y = 50.0 + 200.0 * sin( angle * M_PI / 180.0 );
/* Don't need to worry about the modelview or projection matrices!!! */
-#ifdef GL_MESA_window_pos
- glWindowPos2fMESA( x, y );
-#endif
+ (*WindowPosFunc)( x, y );
+
glDrawPixels( ImgWidth, ImgHeight, ImgFormat, GL_UNSIGNED_BYTE, Image );
}
+ glFinish();
}
-
-
static void key( unsigned char key, int x, int y )
{
(void) x;
@@ -71,7 +63,6 @@ static void key( unsigned char key, int x, int y )
}
-
/* new window size or exposure */
static void reshape( int width, int height )
{
@@ -81,6 +72,24 @@ static void reshape( int width, int height )
static void init( void )
{
+#ifdef GL_ARB_window_pos
+ if (glutExtensionSupported("GL_ARB_window_pos")) {
+ printf("Using GL_ARB_window_pos\n");
+ WindowPosFunc = &glWindowPos2fARB;
+ }
+ else
+#elif defined(GL_ARB_window_pos)
+ if (glutExtensionSupported("GL_MESA_window_pos")) {
+ printf("Using GL_MESA_window_pos\n");
+ WindowPosFunc = &glWindowPos2fMESA;
+ }
+ else
+#endif
+ {
+ printf("Sorry, GL_ARB/MESA_window_pos extension not available.\n");
+ exit(1);
+ }
+
Image = LoadRGBImage( IMAGE_FILE, &ImgWidth, &ImgHeight, &ImgFormat );
if (!Image) {
printf("Couldn't read %s\n", IMAGE_FILE);
@@ -90,7 +99,6 @@ static void init( void )
}
-
int main( int argc, char *argv[] )
{
glutInitWindowPosition(0, 0);