Fix origin bot-left of glViewport

This commit is contained in:
Andress Barajas 2020-10-06 20:07:11 -07:00
parent 700b0c6389
commit ee8df14426

View File

@ -416,19 +416,14 @@ void APIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height) {
gl_viewport_width = width;
gl_viewport_height = height;
GLfloat rw = x + width;
GLfloat lw = x;
GLfloat tw = y + height;
GLfloat bw = y;
GLfloat hw = ((GLfloat) width) / 2.0f;
GLfloat hh = ((GLfloat) height) / 2.0f;
SCREENVIEW_MATRIX[M0] = hw;
SCREENVIEW_MATRIX[M5] = -hh;
SCREENVIEW_MATRIX[M10] = 1;
SCREENVIEW_MATRIX[M12] = (rw + lw) / 2.0f;
SCREENVIEW_MATRIX[M13] = (tw + bw) / 2.0f;
SCREENVIEW_MATRIX[M12] = hw + x;
SCREENVIEW_MATRIX[M13] = vid_mode->height - hh + y;
}
/* Set the depth range */