Game Development Community

Temp garbage on startup

by baylor wetzel · in Torque Game Builder · 11/24/2007 (8:54 pm) · 2 replies

I've got a bunch of 1.1.3 apps but i've now written one in TGB 1.5, although the engine has been modified slightly (no changes to existing code but i added a few classes)

From the level editor, when i hit play the game launches but the screen shows either garbage (first run) or the last thing i saw when i last closed it (open console, scores, etc.). After 2-3 seconds, it goes away and my stuff shows (splash screens, menu or level, depending on the flags i set)

i've tried making Canvas.setContent(mainScreenGUI); the first line in main.cs, i've tried turning off the menu and splash screens, i've tried putting in echos with simtime and nothing helps - the garbage seems to show before any of my code is reacher

There are two possible expanations. 1. This is something known about TGB 1.5 and you guys have a solution/workaround for me or 2. i screwed something up when modifying the engine. If it's the latter, it'll take me a while to hunt down, so before i did that i thought i'd ask if anyone had seen this issue before. Fingers crossed

#1
11/25/2007 (9:07 am)
Don't use the run option in TGB 1.1.3. It only complicate your test with strange things happening that don't happens in built versions.

Instead, create a .bat or a shortcut next to the tgb.exe, with in it ".\TGB.exe -game yourgame -notools" replace yourgame by the name of your game mod folder. When you want to test, close the TGB builder, then use this shortcut to test your game, it is a way much cleaner way of testing in 1.1.3.
#2
11/26/2007 (7:58 am)
This happens because as soon as the graphics device is created there needs to be a function to clear the video buffers. Otherwise whatever is in video memory before the game starts is displayed while the engine loads resources.

I made one that calls glClear, swapBuffers 3 times (to clear all possible buffers if triple buffering). I then call the function in a few places, after setting the screen mode, initializing or reactivating the device, etc.