openGL problem with floats

Started by
1 comment, last by hannibar 19 years, 6 months ago
I have a problem with openGL and the use of floats. Take a look at this piece of code for example
glColor3f(0.900, 0.550, 0.300);
MSVC6 gives these warnings : C:\Documents and Settings\Hans Packet\Mijn documenten\Mijn Spullen\Programmeren\Gui_Test\LijnTest\draw.cpp(11) : warning C4305: 'argument' : truncation from 'const double' to 'float' C:\Documents and Settings\Hans Packet\Mijn documenten\Mijn Spullen\Programmeren\Gui_Test\LijnTest\draw.cpp(11) : warning C4305: 'argument' : truncation from 'const double' to 'float' The numbers I use are floats. I don't know what causes the warnings. Although I know these are just warnings, and that I can just ignore them, I like a clean build without warnings. Thanks in advance
Advertisement
That's because you're passing double arguments to a function that expects floats. It should be one of these:

glColor3d(0.900, 0.550, 0.300); // pass doubles to double function
glColor3f(0.900f, 0.550f, 0.300f); // pass floats to float function

-RC
thanks for the helpful answer.

This topic is closed to new replies.

Advertisement