OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 #include "cc/geometry_binding.h" | 5 #include "cc/geometry_binding.h" |
6 | 6 |
7 #include "cc/gl_renderer.h" // For the GLC() macro. | 7 #include "cc/gl_renderer.h" // For the GLC() macro. |
| 8 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" |
8 #include "third_party/khronos/GLES2/gl2.h" | 9 #include "third_party/khronos/GLES2/gl2.h" |
9 #include "ui/gfx/rect_f.h" | 10 #include "ui/gfx/rect_f.h" |
10 #include <public/WebGraphicsContext3D.h> | |
11 | 11 |
12 namespace cc { | 12 namespace cc { |
13 | 13 |
14 GeometryBinding::GeometryBinding(WebKit::WebGraphicsContext3D* context, const gf
x::RectF& quadVertexRect) | 14 GeometryBinding::GeometryBinding(WebKit::WebGraphicsContext3D* context, const gf
x::RectF& quadVertexRect) |
15 : m_context(context) | 15 : m_context(context) |
16 , m_quadVerticesVbo(0) | 16 , m_quadVerticesVbo(0) |
17 , m_quadElementsVbo(0) | 17 , m_quadElementsVbo(0) |
18 , m_initialized(false) | 18 , m_initialized(false) |
19 { | 19 { |
20 float vertices[] = { quadVertexRect.x(), quadVertexRect.bottom(), 0.0f, 0.0f
, 1.0f, | 20 float vertices[] = { quadVertexRect.x(), quadVertexRect.bottom(), 0.0f, 0.0f
, 1.0f, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 GLC(m_context, m_context->bindBuffer(GL_ARRAY_BUFFER, quadVerticesVbo())); | 70 GLC(m_context, m_context->bindBuffer(GL_ARRAY_BUFFER, quadVerticesVbo())); |
71 GLC(m_context, m_context->vertexAttribPointer(positionAttribLocation(), 3, G
L_FLOAT, false, 6 * sizeof(float), 0)); | 71 GLC(m_context, m_context->vertexAttribPointer(positionAttribLocation(), 3, G
L_FLOAT, false, 6 * sizeof(float), 0)); |
72 GLC(m_context, m_context->vertexAttribPointer(texCoordAttribLocation(), 2, G
L_FLOAT, false, 6 * sizeof(float), 3 * sizeof(float))); | 72 GLC(m_context, m_context->vertexAttribPointer(texCoordAttribLocation(), 2, G
L_FLOAT, false, 6 * sizeof(float), 3 * sizeof(float))); |
73 GLC(m_context, m_context->vertexAttribPointer(triangleIndexAttribLocation(),
1, GL_FLOAT, false, 6 * sizeof(float), 5 * sizeof(float))); | 73 GLC(m_context, m_context->vertexAttribPointer(triangleIndexAttribLocation(),
1, GL_FLOAT, false, 6 * sizeof(float), 5 * sizeof(float))); |
74 GLC(m_context, m_context->enableVertexAttribArray(positionAttribLocation()))
; | 74 GLC(m_context, m_context->enableVertexAttribArray(positionAttribLocation()))
; |
75 GLC(m_context, m_context->enableVertexAttribArray(texCoordAttribLocation()))
; | 75 GLC(m_context, m_context->enableVertexAttribArray(texCoordAttribLocation()))
; |
76 GLC(m_context, m_context->enableVertexAttribArray(triangleIndexAttribLocatio
n())); | 76 GLC(m_context, m_context->enableVertexAttribArray(triangleIndexAttribLocatio
n())); |
77 } | 77 } |
78 | 78 |
79 } // namespace cc | 79 } // namespace cc |
OLD | NEW |