is present , the particle size is attenuated based on eye distance. */
-/*
- * $Log: pointblast.c,v $
- * Revision 1.3 2002/01/16 00:48:43 kschultz
- * Demo updates for Windows (Robert Bergkvist)
- *
- * Revision 1.2 2000/06/27 17:04:43 brianp
- * fixed compiler warnings
- *
- * Revision 1.1.1.1 1999/08/19 00:55:40 jtg
- * Imported sources
- *
- * Revision 3.3 1998/07/26 01:24:27 brianp
- * removed include of gl.h
- *
- * Revision 3.2 1998/02/14 18:51:46 brianp
- * fixed a small compiler warning
- *
- * Revision 3.1 1998/02/14 18:45:25 brianp
- * optimized to use flat shading, don't blend ground polygon
- *
- * Revision 3.0 1998/02/14 18:42:29 brianp
- * initial rev
- *
- */
-
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#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... */
#define MEAN_VELOCITY 3.0
#define GRAVITY 2.0
-#define TIME_DELTA 0.025 /* The speed of time. */
/* Modeling units of ground extent in each X and Z direction. */
#define EDGE 12
float distance;
int i;
+ static double t0 = -1.;
+ double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
+ if (t0 < 0.0)
+ t0 = t;
+ dt = t - t0;
+ t0 = t;
+
motion = 0;
for (i=0; i<numPoints; i++) {
distance = pointVelocity[i][0] * theTime;
pointTime[i] = 0.0; /* Reset the particles sense of up time. */
}
motion = 1;
- pointTime[i] += TIME_DELTA;
+ pointTime[i] += dt;
}
- theTime += TIME_DELTA;
+ theTime += dt;
if (!motion && !spin) {
if (repeat) {
makePointList();
case 0:
makePointList();
break;
-#if GL_EXT_point_parameters
+#ifdef 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
+#ifdef 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:
int i;
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_MULTISAMPLE);
+ glutInitWindowPosition(0, 0);
+ glutInitWindowSize(300, 300);
for (i=1; i<argc; i++) {
if(!strcmp("-noms", argv[i])) {
glutAddMenuEntry("Quit", 666);
glutAttachMenu(GLUT_RIGHT_BUTTON);
+ if (!glutExtensionSupported("GL_ARB_point_parameters")) {
+ fprintf(stderr, "Sorry, GL_ARB_point_parameters is not supported.\n");
+ return -1;
+ }
+
glShadeModel(GL_FLAT);
glEnable(GL_DEPTH_TEST);
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,