When I run the program in "not fullscreen" mode and then maximize the window it looks like this:
But when I run it in fullscreen mode it looks like this:
And here's the rendering code:
glLoadIdentity();
Camera.Look();
//glDisable(GL_ALPHA_TEST);
glDepthMask(GL_TRUE);
glDisable(GL_BLEND);
// Activate the first texture ID and bind the tree background to it
glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, g_Texture[0]);
// If we want detail texturing on, let's render the second texture
if(g_bDetail)
{
// Activate the second texture ID and bind the fog texture to it
glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
// Here we turn on the COMBINE properties and increase our RGB
// gamma for the detail texture. 2 seems to work just right.
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 2);
// Bind the detail texture
glBindTexture(GL_TEXTURE_2D, g_Texture[1]);
// Now we want to enter the texture matrix. This will allow us
// to change the tiling of the detail texture.
glMatrixMode(GL_TEXTURE);
// Reset the current matrix and apply our chosen scale value
glLoadIdentity();
glScalef((float)g_DetailScale, (float)g_DetailScale, 1);
// Leave the texture matrix and set us back in the model view matrix
glMatrixMode(GL_MODELVIEW);
}
//if(Frustum.BoxInFrustum( 0, 0, 0, 100, 100, 100 ))
Render(map);
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL);
// Turn the second multitexture pass off
glActiveTextureARB(GL_TEXTURE1_ARB);
glDisable(GL_TEXTURE_2D);
// Turn the first multitexture pass off
glActiveTextureARB(GL_TEXTURE0_ARB);
glDisable(GL_TEXTURE_2D);
glEnable(GL_TEXTURE_2D);
...
//.....................the Render function....................
// The Render function is passed a pointer that points to the root
// node of a quadtree, then it check which nodes are visible and renders
// them with the RenderHeightMap function which renders a portion of the map
//.............................................................
void RenderHeightMap(BYTE pHeightMap[], int startX, int startY, int endX, int endY)
{
int X = 0, Y = 0;
float x, y, z;
// float scaleside=20, scalehieght = 8;
bool bSwitchSides = false;
if(render)
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL);
if(!render)
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE);
glEnable(GL_BLEND);
for ( X = startX; X <= endX-STEP_SIZE; X += STEP_SIZE )
{
glBegin( GL_TRIANGLE_STRIP );
for ( Y = startY; Y <= endY-STEP_SIZE; Y += STEP_SIZE )
{
//////////
x = (float)X;
y = (float)(SCALE_HEIGHT*Height(pHeightMap,
(float)X, (float)Y ));
z = (float)Y;
SetTextureCoord( (float)x, (float)z );
glVertex3f(x*SCALE_SIDE, y, z*SCALE_SIDE);
///////////////////////////////
x = (float)(X + STEP_SIZE);
y = (float)(SCALE_HEIGHT*Height(pHeightMap,
(float)(X + STEP_SIZE), (float)Y ));
z = (float)Y;
SetTextureCoord( (float)x, (float)z );
glVertex3f(x*SCALE_SIDE, y, z*SCALE_SIDE);
/////////////
x = (float)X;
y = (float)(SCALE_HEIGHT*Height(pHeightMap, (float)X,
(float)(Y + STEP_SIZE) ));
z = (float)(Y + STEP_SIZE);
SetTextureCoord( (float)x, (float)z );
glVertex3f(x*SCALE_SIDE, y, z*SCALE_SIDE);
////////////////////
x = (float)(X + STEP_SIZE);
y = (float)(SCALE_HEIGHT*Height(pHeightMap,
(float)(X + STEP_SIZE), (float)(Y + STEP_SIZE) ));
z = (float)(Y + STEP_SIZE);
SetTextureCoord( (float)x, (float)z );
glVertex3f(x*SCALE_SIDE, y, z*SCALE_SIDE);
}
glEnd();
}
glDisable(GL_BLEND);
// Stop rendering triangle strips
}

