summaryrefslogtreecommitdiffhomepage
path: root/examples/others
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2017-07-22 13:02:02 +0200
committerraysan5 <[email protected]>2017-07-22 13:02:02 +0200
commit2fc7bc9504f4794218806d1c17ca38a48b36e954 (patch)
treec39179e28a2f67c1005ef4696a9fa4216f98c383 /examples/others
parentcbb134946c73c3857d1f3185c25a5398fad3fa5d (diff)
downloadraylib-2fc7bc9504f4794218806d1c17ca38a48b36e954.tar.gz
raylib-2fc7bc9504f4794218806d1c17ca38a48b36e954.zip
Reviewed example with new maths
Diffstat (limited to 'examples/others')
-rw-r--r--examples/others/rlgl_standalone.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/examples/others/rlgl_standalone.c b/examples/others/rlgl_standalone.c
index 5de77bc2..d8c128be 100644
--- a/examples/others/rlgl_standalone.c
+++ b/examples/others/rlgl_standalone.c
@@ -128,14 +128,15 @@ int main(void)
// Draw
//----------------------------------------------------------------------------------
rlClearScreenBuffers(); // Clear current framebuffer
-
+
+ // Draw '3D' elements in the scene
+ //-----------------------------------------------
// Calculate projection matrix (from perspective) and view matrix from camera look at
Matrix matProj = MatrixPerspective(camera.fovy*DEG2RAD, (double)screenWidth/(double)screenHeight, 0.01, 1000.0);
- MatrixTranspose(&matProj);
Matrix matView = MatrixLookAt(camera.position, camera.target, camera.up);
- SetMatrixModelview(matView); // Replace internal modelview matrix by a custom one
- SetMatrixProjection(matProj); // Replace internal projection matrix by a custom one
+ SetMatrixModelview(matView); // Set internal modelview matrix (default shader)
+ SetMatrixProjection(matProj); // Set internal projection matrix (default shader)
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, RAYWHITE);
@@ -143,16 +144,17 @@ int main(void)
// NOTE: Internal buffers drawing (3D data)
rlglDraw();
+ //-----------------------------------------------
// Draw '2D' elements in the scene (GUI)
+ //-----------------------------------------------
#define RLGL_CREATE_MATRIX_MANUALLY
#if defined(RLGL_CREATE_MATRIX_MANUALLY)
matProj = MatrixOrtho(0.0, screenWidth, screenHeight, 0.0, 0.0, 1.0);
- MatrixTranspose(&matProj);
matView = MatrixIdentity();
- SetMatrixModelview(matView); // Replace internal modelview matrix by a custom one
- SetMatrixProjection(matProj); // Replace internal projection matrix by a custom one
+ SetMatrixModelview(matView); // Set internal modelview matrix (default shader)
+ SetMatrixProjection(matProj); // Set internal projection matrix (default shader)
#else // Let rlgl generate and multiply matrix internally
@@ -166,6 +168,7 @@ int main(void)
// NOTE: Internal buffers drawing (2D data)
rlglDraw();
+ //-----------------------------------------------
glfwSwapBuffers(window);
glfwPollEvents();