-static void MYgluPerspective(GLdouble fovx, GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar )
-{
- GLdouble xmax, ymax;
-
- xmax = zNear * tan( fovx * M_PI / 360.0 ) * aspect;
- ymax = zNear * tan( fovy * M_PI / 360.0 );
-
- if (r_viewleaf->contents != CONTENTS_EMPTY && r_viewleaf->contents != CONTENTS_SOLID)
- {
- xmax *= (sin(cl.time * 4.7) * 0.03 + 0.97);
- ymax *= (sin(cl.time * 3.0) * 0.03 + 0.97);
- }
-
- glFrustum(-xmax, xmax, -ymax, ymax, zNear, zFar );
-}
-
-
-/*
-=============
-R_SetupGL
-=============
-*/
-static void R_SetupGL (void)
-{
- if (!r_render.integer)
- return;
-
-// glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // LordHavoc: moved to SCR_UpdateScreen
- gldepthmin = 0;
- gldepthmax = 1;
- glDepthFunc (GL_LEQUAL);
-
- glDepthRange (gldepthmin, gldepthmax);
-
- // update farclip based on previous frame
- r_farclip = r_newfarclip;
-
- // set up viewpoint
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity ();
-
- // y is weird beause OpenGL is bottom to top, we use top to bottom
- glViewport(r_refdef.x, vid.realheight - (r_refdef.y + r_refdef.height), r_refdef.width, r_refdef.height);
-// yfov = 2*atan((float)r_refdef.height/r_refdef.width)*180/M_PI;
- MYgluPerspective (r_refdef.fov_x, r_refdef.fov_y, r_refdef.width/r_refdef.height, 4, r_farclip);
-
- glCullFace(GL_FRONT);
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity ();
-
- glRotatef (-90, 1, 0, 0); // put Z going up
- glRotatef (90, 0, 0, 1); // put Z going up
- glRotatef (-r_refdef.viewangles[2], 1, 0, 0);
- glRotatef (-r_refdef.viewangles[0], 0, 1, 0);
- glRotatef (-r_refdef.viewangles[1], 0, 0, 1);
- glTranslatef (-r_refdef.vieworg[0], -r_refdef.vieworg[1], -r_refdef.vieworg[2]);
-
-// glGetFloatv (GL_MODELVIEW_MATRIX, r_world_matrix);
-
- //
- // set drawing parms
- //
-// if (gl_cull.integer)
- glEnable(GL_CULL_FACE);
-// else
-// glDisable(GL_CULL_FACE);
-
- glEnable(GL_BLEND); // was Disable
- glEnable(GL_DEPTH_TEST);
- glDepthMask(1);
-}
-