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

Dependencies:   BSP_DISCO_F746NG Graphics mbed

Revision:
3:aca7fe2d44b3
Parent:
1:4a5e329e617b
--- a/Models/Square.cpp	Fri Nov 11 15:30:07 2016 +0000
+++ b/Models/Square.cpp	Fri Nov 11 17:06:53 2016 +0000
@@ -9,7 +9,7 @@
 #include "Square.h"
 
 // Constructor
-Square::Square(Display* display) : Angle()
+Square::Square(Display* display) : Model()
 {
     glUseCanvas(display);
 }
@@ -17,6 +17,10 @@
 
 void Square::Setup()
 {
+    // Let model size change in the range 2 .. 8.
+    // Set 3 as initial size
+    SetShamScaleMode(3.f, 2.f, 8.f, 0.4f); 
+    
     glPointSize(4);
 
     glMatrixMode(GL_PROJECTION);
@@ -29,14 +33,10 @@
 
 void Square::Render()
 {
-    // TODO : Use Scale() class
-    static float scale = 3.0;
-    static float scaleInc = 0.4;
-    const float maxScale = 8.0;
-    const float minScale = 2.0;
+    float scale = GetScaleValue();
 
     glLoadIdentity();
-    glRotatef(angle, 0.f, 0.f, 1.f);
+    glRotatef(GetAngleValue(), 0.f, 0.f, 1.f);
     glScalef(scale, scale, 0.f);
     glTranslatef(-0.5f, -0.5f, 0.f);
 
@@ -46,12 +46,4 @@
     glVertex3f(1.f, 0.f, 0.f);
     glVertex3f(1.f, 1.f, 0.f);
     glEnd();
-
-    scale += scaleInc;
-
-    if(scale > maxScale)
-        scaleInc *= -1.f;
-
-    if(scale < minScale)
-        scaleInc *= -1.f;
 }
\ No newline at end of file