//=============================================================================
//Setup GL
//@returns TRUE on success, FALSE otherwise
//=============================================================================
boolean GLApp::SetupGL()
{
	//smooth shading & depth test
	glShadeModel(GL_SMOOTH);
	glEnable(GL_DEPTH_TEST);
	
	//enable lighting operations
	GLfixed diffuse[] = { FTOX(1.0f), FTOX(1.0f), FTOX(1.0f), FTOX(1.0f) };
	GLfixed lightPos[] = { FTOX(0.0f), FTOX(5.0f), FTOX(-5.0f) };
	glEnable(GL_LIGHT0);
	glEnable(GL_COLOR_MATERIAL);
	glLightxv(GL_LIGHT0, GL_DIFFUSE, diffuse);
	glLightxv(GL_LIGHT0, GL_POSITION, lightPos);
	
	//enable blending operations
	glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);

	//enable fog operations
	GLfixed fogColor[] = { 0, 0, 0, ITOX(1) };
	glFogxv(GL_FOG_COLOR, fogColor);
	glFogx(GL_FOG_MODE, GL_LINEAR);
	glFogx(GL_FOG_START, ITOX(10));
	glFogx(GL_FOG_END, ITOX(70));	

	//perspective Correction
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
	
	//GL Initialization
	glViewport(0, 0, m_DBitmapInfo.cx, m_DBitmapInfo.cy);
	
	//init Projection matrix
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glFrustumx(ITOX(-5), ITOX(5), ITOX(-5), ITOX(5), ITOX(10), ITOX(100));
	
	//init Model-View matrix
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	
	if(glGetError() != GL_NO_ERROR) 
		return FALSE;
	
	return TRUE;
}
void glFogxvLogged(GLenum pname, const GLfixed *params) {
	printf("glFogxv(%s, %p)\n", GLEnumName(pname), params);
	glFogxv(pname, params);
}