Advertisement

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

Started by January 07, 2005 06:00 AM
3 comments, last by benryves 20 years, 1 month ago
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?

[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]

Which version of SDL are you using?
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).

[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]

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.
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.

[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]

This topic is closed to new replies.

Advertisement