Forráskód Böngészése

Reviewed example with new maths

raysan5 8 éve
szülő
commit
2fc7bc9504
1 módosított fájl, 10 hozzáadás és 7 törlés
  1. 10 7
      examples/others/rlgl_standalone.c

+ 10 - 7
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();