newbie question

I JUST got started learning OpenGL whith the red book and I’m having problems with animation.

I can’t get glut double buffer to work. When I try to write a program double buffered, everything that I display is red, there are no other colors. Also it’s not really double buffering.

Can anyone think of what I’m doing wrong just off of the top of their head from those symptoms?

I appreciate your help.

search through the entire project to see if any code anywhere could turn it red, mainly just the glColorf, glClearColor and material color.

If I just change the buffer to single, the color is fine.

Nevermind, I figured out my problem.
For those curious, I was writing
glutInitDisplayMode(GLUT_DOUBLE | | GLUT_RGB);
instead of
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
because I am used to coding in C++.
(I know, I’m a tard)

Could anyone tell me what type of translations I would need to make in order to get an OpenGL code to compile in a C++ project? This would make life a lot easier for me.

Since C is a subset of C++, and since OpenGL is an API in C, you don’t need to do anything special to get OpenGL to work in C++. Just start compiling with g++ instead of gcc (or whatever your preferred C++ compiler is).

Hope this helps.

If I add the same source code to a C++ project, I get around twenty link errors that list functions in the gl and glut libraries and say that they’re undefined symbols.

Oh, and I’m compiling with CodeWarrior.

For those curious, I was writing
glutInitDisplayMode(GLUT_DOUBLE | | GLUT_RGB);
instead of
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
because I am used to coding in C++.

Using | | vs. | is not different between C++ and C. | | is a boolean operation, meaning you will get a simple true/false value. (0/1) Using | is a bitwise operator which means that all the bits will be or’d together to give you the value.

For instance…

0x1 | 0x2 == 0x3
0x1 | | 0x2 == 0x1

As to the linker errors, you probably need ti include the libraries in your project.