OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This example program is based on Simple_VertexShader.c from: | 5 // This example program is based on Simple_VertexShader.c from: |
6 | 6 |
7 // | 7 // |
8 // Book: OpenGL(R) ES 2.0 Programming Guide | 8 // Book: OpenGL(R) ES 2.0 Programming Guide |
9 // Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner | 9 // Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner |
10 // ISBN-10: 0321502795 | 10 // ISBN-10: 0321502795 |
11 // ISBN-13: 9780321502797 | 11 // ISBN-13: 9780321502797 |
12 // Publisher: Addison-Wesley Professional | 12 // Publisher: Addison-Wesley Professional |
13 // URLs: http://safari.informit.com/9780321563835 | 13 // URLs: http://safari.informit.com/9780321563835 |
14 // http://www.opengles-book.com | 14 // http://www.opengles-book.com |
15 // | 15 // |
16 | 16 |
17 #include "examples/sample_app/spinning_cube.h" | 17 #include "examples/sample_app/spinning_cube.h" |
18 | 18 |
19 #include <GLES2/gl2.h> | 19 #include <GLES2/gl2.h> |
20 #include <GLES2/gl2ext.h> | 20 #include <GLES2/gl2ext.h> |
21 #include <math.h> | 21 #include <math.h> |
22 #include <stdlib.h> | 22 #include <stdlib.h> |
23 #include <string.h> | 23 #include <string.h> |
24 | 24 |
| 25 #include "mojo/common/common_type_converters.h" |
25 #include "mojo/public/cpp/environment/logging.h" | 26 #include "mojo/public/cpp/environment/logging.h" |
26 | 27 |
27 namespace examples { | 28 namespace examples { |
28 | 29 |
29 namespace { | 30 namespace { |
30 | 31 |
31 const float kPi = 3.14159265359f; | 32 const float kPi = 3.14159265359f; |
32 const int kNumVertices = 24; | 33 const int kNumVertices = 24; |
33 | 34 |
34 int GenerateCube(GLuint *vbo_vertices, | 35 int GenerateCube(GLuint *vbo_vertices, |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 | 548 |
548 ESMatrix modelview; | 549 ESMatrix modelview; |
549 modelview.LoadIdentity(); | 550 modelview.LoadIdentity(); |
550 modelview.Translate(0.0, 0.0, -2.0); | 551 modelview.Translate(0.0, 0.0, -2.0); |
551 modelview.Rotate(state_->angle_ * direction_, 1.0, 0.0, 1.0); | 552 modelview.Rotate(state_->angle_ * direction_, 1.0, 0.0, 1.0); |
552 | 553 |
553 state_->mvp_matrix_.Multiply(&modelview, &perspective); | 554 state_->mvp_matrix_.Multiply(&modelview, &perspective); |
554 } | 555 } |
555 | 556 |
556 } // namespace examples | 557 } // namespace examples |
OLD | NEW |