Home | History | Annotate | Download | only in libGLESv2
      1 //
      2 // Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
      3 // Use of this source code is governed by a BSD-style license that can be
      4 // found in the LICENSE file.
      5 //
      6 // This class contains prototypes for representing GLES 3 Vertex Array Objects:
      7 //
      8 //   The buffer objects that are to be used by the vertex stage of the GL are collected
      9 //   together to form a vertex array object. All state related to the definition of data used
     10 //   by the vertex processor is encapsulated in a vertex array object.
     11 //
     12 
     13 #ifndef LIBGLESV2_VERTEXARRAY_H_
     14 #define LIBGLESV2_VERTEXARRAY_H_
     15 
     16 #include "common/RefCountObject.h"
     17 #include "libGLESv2/constants.h"
     18 #include "libGLESv2/VertexAttribute.h"
     19 
     20 #include <vector>
     21 
     22 namespace rx
     23 {
     24 class Renderer;
     25 class VertexArrayImpl;
     26 }
     27 
     28 namespace gl
     29 {
     30 class Buffer;
     31 
     32 class VertexArray
     33 {
     34   public:
     35     VertexArray(rx::VertexArrayImpl *impl, GLuint id, size_t maxAttribs);
     36     ~VertexArray();
     37 
     38     GLuint id() const;
     39 
     40     const VertexAttribute& getVertexAttribute(size_t attributeIndex) const;
     41     void detachBuffer(GLuint bufferName);
     42     void setVertexAttribDivisor(GLuint index, GLuint divisor);
     43     void enableAttribute(unsigned int attributeIndex, bool enabledState);
     44     void setAttributeState(unsigned int attributeIndex, gl::Buffer *boundBuffer, GLint size, GLenum type,
     45                            bool normalized, bool pureInteger, GLsizei stride, const void *pointer);
     46 
     47     const VertexAttribute* getVertexAttributes() const { return mVertexAttributes.data(); }
     48     Buffer *getElementArrayBuffer() const { return mElementArrayBuffer.get(); }
     49     void setElementArrayBuffer(Buffer *buffer);
     50     GLuint getElementArrayBufferId() const { return mElementArrayBuffer.id(); }
     51     size_t getMaxAttribs() const { return mVertexAttributes.size(); }
     52 
     53   private:
     54     GLuint mId;
     55 
     56     rx::VertexArrayImpl *mVertexArray;
     57     std::vector<VertexAttribute> mVertexAttributes;
     58     BindingPointer<Buffer> mElementArrayBuffer;
     59 };
     60 
     61 }
     62 
     63 #endif // LIBGLESV2_VERTEXARRAY_H_
     64