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 "mojo/examples/sample_app/spinning_cube.h" | 17 #include "mojo/examples/sample_app/spinning_cube.h" |
18 | 18 |
19 #include <math.h> | 19 #include <math.h> |
20 #include <stdlib.h> | 20 #include <stdlib.h> |
21 #include <string.h> | 21 #include <string.h> |
22 #include <GLES2/gl2.h> | 22 #include <GLES2/gl2.h> |
23 #include <GLES2/gl2ext.h> | 23 #include <GLES2/gl2ext.h> |
24 | 24 |
25 namespace mojo { | |
26 namespace examples { | 25 namespace examples { |
27 | 26 |
28 namespace { | 27 namespace { |
29 | 28 |
30 const float kPi = 3.14159265359f; | 29 const float kPi = 3.14159265359f; |
31 | 30 |
32 int GenerateCube(GLuint *vbo_vertices, | 31 int GenerateCube(GLuint *vbo_vertices, |
33 GLuint *vbo_indices) { | 32 GLuint *vbo_indices) { |
34 const int num_indices = 36; | 33 const int num_indices = 36; |
35 | 34 |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
462 | 461 |
463 ESMatrix modelview; | 462 ESMatrix modelview; |
464 modelview.LoadIdentity(); | 463 modelview.LoadIdentity(); |
465 modelview.Translate(0.0, 0.0, -2.0); | 464 modelview.Translate(0.0, 0.0, -2.0); |
466 modelview.Rotate(state_->angle_ * direction_, 1.0, 0.0, 1.0); | 465 modelview.Rotate(state_->angle_ * direction_, 1.0, 0.0, 1.0); |
467 | 466 |
468 state_->mvp_matrix_.Multiply(&modelview, &perspective); | 467 state_->mvp_matrix_.Multiply(&modelview, &perspective); |
469 } | 468 } |
470 | 469 |
471 } // namespace examples | 470 } // namespace examples |
472 } // namespace mojo | 471 |
viettrungluu
2014/07/15 20:49:08
...
Hajime Morrita
2014/07/15 23:04:53
Done.
| |
OLD | NEW |