Matrices
This commit is contained in:
@@ -17,11 +17,15 @@ void cameraUIPush(void) {
|
||||
glLoadIdentity();
|
||||
|
||||
glViewport(0, 0, RENDER_WIDTH, RENDER_HEIGHT);
|
||||
glOrtho(
|
||||
|
||||
mat4 ortho;
|
||||
glm_ortho(
|
||||
0.0f, (float_t)RENDER_WIDTH,
|
||||
(float_t)RENDER_HEIGHT, 0.0f,
|
||||
-1.0f, 1.0f
|
||||
-1.0f, 1.0f,
|
||||
ortho
|
||||
);
|
||||
glLoadMatrixf((const GLfloat*)ortho);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
@@ -37,23 +41,27 @@ void cameraScreenPush(void) {
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
|
||||
mat4 ortho;
|
||||
#if RENDER_USE_FRAMEBUFFER
|
||||
int32_t windowWidth, windowHeight;
|
||||
SDL_GetWindowSize(RENDER_WINDOW, &windowWidth, &windowHeight);
|
||||
|
||||
glViewport(0, 0, windowWidth, windowHeight);
|
||||
glOrtho(
|
||||
0.0f, (float_t)windowWidth,
|
||||
glm_ortho(
|
||||
0.0f, (float_t) windowWidth,
|
||||
(float_t)windowHeight, 0.0f,
|
||||
-1.0f, 1.0f
|
||||
-1.0f, 1.0f,
|
||||
ortho
|
||||
);
|
||||
#else
|
||||
glOrtho(
|
||||
glm_ortho(
|
||||
0.0f, (float_t)RENDER_WIDTH,
|
||||
(float_t)RENDER_HEIGHT, 0.0f,
|
||||
-1.0f, 1.0f
|
||||
-1.0f, 1.0f,
|
||||
ortho
|
||||
);
|
||||
#endif
|
||||
glLoadMatrixf((const GLfloat*)ortho);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
@@ -66,7 +74,10 @@ void cameraScreenPop(void) {
|
||||
void cameraOverworldPush(void) {
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glViewport(0, 0, RENDER_WIDTH, RENDER_HEIGHT);
|
||||
|
||||
#if RENDER_USE_FRAMEBUFFER
|
||||
glViewport(0, 0, RENDER_WIDTH, RENDER_HEIGHT);
|
||||
#endif
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
@@ -107,18 +118,6 @@ void cameraOverworldPush(void) {
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
// glOrtho(
|
||||
// 0.0f, (float_t)RENDER_WIDTH,
|
||||
// (float_t)RENDER_HEIGHT, 0.0f,
|
||||
// -1.0f, 1.0f
|
||||
// );
|
||||
|
||||
// glTranslatef(
|
||||
// -((float_t)OVERWORLD_CAMERA_X) + ((float_t)RENDER_WIDTH / 2.0f),
|
||||
// -((float_t)OVERWORLD_CAMERA_Y) + ((float_t)RENDER_HEIGHT / 2.0f),
|
||||
// 0.0f
|
||||
// );
|
||||
}
|
||||
|
||||
void cameraOverworldPop(void) {
|
||||
|
Reference in New Issue
Block a user