Better fix that always ensures the rlgl matrix is always valid
This commit is contained in:
parent
3104e805b4
commit
40279e843c
|
|
@ -4003,8 +4003,7 @@ static void SetupViewport(int width, int height)
|
||||||
|
|
||||||
// Set orthographic projection to current framebuffer size
|
// Set orthographic projection to current framebuffer size
|
||||||
// NOTE: Configured top-left corner as (0, 0)
|
// NOTE: Configured top-left corner as (0, 0)
|
||||||
if (width > 0 && height > 0)
|
rlOrtho(0, CORE.Window.render.width, CORE.Window.render.height, 0, 0.0f, 1.0f);
|
||||||
rlOrtho(0, CORE.Window.render.width, CORE.Window.render.height, 0, 0.0f, 1.0f);
|
|
||||||
|
|
||||||
rlMatrixMode(RL_MODELVIEW); // Switch back to modelview matrix
|
rlMatrixMode(RL_MODELVIEW); // Switch back to modelview matrix
|
||||||
rlLoadIdentity(); // Reset current matrix (modelview)
|
rlLoadIdentity(); // Reset current matrix (modelview)
|
||||||
|
|
|
||||||
|
|
@ -1100,6 +1100,12 @@ void rlFrustum(double left, double right, double bottom, double top, double znea
|
||||||
// Multiply the current matrix by an orthographic matrix generated by parameters
|
// Multiply the current matrix by an orthographic matrix generated by parameters
|
||||||
void rlOrtho(double left, double right, double bottom, double top, double znear, double zfar)
|
void rlOrtho(double left, double right, double bottom, double top, double znear, double zfar)
|
||||||
{
|
{
|
||||||
|
if (right - left <= 0 || bottom - top <= 0)
|
||||||
|
{
|
||||||
|
*RLGL.State.currentMatrix = MatrixIdentity();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Matrix matOrtho = MatrixOrtho(left, right, bottom, top, znear, zfar);
|
Matrix matOrtho = MatrixOrtho(left, right, bottom, top, znear, zfar);
|
||||||
|
|
||||||
*RLGL.State.currentMatrix = MatrixMultiply(*RLGL.State.currentMatrix, matOrtho);
|
*RLGL.State.currentMatrix = MatrixMultiply(*RLGL.State.currentMatrix, matOrtho);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user