Horrible bug

Archives Forums/Blitz3D SDK Programming/Horrible bug

ziggy(Posted 2007) [#1]
with this code (visual basic) :
            SetBlitz3DHWND(Me.CANVAS3D.Handle.ToInt32())
            BeginBlitz3D()
            Graphics3D(800, 600)
            Cam = CreateCamera()
            'Cls()
            UpdateWorld()
            RenderWorld()
            CreateLight()
            Dim CUBE As Integer = CreateCube()
            MoveEntity(CUBE, 0, 0, -5)
            bbText(0, 0, "Blitz3D preview", 0, 0)
            Flip()

the Blitz3D SDK enters a sort of infinite loop that shows a huge amount of messagebox windows with the text: Graphics mode not set.
This internal loop happens when the host application calls the Graphics3D function (bbGraphics3D in the dll).

I'm using a compiled DLL version of the CSharp example (no source modified). And the CANVAS object is a regular picture box. so that means I can't use this dll from visual basic or C#. The funny thing is that it was working ok and decided not to work any more suddently (no code was changed so it seems to me like an acumulative bug, something can not be freed properly or something... weird...)


Daz(Posted 2007) [#2]
Hi Ziggy,

I am not 100% sure this is a bug. I had the same problem when first testing the SDK using C# and rendering to a panel control.

When using a timer control to trigger my screen update code. I had the timer control set to enabled = true when the application started. This meant it was trying to do a rendering command before the BeginBlitz3d function had completed.

This results in all those "Graphics mode not set" message boxes appearing.

So, try putting some kind of "delay" between the first three lines ofyour code and the rest of your code.

Have a look at the code I posted in your other thread 'Any idea how to integrate with C# or VB.net GUI?' for an example.


ziggy(Posted 2007) [#3]
Yes I've done it, and I've tested even commenting the SetBlitz3DHWND(Me.CANVAS3D.Handle.ToInt32()) sentence, but it fails anyway. Debugging the application, the 'loop' appears in the single sentence Graphics3D(800, 600) so it is not a loop in my application, it seems a internal loop in the engine. I've done deep tests debugging. There is no timer trying to do amything, just this piece of code.


Barnabius(Posted 2007) [#4]
This may sound stupid but how about trying to use:

bbGraphics3D(800,600,0,2)

i.e. not to rely on SDK's defaults, which may be wrong for what you are trying to accomplish.

Barney


skidracer(Posted 2007) [#5]
Eek, only mode 2 graphics is suppose to use a parent HWND, will check the source.