Posted: 30th Aug 2010 11:43
Oke, I'm trying to create a small game (who isn't) and therefore want a nice terrain. So I followed the terrain tutorial and tried to debug my program but it gave the very usefull error "6". I then tried adding dbSetTerrainTiling and Split but it didn't help. I copied the terrain code straight from the sample program but nothing there either. I also tried moving the files (terrain tutorial files) out of the "terrain" folder in my project but (surprisingly) that wasn't it either.
so, can someone explain what error "6" means? Down here is the code:
#include <cmath>
#include "DarkGDK.h"
#include "SC_Collision.h"
void setup_terrain(){
dbLoadImage("texture.jpg", 1);
dbLoadImage("detail.jpg", 2);
dbSetupTerrain();
dbMakeObjectTerrain(1);
dbSetTerrainHeightMap(1, "map.bmp");
dbSetTerrainScale(1, 3, 0.6f, 3);
dbSetTerrainLight(1, 1.0f, 0.5f, 0.5f, 1.0f, 1.0f, 0.78f, 0.5f);
dbSetTerrainTexture(1, 1, 2);
dbSetTerrainSplit(1, 16);
dbSetTerrainTiling(1, 4);
dbBuildTerrain(1);
//// load images for the terrain
//dbLoadImage ( "terrain/texture.jpg", 1 ); // diffuse texture
//dbLoadImage ( "terrain/detail.jpg", 2 ); // detail texture
//
//// create the terrain
//dbSetupTerrain ( ); // set up terrain library
//dbMakeObjectTerrain ( 1 ); // make a new terrain
//dbSetTerrainHeightMap ( 1, "terrain/map.bmp" ); // set the terrain height map
//dbSetTerrainScale ( 1, 3, 0.6f, 3 ); // set the scale
//dbSetTerrainSplit ( 1, 16 ); // set the split value
//dbSetTerrainTiling ( 1, 4 ); // set the detail tiling
//dbSetTerrainLight ( 1, 1.0f, -0.25f, 0.0f, 1, 1, 0.78f, 0.5f ); // set the light
//dbSetTerrainTexture ( 1, 1, 2 ); // set the textures
//dbBuildTerrain ( 1 ); // build the terrain
dbLoadObject("terrain/skybox2.x", 2);
dbSetObjectLight(2, 0);
dbScaleObject(2, 3000, 3000, 3000);
}
void DarkGDK(){
SC_Start();
dbSetCameraRange(1.0f, 30000.0f);
setup_terrain();
while(LoopGDK()){
dbUpdateTerrain();
dbSync();
}
}