Here is your code:
// Dark GDK - The Game Creators - www.thegamecreators.com
// the wizard has created a very simple project that uses Dark GDK
// it contains the basic code for a GDK application
// whenever using Dark GDK you must ensure you include the header file
#include "DarkGDK.h"
void DarkGDK ( void )
{
// turn on sync rate and set maximum rate to 60 fps
dbSyncOn ( );
dbSyncRate ( 60 );
dbSetCameraRange(1, 1.0f, 50000.0f);
dbPositionCamera(200, 200, 50);
dbLoadImage ( "Detail.jpg", 1 );
dbLoadImage ( "FaerunTX.bmp", 2 );
dbLoadImage ( "Water03.bmp", 3);
dbSetupTerrain ( );
dbMakeObjectTerrain ( 1 );
dbSetTerrainHeightMap(1, "FaerunBM.bmp");
dbSetTerrainScale ( 1, 22.0f, 2.6f, 22.0f );
dbSetTerrainLight ( 1, 1.0f, -0.25f, 0.0f, 1.0f, 1.0f, 0.78f, 0.5f );
dbSetTerrainTexture ( 1, 2, 1 );
dbBuildTerrain ( 1 );
dbMakeMatrix(5, 20.f, 0.0f, 4, 0);
dbPositionMatrix(5, 200, 200, 55);
dbPrepareMatrixTexture(6, 3, 0, 0);
dbSetMatrixTile(5, 5, 5, 3);
dbGhostMatrixOn(5);
float fCameraAngleX = 0.0f;
float fCameraAngleY = 0.0f;
// our main loop
while ( LoopGDK ( ) )
{
dbControlCameraUsingArrowKeys ( 0, 5.0f, 0.3f );
// create a rotation axis based on mouse movement
fCameraAngleX = dbWrapValue ( fCameraAngleX + dbMouseMoveY ( ) * 0.4f );
fCameraAngleY = dbWrapValue ( fCameraAngleY + dbMouseMoveX ( ) * 0.4f );
// rotate camera
dbXRotateCamera ( fCameraAngleX );
dbYRotateCamera ( fCameraAngleY );
dbUpdateTerrain ( );
dbUpdateMatrix(5);
// update the screen
dbSync ( );
}
// return back to windows
return;
}
Here is some code that I use to handle generic forms of matrix for all sorts of things like water / terrain/ clouds .... etc
This fragment is configured to make an ocean mesh that is 1000000 x 1000000 units in area.
From it, you should be able to correct your understandings of the
dbMakeMatrix()
dbPrepareMatrixTexture()
dbSetMatrixTile()
dbGhostMatrixOn()
functions.
// make the ocean matrix of 16x16 squares
dbMakeMatrix ( 4, 1000000, 1000000, 16, 16 );
// raise each node to its correct height
for (int x = 0; x < 33; x++ )
{
for (int y = 0; y < 33; y++ )
{
dbSetMatrixHeight ( 4, x, y, 0.0);// set to 0 height
}
}
// skin each mesh square
dbPositionMatrix ( 4, -500000, 0, -500000 );
dbLoadImage ( "Terrain\OceanWater.bmp" , 8 );
dbPrepareMatrixTexture ( 4, 8, 1, 1 );
for (int x = 0; x < 16; x++ )
{
for (int y = 0; y < 16; y++ )
{
dbSetMatrixTile ( 4, x, y, 1 );
}
}
dbGhostMatrixOn ( 4, 1);
dbUpdateMatrix ( 4 );
If you are still not sure about the problem, then please post again and we will go through each of your steps one instruction at a time, as it can be frustrating when one first starts programing this sort of thing.