Don't create an ortho matrix when the viewport is 0 in any axis.
Not all compilers divide by 0 and return inf, some segfault. The matrix is not used by anything when minimized, so it just needs to not be called.
This commit is contained in:
parent
75c6fd047b
commit
3104e805b4
|
|
@ -19,8 +19,10 @@
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "TPOrbitCamera.h"
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
// Initialization
|
// Initialization
|
||||||
|
|
@ -28,6 +30,11 @@ int main(void)
|
||||||
const int screenWidth = 800;
|
const int screenWidth = 800;
|
||||||
const int screenHeight = 450;
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
TPOrbitCamera cam;
|
||||||
|
InitTPOrbitCamera(&cam, 45, (Vector3) { 0, 0, 0 });
|
||||||
|
|
||||||
|
SetConfigFlags(FLAG_WINDOW_HIGHDPI)
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
|
|
||||||
|
|
@ -4003,7 +4003,8 @@ 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)
|
||||||
rlOrtho(0, CORE.Window.render.width, CORE.Window.render.height, 0, 0.0f, 1.0f);
|
if (width > 0 && height > 0)
|
||||||
|
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)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user