I've been trying to figure out why there is a performance issue with the DGDK, compared to DBP when running an application in full screen exclusive mode.
All these following examples use the same means to fire up an application, yet the first one (DBP) gets a nice steady frame rate of around 70fps. The rest, I can't even top 30fps. Even the DGDK C++ version won't go any faster than 30fps. Yet if I run them all in normal windowed mode, they all run more or less at the same framerate as the DBP one, which is to say on my GPU, pretty fast.
Anybody else had this problem with the DGDK version?
DarkBASIC Professional
Sync On
Sync Rate 1000
AutoCam off
Position Camera 0,0,-20
Make Object Cube 1, 10
fX As Float
fY As Float
fZ As Float
Repeat
Rotate Object 1, fX, fY, fZ
fX = fX + 0.1
fY = fY + 0.2
fZ = fZ + 0.3
Sync
Until EscapeKey()
End
C++ using the DGDK
#include <windows.h>
#include <DarkSDK.h>
void DarkSDK( void )
{
float fX = 0;
float fY = 0;
float fZ = 0;
dbSetWindowOff();
dbSyncOn();
dbSyncRate(0);
dbAutoCamOff();
dbPositionCamera(0,0,-20);
dbMakeObjectCube(1, 10);
while( LoopSDK() )
{
if( dbEscapeKey() )
break;
dbRotateObject( 1, fX, fY, fZ );
fX+=1.0f;
fY+=2.0f;
fZ+=3.0f;
dbSync();
};
}
C# version soon to be usable with the DGDK.NET
using System;
using DGDK;
namespace SpinningCube
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class CApp
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
float fX = 0;
float fY = 0;
float fZ = 0;
if( !CDGDK.InitializeDGDK("CApp", "" ) )
return;
CDGDK.oDBDisplay.SetWindowOff();
CDGDK.oDBCore.SyncOn();
CDGDK.oDBCore.SyncRate(0);
CDGDK.oDBCamera.AutoCamOff();
CDGDK.oDBCamera.PositionCamera(0,0,-20);
CDGDK.oDB3D.MakeObjectCube(1, 10);
while( CDGDK.oDBP.LoopSDK )
{
if( CDGDK.oDBInput.EscapeKey() )
break;
CDGDK.oDB3D.RotateObject( 1, fX, fY, fZ );
fX+=1f;
fY+=2f;
fZ+=3f;
CDGDK.oDBCore.Sync();
}
}
}
}
Lastly, Visual Basic.NET
Module Main
Public Sub Main()
Dim fX As Single
Dim fY As Single
Dim fZ As Single
If Not InitializeDGDK("Main", "") Then
Return
End If
oDBDisplay.SetWindowOff()
oDBCore.SyncOn()
oDBCore.SyncRate(0)
oDBCamera.AutoCamOff()
oDBCamera.PositionCamera(0, 0, -20)
oDB3D.MakeObjectCube(1, 10)
While oDBP.LoopSDK
If oDBInput.EscapeKey() Then
Exit While
End If
oDB3D.RotateObject(1, fX, fY, fZ)
fX += 1.0F
fY += 2.0F
fZ += 3.0F
oDBCore.Sync()
End While
End Sub
End Module
Paul.
[EDIT] Minor ajustments to typos
Home of the Cartography Shop - DarkBASIC Professional map importer