| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 UI_GL_GL_HELPER_H_ | 5 #ifndef UI_GL_GL_HELPER_H_ |
| 6 #define UI_GL_GL_HELPER_H_ | 6 #define UI_GL_GL_HELPER_H_ |
| 7 | 7 |
| 8 #include "ui/gl/gl_bindings.h" | 8 #include "ui/gl/gl_bindings.h" |
| 9 #include "ui/gl/gl_export.h" | 9 #include "ui/gl/gl_export.h" |
| 10 | 10 |
| 11 namespace gfx { | 11 namespace gl { |
| 12 | 12 |
| 13 class GL_EXPORT GLHelper { | 13 class GL_EXPORT GLHelper { |
| 14 public: | 14 public: |
| 15 // Compiles a shader. | 15 // Compiles a shader. |
| 16 // Does not check for errors, always returns shader. | 16 // Does not check for errors, always returns shader. |
| 17 static GLuint CompileShader(GLenum type, const char* src); | 17 static GLuint CompileShader(GLenum type, const char* src); |
| 18 | 18 |
| 19 // Compiles a shader and checks for compilation errors. | 19 // Compiles a shader and checks for compilation errors. |
| 20 // Returns shader, 0 on failure. | 20 // Returns shader, 0 on failure. |
| 21 static GLuint LoadShader(GLenum type, const char* src); | 21 static GLuint LoadShader(GLenum type, const char* src); |
| 22 | 22 |
| 23 // Attaches 2 shaders and links them to a program. | 23 // Attaches 2 shaders and links them to a program. |
| 24 // Does not check for errors, always returns program. | 24 // Does not check for errors, always returns program. |
| 25 static GLuint LinkProgram(GLuint vertex_shader, GLuint fragment_shader); | 25 static GLuint LinkProgram(GLuint vertex_shader, GLuint fragment_shader); |
| 26 | 26 |
| 27 // Attaches 2 shaders, links them to a program, and checks for errors. | 27 // Attaches 2 shaders, links them to a program, and checks for errors. |
| 28 // Returns program, 0 on failure. | 28 // Returns program, 0 on failure. |
| 29 static GLuint SetupProgram(GLuint vertex_shader, GLuint fragment_shader); | 29 static GLuint SetupProgram(GLuint vertex_shader, GLuint fragment_shader); |
| 30 | 30 |
| 31 // Sets up a vertex buffer containing 4 vertices that can be used to draw | 31 // Sets up a vertex buffer containing 4 vertices that can be used to draw |
| 32 // a quad as a tri-strip. | 32 // a quad as a tri-strip. |
| 33 static GLuint SetupQuadVertexBuffer(); | 33 static GLuint SetupQuadVertexBuffer(); |
| 34 | 34 |
| 35 // Draws a quad to the currently bound frame buffer. | 35 // Draws a quad to the currently bound frame buffer. |
| 36 static void DrawQuad(GLuint vertex_buffer); | 36 static void DrawQuad(GLuint vertex_buffer); |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 } // namespace gfx | 39 } // namespace gl |
| 40 | 40 |
| 41 #endif // UI_GL_GL_HELPER_H_ | 41 #endif // UI_GL_GL_HELPER_H_ |
| OLD | NEW |