V102 dll CPU usage versus V100

Archives Forums/Blitz3D SDK Programming/V102 dll CPU usage versus V100

n.allan(Posted 2008) [#1]
Is anyone using the latest V102 dll?

I'v spent my week's hols writing my language wrapper using V100, thinking all was well, swapped to V102 and my CPU usage shot up to 100%.

On further investigation it turned out to be 100% cpu usage even when nothing is drawn to the screen!

All my wrapper does on these two functions is basically hand them over! to the dll

I just called bbBeginBlitz3D() then bbGraphics(800,600,0,2) then the CPU maxes out!

Granted, some of the other functions are much faster!

Also strangely enough when I call bbEndBlitz3D() the CPU still stays flat out until I close my app.

I swear I am using IDENTICAL code I was using with V100, only the B3D.dll has changed.

I'll go and try it in a pure c++ app and try to eliminate my Languages IDE.


Beaker(Posted 2008) [#2]
Try putting in a Delay 1 ?


n.allan(Posted 2008) [#3]
#include <windows.h>
Sleep(1);

brings CPU down to about 60% on V102
40% on V100

This is do-able in a native c++ app. But has any one, for instance, loaded the dll, from their app, called the functions.

bbBeginBlitz3D();
bbGraphics3D(yada yada);

DoSomeOtherStuffInYourApp(); etc... //non 3d related
DoSomethingElse();

All this while your CPU will be flat out and nothing has even been rendered in 3D.

It may be my imagination. But it seems strange and mildly annoying that I have to go back and rewrite code that was perfectly usable before V102. It's that kind of thing that takes up all the time in C++

Can anyone at BRL tell us what has changed in bbGraphics3D() since V100?


Zethrax(Posted 2008) [#4]
If you're writing an event driven program, rather than a real-time program (such as a game), then use a global variable to flag when the graphics need to be updated, and do a Delay( 20 ) if no graphics update is required. This should keep your idling CPU usage around the 0% mark.


n.allan(Posted 2008) [#5]
I did as you said Bill.

Made a global DWORD SleepTime in my app to store Sleep Time in MS and a global int SleepStatus to hold 1 for sleep or 0 for wakeup.

I can effectively control CPU usage by subtracting sleep time from 100, putting the result into awake time thus giving me a pseudo percentage CPU load control in my app. ie sleep 20 out of 100 ms

But when my app is sleeping it can't accept any input. bum.