#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... */
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:
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:
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,
-/* $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.
#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 */
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 );
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;
}
-
/* new window size or exposure */
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);
}
-
int main( int argc, char *argv[] )
{
glutInitWindowPosition(0, 0);