cvar_t gl_lockarrays_minimumvertices = {0, "gl_lockarrays_minimumvertices", "1", "minimum number of vertices required for use of glLockArraysEXT, setting this too low may reduce performance"};
cvar_t gl_vbo = {0, "gl_vbo", "1", "make use of GL_ARB_vertex_buffer_object extension to store static geometry in video memory for faster rendering"};
-cvar_t v_flipped = {0, "v_flipped", "0", "mirror the screen (poor man's left handed mode"};
+cvar_t v_flipped = {0, "v_flipped", "0", "mirror the screen (poor man's left handed mode)"};
qboolean v_flipped_state = false;
int gl_maxdrawrangeelementsvertices;
R_RegisterModule("GL_Backend", gl_backend_start, gl_backend_shutdown, gl_backend_newmap);
}
+void GL_SetMirrorState(qboolean state);
+
void GL_SetupView_Orientation_Identity (void)
{
backend_viewmatrix = identitymatrix;
- v_flipped_state = false;
+ GL_SetMirrorState(false);
memset(&backend_modelmatrix, 0, sizeof(backend_modelmatrix));
}
Matrix4x4_ConcatRotate(&basematrix, 90, 0, 0, 1);
Matrix4x4_Concat(&backend_viewmatrix, &basematrix, &tempmatrix);
- v_flipped_state = v_flipped.integer;
+ GL_SetMirrorState(v_flipped.integer);
if(v_flipped_state)
{
Matrix4x4_Transpose(&basematrix, &backend_viewmatrix);
gl_state.color4f[0] = gl_state.color4f[1] = gl_state.color4f[2] = gl_state.color4f[3] = 1;
gl_state.lockrange_first = 0;
gl_state.lockrange_count = 0;
- gl_state.cullface = GL_FRONT; // quake is backwards, this culls back faces
+ gl_state.cullface = v_flipped_state ? GL_BACK : GL_FRONT; // quake is backwards, this culls back faces
gl_state.cullfaceenable = true;
CHECKGLERROR
}
}
+void GL_SetMirrorState(qboolean state)
+{
+ if(!state != !v_flipped_state)
+ {
+ // change cull face mode!
+ if(gl_state.cullface == GL_BACK)
+ qglCullFace((gl_state.cullface = GL_FRONT));
+ else if(gl_state.cullface == GL_FRONT)
+ qglCullFace((gl_state.cullface = GL_BACK));
+ }
+ v_flipped_state = state;
+}
+
void GL_CullFace(int state)
{
CHECKGLERROR
cvar_t r_test = {0, "r_test", "0", "internal development use only, leave it alone (usually does nothing anyway)"};
cvar_t r_batchmode = {0, "r_batchmode", "1", "selects method of rendering multiple surfaces with one driver call (values are 0, 1, 2, etc...)"};
+extern qboolean v_flipped_state;
+
typedef struct r_glsl_bloomshader_s
{
int program;
R_Mesh_Matrix(&identitymatrix);
GL_BlendFunc(blendfunc1, blendfunc2);
+
+ if(v_flipped_state)
+ {
+ scalex1 = -scalex1;
+ scalex2 = -scalex2;
+ GL_CullFace(GL_BACK);
+ }
+ else
+ GL_CullFace(GL_FRONT);
+
GL_DepthMask(false);
GL_DepthRange(0, depthshort ? 0.0625 : 1);
GL_DepthTest(!depthdisable);