Home | History | Annotate | Download | only in output
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef CC_OUTPUT_GEOMETRY_BINDING_H_
      6 #define CC_OUTPUT_GEOMETRY_BINDING_H_
      7 
      8 #include "base/basictypes.h"
      9 #include "third_party/khronos/GLES2/gl2.h"
     10 
     11 namespace gfx {
     12 class RectF;
     13 }
     14 namespace gpu {
     15 namespace gles2 {
     16 class GLES2Interface;
     17 }
     18 }
     19 
     20 namespace cc {
     21 
     22 class GeometryBinding {
     23  public:
     24   GeometryBinding(gpu::gles2::GLES2Interface* gl,
     25                   const gfx::RectF& quad_vertex_rect);
     26   ~GeometryBinding();
     27 
     28   void PrepareForDraw();
     29 
     30   // All layer shaders share the same attribute locations for the vertex
     31   // positions and texture coordinates. This allows switching shaders without
     32   // rebinding attribute arrays.
     33   static int PositionAttribLocation() { return 0; }
     34   static int TexCoordAttribLocation() { return 1; }
     35   static int TriangleIndexAttribLocation() { return 2; }
     36 
     37  private:
     38   gpu::gles2::GLES2Interface* gl_;
     39 
     40   GLuint quad_vertices_vbo_;
     41   GLuint quad_elements_vbo_;
     42 
     43   DISALLOW_COPY_AND_ASSIGN(GeometryBinding);
     44 };
     45 
     46 }  // namespace cc
     47 
     48 #endif  // CC_OUTPUT_GEOMETRY_BINDING_H_
     49