Blitz3Dsdk & Dev-C++

Archives Forums/Blitz3D SDK Programming/Blitz3Dsdk & Dev-C++

Moraldi(Posted 2007) [#1]
Can someone please tell me whats wrong with this code?



Edit: Don't check the window creation code. It is generated by the Dev-C++ environment.


Brendane(Posted 2007) [#2]
You haven't created the camera or the cube entities anywhere.

Check out bbCreateCamera(), bbCreateCube()

[edit]... the light also.


Moraldi(Posted 2007) [#3]
I just forgot to create them. But the problem still remains. When the program starts the window updates its display only if you move it and after a few seconds the application halts...


Brendane(Posted 2007) [#4]
Can't test it because I don't have the SDK but could it be this?

if (t.wMilliseconds - wRenderTime < 10)
return;

You're using GetSystemTime and using the Millisecs field - range is 0 to 999 (it's the millisecs part of the current time and not the time expressed in millisecs).

Try using GetTickCount() - initialise wRenderTime with GetTickCount() and use ( GetTickCount() - wRenderTime ) as the test.

Besides which, do you really need a timing test, you're already setting the timer up to post a paint message at the interval you want.


Moraldi(Posted 2007) [#5]
Thanks Brendane, but I just checked your suggestions. The problem (application's halt) still remains...


Brendane(Posted 2007) [#6]
Post your updated code Moraldi, I'll take another look.


Moraldi(Posted 2007) [#7]
I updated in my first post.
Thanks Brendane


Brendane(Posted 2007) [#8]
You didn't initialise wRenderTime. (zero would be wrong, because your first test does this GetTickCount() - wRenderTime < 10

I can't test this for you, but to me it just looks like this only problem is the fact that the draw call is returning since you're never updating wRenderTime.

Either remove the whole test/return (your timer is being invoked every 30ms, so why do you need this?) or initialise wRenderTime to GetTickCount() just before starting the timer.

Good luck


Moraldi(Posted 2007) [#9]
Ok I found it!
You must make a WINAPI call BeginPaint before and an EndPaint call after DrawWorld function