Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

incubator01

floats

This topic is 5179 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!