Make the face culling a little more sensible.

GL Quake was weird, culling front faces. Partly understandable, since
Quake's front order is clockwise and GL's default order is
counter-clockwise. However, since the order can be specified, that should
be done instead. Thus, specify the winding order as clockwise (for quake's
data), set culling for back-face removal, and then mess with the winding
direction in the mirror and fish-eye code.
This commit is contained in:
Bill Currie 2012-01-03 18:06:26 +09:00
parent 62e564c5cd
commit 1437cbec91
4 changed files with 9 additions and 7 deletions

View file

@ -154,7 +154,7 @@ QFGL_NEED (void, glFogf, (GLenum pname, GLfloat param))
QFGL_NEED (void, glFogfv, (GLenum pname, const GLfloat * params))
QFGL_NEED (void, glFogi, (GLenum pname, GLint param))
QFGL_DONT_NEED (void, glFogiv, (GLenum pname, const GLint * params))
QFGL_DONT_NEED (void, glFrontFace, (GLenum mode))
QFGL_NEED (void, glFrontFace, (GLenum mode))
QFGL_NEED (void, glFrustum, (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val))
QFGL_NEED (GLuint, glGenLists, (GLsizei range))
QFGL_NEED (void, glGenTextures, (GLsizei n, GLuint * textures))

View file

@ -469,9 +469,9 @@ R_SetupGL (void)
qfglScalef (1, -1, 1);
else
qfglScalef (-1, 1, 1);
qfglCullFace (GL_BACK);
qfglFrontFace (GL_CCW);
} else
qfglCullFace (GL_FRONT);
qfglFrontFace (GL_CW);
qfglMatrixMode (GL_MODELVIEW);
qfglLoadIdentity ();
@ -576,7 +576,7 @@ R_Mirror (void)
qfglScalef (1, -1, 1);
else
qfglScalef (-1, 1, 1);
qfglCullFace (GL_FRONT);
qfglFrontFace (GL_CW);
qfglMatrixMode (GL_MODELVIEW);
qfglLoadMatrixf (r_base_world_matrix);
@ -883,7 +883,7 @@ R_InitFishEye (void)
-gl_cube_map_size / 2);
qfglDisable (GL_DEPTH_TEST);
qfglCullFace (GL_BACK);
qfglFrontFace (GL_CCW);
qfglClear (GL_COLOR_BUFFER_BIT);
qfglEnable (GL_TEXTURE_CUBE_MAP_ARB);

View file

@ -615,7 +615,8 @@ GL_Init_Common (void)
qfglClearColor (0, 0, 0, 0);
qfglEnable (GL_TEXTURE_2D);
qfglCullFace (GL_FRONT);
qfglFrontFace (GL_CW);
qfglCullFace (GL_BACK);
qfglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
qfglShadeModel (GL_FLAT);

View file

@ -140,7 +140,8 @@ GL_Init_Common (void)
qfglClearColor (0, 0, 0, 0);
qfglEnable (GL_TEXTURE_2D);
qfglCullFace (GL_FRONT);
qfglFrontFace (GL_CW);
qfglCullFace (GL_BACK);
qfglEnable (GL_BLEND);
qfglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);