$ setenv __GL_SYNC_TO_VBLANK 1or
$ export __GL_SYNC_TO_VBLANK=1
for tcsh or bash respectively. (Two underscores at the start of the name.)
and the C code:import java.util.*; // Initialise static long Start; Date now = new Date(); Start = now.getTime(); ... // Current time Date now = new Date(); float seconds; seconds = (float)(now.getTime() - Start) / 1000.0f;
#include <sys/time.h> ... /* Initialise */ static long Start; struct timeval now; gettimeofday(&now, NULL); Start = now.tv_sec; ... /* Current time */ struct timeval now; float seconds; gettimeofday(&now, NULL); seconds = (float)(now.tv_sec - Start) + (float)now.tv_usec / 1000000.0;
float something = 1.5;To shut it up, put an f on the end of the number, eg 1.5f
void keyboard (int key, int x, int y)For special keys such as escape or arrow you should use CONSTANT names rather than writing the numbers directly. They can change on different windowing systems.
{
if (key == 'r') ...