GLfloat problems

I may be wrong here, but it looks like visual c++ doesn’t like have GLfloats in a struct.

struct Particle {
GLfloat currentX;
GLfloat currentY;
GLfloat currentZ;
GLfloat vx;
GLfloat vy;
GLfloat vz; // Velocity
GLfloat acceleration;// ms/s
GLfloat lifespan;
bool isDead;

Hold on, figured it out. Now here’s a lesson for me and nyone else. PUT glut.h AT VERY TOP OF YOUR PAGE. hehe i feel stupid.

gl.h was b4 glut.h

More likely, your struct was defined before gl.h or glut.h. You have to remember that things in C/C++ get defined from top to bottom. So you have to define stuff that you use before you use it. You obviously wouldn’t be able to do this…

typedef float GLfloat;

struct blah
GLfloat x,y,z;

So if your struct is in blah.h and the typedef is in gl.h and you try and do this…

#include “blah.h”
#include <GL/gl.h>

You are actually trying to define your struct using GLfloat, which hasn’t been defined yet.

The order of gl.h and glut.h doesn’t really matter. You don’t even really need gl.h because glut.h will include it for you anyway. If you use gl.h, you DO need to include windows.h first because gl.h uses structs defined in there.