Another rant about MSVC++...
by Joe Flood on 09 February 2015
So today I came across a weird bug. On Mac, the game engine will happily draw stuff directly to the screen - i.e. for drawing HUDs, overlays, etc. For this test, I used a small red box, but anything would do really!
On Mac, red box appears. On Windows, not so much.
All up-to-date on Git, check. Same code, check.
Fast-forward 3 hours, and I've solved it. The reason you ask? Visual Studio's compiler gets it wrong.
The problem is simple. I have a piece of code which draws a VBO (basically, stored geometry, shapes) with a Colour. Here are a couple of methods that I can use to render a VBO object:
The one we're using is on line 3 - rendering with a given colour. The calling code is this:
Do you see it now? I didn't either! Looks like while the Xcode compiler (clang) is good enough to realise that my 0xFF0000 should be used to construct a Colour, MSVC decides that I'm talking about a Texture* (see line 4!). So rather than applying the red colour to the quad, it applies an invalid texture, which the engine apparently silently ignores (oops!) and draws a transparent box. Great.
Problem solved, though!