Hello guys.
I'm new to this forum and a total n00b to programming..
Long story short, i've downloaded and installed C++ 9.0 Express Edition with Dark GDK and Direct X SDK. Been reading the Tutorials and that helped me get started. I've been working on my very first project and encountered a problem that I cannot solve on my own. Tried searching these forums and found only one thread with similar problem, alas it did not help me either..
I'm trying to load a 3D Terrain generated in the T.ED editor, using Highmap and Texture images. The terrain is generated and textured, but when I start to debug the project i get an error messege "ERROR 4" and that's it.. No details on the error. As I've figured it out, it has something to do with dbTerrainUpdate command.
If anyone could assist me in anyway possible, I'd be very gratefull.
Here is my n00bish code samples. It's 2 .cpp files. One is the main programm loop and another one is creating the terrain.
Main:
// Master CPP file
#include "DarkGDK.h"
#include "Master.h"
#include "BackgroundSetup.h"
#include "KingdomText.h"
// Game modes
enum eMode { eGameSetup , eGameReset , eGameTitle , eGameWaitStart , eGameLevel , eGameWait01 , eGameWait02 , eGamePlay , eGameDie , eGameWin , eGameOver };
eMode g_eGameMode = eGameSetup;
// Main Void
void DarkGDK (void)
{
// Main Loop
while ( LoopGDK() )
{
game();
dbUpdateTerrain();
dbSync();
}
}
void game ( void )
{
// Game Modes Switch
switch ( g_eGameMode )
{
case eGameSetup:
gameSetup(); break;
}
}
void gameSetup ( void )
{
// Display Resolution and Sync Rate setup
dbSetDisplayMode ( 1024 , 768 , 32 );
dbSyncOn();
dbSyncRate(60);
dbMaximiseWindow();
KingdomTextSetup();
BackgroundSetup();
}
Terrain creation .cpp file:
#include "DarkGDK.h"
#include "BackgroundSetup.h"
void BackgroundSetup ( void )
{
dbSetCameraRange( 1.0f , 30000.0f );
dbLoadImage ( "Assets\\kdbtext.bmp", 1 );
dbLoadImage ( "Assets\\detail.jpg" , 2 );
dbSetupTerrain();
dbMakeObjectTerrain( 1 );
dbSetTerrainHeightMap( 1 , "Assets\\kdbhm.jpg" );
dbSetTerrainScale ( 1 , 3.0f , 0.6f , 3.0f );
dbSetTerrainLight ( 1, 1.0f, -0.25f, 0.0f, 1.0f, 1.0f, 0.78f, 0.5f );
dbSetTerrainTexture ( 1 , 1, 2);
dbBuildTerrain ( 1 );
dbLoadObject ( "Assets\\skybox2.x", 2 );
dbSetObjectLight ( 2, 0 );
dbScaleObject ( 2, 30000, 30000, 30000 );
dbPositionCamera ( 80 , 50 , -30 );
}
Please keep in mind that this is my very first programm...
Go easy on me.