Yo,
I've been trying to get into heightmap rendering these past few days, and so I've been following Nehe's Heightmap rendering tutorial. However, my problem is that the file never opens (i.e. file always equals NULL).
The path and filename are definitely correct

Here's the code:
void LoadTerrain(char fname[],int nSize,BYTE* height)
{
FILE* file;
file=fopen(fname,"rb");
if (file==NULL)
{
MessageBox(NULL,"Can't find the heightmap","ERROR",MB_OK);
return;
}
fread(height,1,nSize,file);
int result=ferror(file);
if (result)
{
MessageBox(NULL,"Failed to get data","ERROR",MB_OK);
}
fclose(file);
}
bool InitGL()
{
glShadeModel(GL_SMOOTH);
glClearColor(0.0f,0.0f,0.0f,0.5f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST);
LoadTerrain("Terrain.raw",MAP_SIZE*MAP_SIZE,heightmap);
return true;
}
Any ideas on why the file won't open?
CloudNine
[edited by - CloudNine on August 25, 2003 5:22:09 AM]