Example of using "Canvas" form "Graphics" library to display 3D graphics.

Dependencies:   BSP_DISCO_F746NG Graphics mbed

Revision:
1:4a5e329e617b
Parent:
0:8acbce46eede
Child:
2:ef3093a7a43e
--- a/main.cpp	Sun Nov 06 02:14:34 2016 +0000
+++ b/main.cpp	Thu Nov 10 15:38:50 2016 +0000
@@ -2,26 +2,39 @@
 // main.cpp - 3D Graphics Demo
 //
 
+#define STM32
+
 #include "mbed.h"
 #include "RK043FN48H.h"
 #include "Canvas.h"
 #include "Square.h"
+#include "Cube.h"
+#include "Sphere.h"
 
 RK043FN48H display;
 
 int main()
 {
-    Canvas canvas(display.DisplayWidth(), display.DisplayHeight());
-    Square model(&canvas);
+    // Draw text in the background
+    display.SetActiveLayer(Background);
+    display.DrawText(150, 20, "Sphere 3D demo.");
+    display.SetActiveLayer(Foreground);
+       
+    // Initialize canvas
+    Canvas canvas(display.DisplayWidth(), display.DisplayHeight()); 
+    canvas.SetClearColor(0, 0, 0x55, 0);
+    canvas.SetDrawColor(0xFF, 0x55, 0x55, 0xFF);
     
-    canvas.SetDrawColor(0xFF, 0, 0, 0xFF);
-    while(1) {
-        int angle = model.GetAngle();
-
-        canvas.Clear();
+    // Initialize 3D model
+    Sphere model(&canvas);
+    model.Setup();
+    
+    while(true) {
+        model.GetAngle();
+        canvas.Clear();       
         model.Render();
         display.CopyBitmap(Foreground, canvas.GetBitmap(), canvas.DisplayWidth(), canvas.DisplayHeight(), canvas.GetDrawColor());
-
-        wait(0.04f);
-    }
+           
+        wait(0.06f);
+    }   
 }
\ No newline at end of file