![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Example of using "Canvas" form "Graphics" library to display 3D graphics.
Dependencies: BSP_DISCO_F746NG Graphics mbed
Diff: Models/Cube.cpp
- Revision:
- 3:aca7fe2d44b3
- Parent:
- 1:4a5e329e617b
--- a/Models/Cube.cpp Fri Nov 11 15:30:07 2016 +0000 +++ b/Models/Cube.cpp Fri Nov 11 17:06:53 2016 +0000 @@ -9,8 +9,7 @@ #include "Cube.h" // Constructor -Cube::Cube(Display * display) - : Angle() +Cube::Cube(Display * display) : Model() { glUseCanvas(display); @@ -23,6 +22,9 @@ */ void Cube::Setup() { + // Make the model a little bigger + SetFixedScaleMode(2.3f); + glPointSize(4); glMatrixMode(GL_PROJECTION); @@ -40,7 +42,7 @@ */ void Cube::Render() { - const float scale = 2.5; + const float scale = GetScaleValue(); // Put the initial matrix at glMatrices[glmatrixMode == GL_PROJECTION] glLoadIdentity(); @@ -48,7 +50,7 @@ // Transform matrix gluLookAt(10, 8, -10, 0, 0, 0, 0, 1, 0); - glRotatef(angle, 0.f, 1.f, 0.f); + glRotatef(GetAngleValue(), 0.f, 1.f, 0.f); glScalef(scale, scale, scale); DrawCube();