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 #ifndef MOJO_APPS_JS_BINDINGS_GL_CONTEXT_H_ | 5 #ifndef MOJO_APPS_JS_BINDINGS_GL_CONTEXT_H_ |
6 #define MOJO_APPS_JS_BINDINGS_GL_CONTEXT_H_ | 6 #define MOJO_APPS_JS_BINDINGS_GL_CONTEXT_H_ |
7 | 7 |
8 #include <GLES2/gl2.h> | 8 #include <GLES2/gl2.h> |
9 | 9 |
10 #include "gin/handle.h" | 10 #include "gin/handle.h" |
11 #include "gin/public/wrapper_info.h" | 11 #include "gin/public/wrapper_info.h" |
12 #include "gin/wrappable.h" | 12 #include "gin/wrappable.h" |
13 #include "mojo/apps/js/bindings/gl/opaque.h" | |
14 #include "v8/include/v8.h" | 13 #include "v8/include/v8.h" |
15 | 14 |
16 namespace gin { | 15 namespace gin { |
17 class Arguments; | 16 class Arguments; |
| 17 class ArrayBufferView; |
18 } | 18 } |
19 | 19 |
20 namespace mojo { | 20 namespace mojo { |
21 namespace js { | 21 namespace js { |
22 namespace gl { | 22 namespace gl { |
23 | 23 |
24 typedef Opaque Shader; | |
25 | |
26 // Context implements WebGLRenderingContext. | 24 // Context implements WebGLRenderingContext. |
27 class Context : public gin::Wrappable<Context> { | 25 class Context : public gin::Wrappable<Context> { |
28 public: | 26 public: |
29 static gin::WrapperInfo kWrapperInfo; | 27 static gin::WrapperInfo kWrapperInfo; |
30 | 28 |
| 29 static gin::Handle<Context> Create(v8::Isolate* isolate, uint64_t encoded, |
| 30 int width, int height); |
31 static v8::Local<v8::ObjectTemplate> GetObjectTemplate(v8::Isolate* isolate); | 31 static v8::Local<v8::ObjectTemplate> GetObjectTemplate(v8::Isolate* isolate); |
32 | 32 |
33 static gin::Handle<Context> Create(v8::Isolate* isolate, uint64_t encoded, | 33 static void BufferData(GLenum target, const gin::ArrayBufferView& buffer, |
34 int width, int height); | 34 GLenum usage); |
35 static gin::Handle<Shader> CreateShader(const gin::Arguments& arguments, | 35 static void CompileShader(const gin::Arguments& args, GLuint shader); |
36 GLenum type); | 36 static GLuint CreateBuffer(); |
37 static void ShaderSource(gin::Handle<Shader> shader, | 37 static GLint GetAttribLocation(GLuint program, const std::string& name); |
38 const std::string& source); | 38 static std::string GetProgramInfoLog(GLuint program); |
39 static void CompileShader(const gin::Arguments& arguments, | 39 static std::string GetShaderInfoLog(GLuint shader); |
40 gin::Handle<Shader> shader); | 40 static GLint GetUniformLocation(GLuint program, const std::string& name); |
| 41 static void ShaderSource(GLuint shader, const std::string& source); |
| 42 static void UniformMatrix4fv(GLint location, GLboolean transpose, |
| 43 const gin::ArrayBufferView& buffer); |
41 | 44 |
42 private: | 45 private: |
43 Context(uint64_t encoded, int width, int height); | 46 Context(uint64_t encoded, int width, int height); |
44 | 47 |
45 uint64_t encoded_; | 48 uint64_t encoded_; |
46 }; | 49 }; |
47 | 50 |
48 } // namespace gl | 51 } // namespace gl |
49 } // namespace js | 52 } // namespace js |
50 } // namespace mojo | 53 } // namespace mojo |
51 | 54 |
52 #endif // MOJO_APPS_JS_BINDINGS_GL_CONTEXT_H_ | 55 #endif // MOJO_APPS_JS_BINDINGS_GL_CONTEXT_H_ |
OLD | NEW |