| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "jni/graphics.h" | 5 #include "embedders/android/graphics.h" |
| 6 | 6 |
| 7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
| 8 #include <GLES2/gl2ext.h> | 8 #include <GLES2/gl2ext.h> |
| 9 | 9 |
| 10 #include "jni/log.h" | 10 #include "embedders/android/log.h" |
| 11 | 11 |
| 12 Graphics::Graphics(android_app* application, Timer* timer) | 12 Graphics::Graphics(android_app* application, Timer* timer) |
| 13 : application_(application), | 13 : application_(application), |
| 14 timer_(timer), | 14 timer_(timer), |
| 15 width_(0), | 15 width_(0), |
| 16 height_(0), | 16 height_(0), |
| 17 display_(EGL_NO_DISPLAY), | 17 display_(EGL_NO_DISPLAY), |
| 18 surface_(EGL_NO_SURFACE), | 18 surface_(EGL_NO_SURFACE), |
| 19 context_(EGL_NO_CONTEXT) { | 19 context_(EGL_NO_CONTEXT) { |
| 20 } | 20 } |
| 21 | 21 |
| 22 const int32_t& Graphics::height() { | 22 const int32_t& Graphics::height() { |
| 23 return height_; | 23 return height_; |
| 24 } | 24 } |
| 25 | 25 |
| 26 const int32_t& Graphics::width() { | 26 const int32_t& Graphics::width() { |
| 27 return width_; | 27 return width_; |
| 28 } | 28 } |
| 29 | 29 |
| 30 int32_t Graphics::Start() { | 30 int32_t Graphics::Start() { |
| 31 EGLint format, numConfigs, errorResult; | 31 EGLint format, numConfigs; |
| 32 EGLConfig config; | 32 EGLConfig config; |
| 33 const EGLint attributes[] = { | 33 const EGLint attributes[] = { |
| 34 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, | 34 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, |
| 35 EGL_NONE | 35 EGL_NONE |
| 36 }; | 36 }; |
| 37 static const EGLint ctx_attribs[] = { | 37 static const EGLint ctx_attribs[] = { |
| 38 EGL_CONTEXT_CLIENT_VERSION, 2, | 38 EGL_CONTEXT_CLIENT_VERSION, 2, |
| 39 EGL_NONE | 39 EGL_NONE |
| 40 }; | 40 }; |
| 41 | 41 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 surface_ = EGL_NO_SURFACE; | 89 surface_ = EGL_NO_SURFACE; |
| 90 } | 90 } |
| 91 eglTerminate(display_); | 91 eglTerminate(display_); |
| 92 display_ = EGL_NO_DISPLAY; | 92 display_ = EGL_NO_DISPLAY; |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 int32_t Graphics::Update() { | 96 int32_t Graphics::Update() { |
| 97 return 0; | 97 return 0; |
| 98 } | 98 } |
| OLD | NEW |