I only modified the terrain tutorial of the Dark GDK (see below). Is it important what the size of the pictures is?
// Dark GDK - The Game Creators - www.thegamecreators.com
// include the Dark GDK header
#include "DarkGDK.h"
//Objekt-IDs
const char ID_Sphere = 5;
void DarkGDK ( void )
{
// entry point for the application
// switch on sync rate and set to a maximum of 60 fps
dbSyncOn ( );
dbSyncRate ( 60 );
//unser Testbereich
koord_init();
// make a sphere
dbMakeObjectSphere ( ID_Sphere, 100 );
// position the object in a random location
dbPositionObject ( ID_Sphere, 500, 500, 500 );
// adjust scaling
dbScaleObject ( ID_Sphere, 100 , 100, 100 );
// give the object a color
dbColorObject ( ID_Sphere, dbRgb ( 255 , 0 , 0 ) );//red
// increase specular power
dbSetObjectSpecularPower ( ID_Sphere, 255 );
// turn off ambient lighting for this object
dbSetObjectAmbient ( ID_Sphere, 0 );
//Ende Testbereich
// we are going to use a skybox in this demo and it will
// be scaled up to quite a large size, this will initially
// result in it being outside of the cameras default range
// therefore it will not be drawn, to adjust this we simply
// increase the cameras range
//dbSetCameraRange ( 1.0f, 30000.0f );
// two textures are going to be used for the terrain, the first
// will be the diffuse part and the second will be used to
// create extra detail on the terrain
dbLoadImage ( "texture.png", 1 );
dbLoadImage ( "detail.jpg", 2 );
// the first step in creating a terrain is to call the
// function dbSetupTerrain, this will perform some internal
// work that allows us to get started
dbSetupTerrain ( );
// now we can get started on making the terrain object
dbMakeObjectTerrain ( 1 );
// here we pass in a heightmap that will be used to create the terrain
dbSetTerrainHeightMap ( 1, "map.png" );
// now we set the scale, this will have the effect of making
// the terrain large on the X and Z axis but quite small on the Y
dbSetTerrainScale ( 1, 3.0f, 3.0f, 2.0f );
// adjust the lighting for the terrain, this function takes the ID
// number, then a direction for the light, then 3 colours for the light
// and finally the scale, by using this function we can adjust the
// overall colour of the terrain
dbSetTerrainLight ( 1, 1.0f, -0.25f, 0.0f, 1.0f, 1.0f, 0.78f, 0.5f );
// in this call we're telling the terrain that its diffuse texture
// will come from image 1 and its detail texture will come from
// image 2
dbSetTerrainTexture ( 1, 1, 2 );
// once we have set all properties of the terrain we can build it,
// at this point it gets created and added into your world
dbBuildTerrain ( 1 );
dbPositionObject(1,0,0,0);
// position the camera
dbPositionCamera ( 385, 23, 100 );
// camera variables
float fCameraAngleX = 0.0f;
float fCameraAngleY = 0.0f;
float fCameraHeight = 0.0f;
// now onto our main loop
while ( LoopGDK ( ) )
{
// let the user move the camera around with the arrow keys
dbControlCameraUsingArrowKeys ( 0, 2.0f, 2.0f );
if(dbSpaceKey()) //wenn wir die Spacebar drücken, dann erhöhen wir die Höhe
{
fCameraHeight++;
//Y ist die Höhe :-(
dbPositionCamera ( dbCameraPositionX ( ), fCameraHeight, dbCameraPositionZ ( ) );
}
fCameraHeight=dbCameraPositionY();//damit diese Var aktuell bleibt, auch wenn wir nicht Space drücken
//Neben der Maussteuerung der Rotation fragen wir hierzu auch die beiden Rechts/Links Cursortasten ab
if(dbRightKey () )
{
fCameraAngleY++;
}
if(dbLeftKey () )
{
fCameraAngleY--;
}
//Beide nachfolgende Punkte sind für die Maussteuerung da
//1. create a rotation axis based on mouse movement
fCameraAngleX = dbWrapValue ( fCameraAngleX + dbMouseMoveY ( ) * 0.4f );
fCameraAngleY = dbWrapValue ( fCameraAngleY + dbMouseMoveX ( ) * 0.4f );
//2. rotate camera
dbXRotateCamera ( fCameraAngleX );
dbYRotateCamera ( fCameraAngleY );
// find the ground height of the terrain
//float fHeight = dbGetTerrainGroundHeight ( 1, dbCameraPositionX ( ), dbCameraPositionZ ( ) );
// reposition the camera so it is directly above the ground
//dbPositionCamera ( dbCameraPositionX ( ), fHeight + 10.0f, dbCameraPositionZ ( ) );
// update the terrain
dbUpdateTerrain ( );
// update the screen
dbSync ( );
}
}