Jump to content
  • Advertisement
Sign in to follow this  
benryves

SDL and VC++.NET 2003: FillRect() with NULL acts very oddly

This topic is 4974 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

I'm asking mainly to find out why this does this... I thought that if you used FillRect on a surface with the destination rectangle set to NULL it would fill the entire surface to a colour. Well, if I compile in "Debug" mode it does, providing that I'm not in full screen. If I compile in "Release" mode, however, it appears to never work, and I have to manually fill in all the coordinates. Any pointers into why it does this?

Share this post


Link to post
Share on other sites
Advertisement
1.2.7 at the time, now using 1.2.8 but my cautious behaviour has stopped me from using NULL [wink].
It's not as odd as the glitch in my raycaster that meant that doors would open but not shut again when compiled as Release but worked fine in Debug (turned out it was a problem that when opening they would reach "0.0" in Debug mode when fully opened and "-0.0" in Release mode).

Share this post


Link to post
Share on other sites
Quote:
Original post by benryves
1.2.7 at the time, now using 1.2.8 but my cautious behaviour has stopped me from using NULL [wink].
It's not as odd as the glitch in my raycaster that meant that doors would open but not shut again when compiled as Release but worked fine in Debug (turned out it was a problem that when opening they would reach "0.0" in Debug mode when fully opened and "-0.0" in Release mode).

The difference between the "0.0" and "-0.0" sounds like a difference in floating-point accuracy to me. I had the same trouble and could not figure out for two days what I was doing wrong. Using VC++ 2K3, under the project settings, you should be able to go to C++ -> Optimization -> Floating-Point Consistency. I believe that debug mode defaults to /Op (improved consistency), while release does not. I would try setting the /Op switch in release mode to get improved floating point consistency to see if that solves your problem with the 0.0 in debug and -0.0 in release.

Share this post


Link to post
Share on other sites
I fixed that anyway - it made more sense that if the door state < 0.5 then I should start closing it and if the door state > 0.5 then I should start opening it. I had a number of floating-point issues, such as sticking to walls, when changing mode.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!