floats

Started by
2 comments, last by incubator01 19 years, 11 months ago
in opengl when passign floats I recently had a weird experience: when passing stuff like 0.0 together with some 0.0f I got flicker when passing only 0.0f floats it displayed fine. is there any difference between these 2?
Advertisement
0.0 declares a double, while 0.0f declares a float. Your compler is smart enough to know that if a function takes floats and you pass it 0.0 that the argument needs to be converted.

What do you mean by ''flicker''? Could you show your code?
the code is from lesson05 NeHe tutorials.
Exactly typed over, except that I typed 0.0 somewhere (in both glVertex3f and gluPerspective instead of 0.0f

the result was that the fron face of the trianlge and quad was not (or partially) drawn and that only the quad flickered (I could see the missing face during this flicker sometimes)

numeric post-fixes are more important than many people realize. It''s good practice to always use the "f" postfix for all float data types.

---------------------------Hello, and Welcome to some arbitrary temporal location in the space-time continuum.

This topic is closed to new replies.

Advertisement