• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 namespace rx
21 {
22 class Renderer;
23 }
24 
25 namespace gl
26 {
27 class Buffer;
28 
29 class VertexArray : public RefCountObject
30 {
31   public:
32     VertexArray(rx::Renderer *renderer, GLuint id);
33     ~VertexArray();
34 
35     const VertexAttribute& getVertexAttribute(unsigned int attributeIndex) const;
36     void detachBuffer(GLuint bufferName);
37     void setVertexAttribDivisor(GLuint index, GLuint divisor);
38     void enableAttribute(unsigned int attributeIndex, bool enabledState);
39     void setAttributeState(unsigned int attributeIndex, gl::Buffer *boundBuffer, GLint size, GLenum type,
40                            bool normalized, bool pureInteger, GLsizei stride, const void *pointer);
41 
getVertexAttributes()42     const VertexAttribute* getVertexAttributes() const { return mVertexAttributes; }
getElementArrayBuffer()43     Buffer *getElementArrayBuffer() const { return mElementArrayBuffer.get(); }
setElementArrayBuffer(Buffer * elementArrayBuffer)44     void setElementArrayBuffer(Buffer *elementArrayBuffer) { mElementArrayBuffer.set(elementArrayBuffer); }
getElementArrayBufferId()45     GLuint getElementArrayBufferId() const { return mElementArrayBuffer.id(); }
46 
47   private:
48     VertexAttribute mVertexAttributes[MAX_VERTEX_ATTRIBS];
49     BindingPointer<Buffer> mElementArrayBuffer;
50 };
51 
52 }
53 
54 #endif // LIBGLESV2_VERTEXARRAY_H_
55