Having trouble compiling a program

Hi, I’m new to this forum and also opengl. I’m just learning the basics. I’ve tried copying and pasting some of the projects in the open.org website… and whenever i compile in visual c++ it gives me these complaints… why???

A:\Project1.cpp(320) : warning C4305: ‘argument’ : truncation from ‘const double’ to ‘float’
A:\Project1.cpp(320) : warning C4305: ‘argument’ : truncation from ‘const double’ to ‘float’
A:\Project1.cpp(320) : warning C4305: ‘argument’ : truncation from ‘const double’ to ‘float’
A:\Project1.cpp(330) : warning C4305: ‘argument’ : truncation from ‘const double’ to ‘float’
A:\Project1.cpp(330) : warning C4305: ‘argument’ : truncation from ‘const double’ to ‘float’
A:\Project1.cpp(330) : warning C4305: ‘argument’ : truncation from ‘const double’ to ‘float’
A:\Project1.cpp(384) : warning C4305: ‘argument’ : truncation from ‘const double’ to ‘float’
A:\Project1.cpp(385) : warning C4305: ‘argument’ : truncation from ‘const double’ to ‘float’
A:\Project1.cpp(386) : warning C4305: ‘argument’ : truncation from ‘const double’ to ‘float’
A:\Project1.cpp(387) : warning C4305: ‘argument’ : truncation from ‘const double’ to ‘float’
Error executing cl.exe.

Project1.obj - 4 error(s), 11 warning(s)

I figured that since i pretty much cut and paste to see what the project does, it should be able to compile!!!

without the error messages, we cannot help you!

The warning you have is only when there is a a value declared as a double wich is passed in a function that that takes a float. This is not a problem.

The errors are. Please write then down, and we’ll be able to help you.

[This message has been edited by Gorg (edited 03-11-2000).]

The problem is probably that you’re program has hard-coded values for colors, vertices, etc. On many compilers, a literals like: 1.0, 2.5, etc. are of type double, not float. Your program probably makes calls like: glColor3f(1.0, 1.0, 0.0) and glVertex3f(0.0, 1.0, 1.0). The 3f in the name of the functions indicates that the arguments should be 3 floats, not doubles. There are two ways to fix this… one is to change your function calls to be the double versions (for example glVertex3d, glColor3d). The other way is to change your constants to floats explicitly like this:
glVertex3f(1.0f, 2.0f, 3.0f)

Hope this helps.

Thanks a lot! I finally fixed the problem. anyway, I was just testing the code that was in opengl.org