![](/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
main.cpp@0:8acbce46eede, 2016-11-06 (annotated)
- Committer:
- karpent
- Date:
- Sun Nov 06 02:14:34 2016 +0000
- Revision:
- 0:8acbce46eede
- Child:
- 1:4a5e329e617b
Initial revision with square 3D model.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
karpent | 0:8acbce46eede | 1 | // |
karpent | 0:8acbce46eede | 2 | // main.cpp - 3D Graphics Demo |
karpent | 0:8acbce46eede | 3 | // |
karpent | 0:8acbce46eede | 4 | |
karpent | 0:8acbce46eede | 5 | #include "mbed.h" |
karpent | 0:8acbce46eede | 6 | #include "RK043FN48H.h" |
karpent | 0:8acbce46eede | 7 | #include "Canvas.h" |
karpent | 0:8acbce46eede | 8 | #include "Square.h" |
karpent | 0:8acbce46eede | 9 | |
karpent | 0:8acbce46eede | 10 | RK043FN48H display; |
karpent | 0:8acbce46eede | 11 | |
karpent | 0:8acbce46eede | 12 | int main() |
karpent | 0:8acbce46eede | 13 | { |
karpent | 0:8acbce46eede | 14 | Canvas canvas(display.DisplayWidth(), display.DisplayHeight()); |
karpent | 0:8acbce46eede | 15 | Square model(&canvas); |
karpent | 0:8acbce46eede | 16 | |
karpent | 0:8acbce46eede | 17 | canvas.SetDrawColor(0xFF, 0, 0, 0xFF); |
karpent | 0:8acbce46eede | 18 | while(1) { |
karpent | 0:8acbce46eede | 19 | int angle = model.GetAngle(); |
karpent | 0:8acbce46eede | 20 | |
karpent | 0:8acbce46eede | 21 | canvas.Clear(); |
karpent | 0:8acbce46eede | 22 | model.Render(); |
karpent | 0:8acbce46eede | 23 | display.CopyBitmap(Foreground, canvas.GetBitmap(), canvas.DisplayWidth(), canvas.DisplayHeight(), canvas.GetDrawColor()); |
karpent | 0:8acbce46eede | 24 | |
karpent | 0:8acbce46eede | 25 | wait(0.04f); |
karpent | 0:8acbce46eede | 26 | } |
karpent | 0:8acbce46eede | 27 | } |