I am working on converting a simple VC++ game with colored blocks on the screen (not tetris). The Windows program was coded using MFC. My goal is to port the program over the Xcode and OS X. Most of the program code is pretty simple to convert; however, I’m stumped on something that I thought would be very simple.
In several functions in the original program the return type is a color reference (COLORREF). There is also a variable declared as type COLORREF. Essentially, the COLORREF object is a unsigned integer value representing the color.
Is there something in OpenGL that corresponds to COLORREF?
What to say … maybe try to learn the basics of C programming ? And then actually read the documentation I linked ?
glColor3f is a function not a type, as you compiler said. GLFloat is the type.
Try this instead :
GLfloat myColor[4];
// do not forget to fill color component with values between 0.0 and 1.0, example :
myColor[0]= 0.5; // red value
myColor[1]= 0.1; // green value
myColor[1]= 0.9; // blue value
myColor[3]= 1.0; // alpha value (1 is opaque, 0 transparent, not sure if you need it)
// say to opengl "from now, draw with myColor !"
glColor4fv(myColor);