8#include <unordered_map>
17template<
class V,
class N,
class C,
class T>
30 void setMesh(
const ofMesh & mesh,
int usage,
bool useColors,
bool useTextures,
bool useNormals);
32 void setVertexData(
const glm::vec3 * verts,
int total,
int usage);
33 void setVertexData(
const glm::vec2 * verts,
int total,
int usage);
38 void setNormalData(
const glm::vec3 * normals,
int total,
int usage);
40 void setTexCoordData(
const glm::vec2 * texCoords,
int total,
int usage);
44 void setVertexData(
const float * vert0x,
int numCoords,
int total,
int usage,
int stride=0);
45 void setColorData(
const float * color0r,
int total,
int usage,
int stride=0);
46 void setNormalData(
const float * normal0x,
int total,
int usage,
int stride=0);
47 void setTexCoordData(
const float * texCoord0x,
int total,
int usage,
int stride=0);
49 void setAttributeData(
int location,
const float * vert0x,
int numCoords,
int total,
int usage,
int stride=0);
51#ifndef TARGET_OPENGLES
130 void draw(
int drawMode,
int first,
int total)
const;
131 void drawElements(
int drawMode,
int amt,
int offsetelements = 0)
const;
133 void drawInstanced(
int drawMode,
int first,
int total,
int primCount)
const;
156 struct VertexAttribute{
158 bool isAllocated()
const;
162 void setData(GLsizeiptr bytes,
const void * data, GLenum usage);
163 void updateData(GLintptr offset, GLsizeiptr bytes,
const void * data);
164 void setData(
const float * attrib0x,
int numCoords,
int total,
int usage,
int stride,
bool normalize=
false);
165 void setBuffer(
ofBufferObject & buffer,
int numCoords,
int stride,
int offset);
167 void disable()
const;
168 GLuint getId()
const;
178 struct IndexAttribute{
180 bool isAllocated()
const;
184 void setData(GLsizeiptr bytes,
const void * data, GLenum usage);
185 void updateData(GLintptr offset, GLsizeiptr bytes,
const void * data);
186 GLuint getId()
const;
191 mutable bool vaoChanged;
193 IndexAttribute indexAttribute;
195 mutable bool bUsingVerts;
196 mutable bool bUsingTexCoords;
197 mutable bool bUsingColors;
198 mutable bool bUsingNormals;
199 mutable bool bUsingIndices;
204 VertexAttribute positionAttribute;
205 VertexAttribute colorAttribute;
206 VertexAttribute texCoordAttribute;
207 VertexAttribute normalAttribute;
208 std::unordered_map<int,VertexAttribute> customAttributes;
210 static bool vaoChecked;
211 static bool vaoSupported;
213 VertexAttribute & getOrCreateAttr(
int location);
Definition ofBufferObject.h:8
ofColor represents a color in openFrameworks.
Definition ofColor.h:20
Represents a set of vertices in 3D spaces with normals, colors, and texture coordinates at those poin...
Definition ofMesh.h:78
void disableColors()
Definition ofVbo.cpp:601
void setTexCoordData(const glm::vec2 *texCoords, int total, int usage)
Definition ofVbo.cpp:379
GLuint getVaoId() const
Definition ofVbo.cpp:660
GLuint getColorId() const
Definition ofVbo.cpp:670
void clearVertices()
Definition ofVbo.cpp:1016
void updateTexCoordData(const glm::vec2 *texCoords, int total)
Definition ofVbo.cpp:520
~ofVbo()
Definition ofVbo.cpp:282
void updateIndexData(const ofIndexType *indices, int total)
Definition ofVbo.cpp:535
void updateMesh(const ofMesh &mesh)
Definition ofVbo.cpp:462
void updateNormalData(const glm::vec3 *normals, int total)
Definition ofVbo.cpp:505
bool getUsingColors() const
Definition ofVbo.cpp:640
void setAttributeBuffer(int location, ofBufferObject &buffer, int numCoords, int stride, int offset=0)
Definition ofVbo.cpp:744
void clearColors()
Definition ofVbo.cpp:1031
void disableTexCoords()
Definition ofVbo.cpp:615
void clearIndices()
Definition ofVbo.cpp:1046
void setNormalBuffer(ofBufferObject &buffer, int stride, int offset=0)
Definition ofVbo.cpp:725
bool getUsingNormals() const
Definition ofVbo.cpp:645
GLuint getVertId() const
Definition ofVbo.cpp:665
GLuint getAttributeId(int AttrPos_) const
returns OpenGL memory object id for GL buffer holding attribute data
Definition ofVbo.cpp:690
void enableColors()
Definition ofVbo.cpp:573
void draw(int drawMode, int first, int total) const
Definition ofVbo.cpp:969
void clearTexCoords()
Definition ofVbo.cpp:1039
bool getIsAllocated() const
Definition ofVbo.cpp:630
void disableNormals()
Definition ofVbo.cpp:608
void setAttributeDivisor(int location, int divisor)
Definition ofVbo.cpp:456
void drawElementsInstanced(int drawMode, int amt, int primCount) const
Definition ofVbo.cpp:984
void setColorBuffer(ofBufferObject &buffer, int stride, int offset=0)
Definition ofVbo.cpp:719
void setMesh(const ofMesh &mesh, int usage)
Definition ofVbo.cpp:287
ofVbo & operator=(const ofVbo &mom)
Definition ofVbo.cpp:252
bool hasAttribute(int attributePos_) const
Definition ofVbo.cpp:1101
void clear()
Definition ofVbo.cpp:989
void clearAttribute(int attributePos_)
Definition ofVbo.cpp:1056
void setVertexData(const glm::vec3 *verts, int total, int usage)
Definition ofVbo.cpp:325
bool getUsingVerts() const
Definition ofVbo.cpp:635
void updateAttributeData(int location, const float *vert0x, int total)
Definition ofVbo.cpp:541
void updateVertexData(const glm::vec3 *verts, int total)
Definition ofVbo.cpp:470
void updateColorData(const ofFloatColor *colors, int total)
Definition ofVbo.cpp:495
void bind() const
Definition ofVbo.cpp:839
void setAttributeData(int location, const float *vert0x, int numCoords, int total, int usage, int stride=0)
Definition ofVbo.cpp:437
int getNumIndices() const
Definition ofVbo.cpp:1087
void unbind() const
Definition ofVbo.cpp:947
void setNormalData(const glm::vec3 *normals, int total, int usage)
Definition ofVbo.cpp:363
void enableTexCoords()
Definition ofVbo.cpp:587
ofBufferObject & getColorBuffer()
Definition ofVbo.cpp:762
void drawInstanced(int drawMode, int first, int total, int primCount) const
Definition ofVbo.cpp:979
void clearNormals()
Definition ofVbo.cpp:1024
ofBufferObject & getTexCoordBuffer()
Definition ofVbo.cpp:772
void drawElements(int drawMode, int amt, int offsetelements=0) const
Definition ofVbo.cpp:974
void enableNormals()
Definition ofVbo.cpp:580
void setIndexData(const ofIndexType *indices, int total, int usage)
Definition ofVbo.cpp:396
void disableIndices()
Definition ofVbo.cpp:622
ofBufferObject & getNormalBuffer()
Definition ofVbo.cpp:767
GLuint getTexCoordId() const
Definition ofVbo.cpp:680
void setTexCoordBuffer(ofBufferObject &buffer, int stride, int offset=0)
Definition ofVbo.cpp:731
ofBufferObject & getIndexBuffer()
Definition ofVbo.cpp:777
void setVertexBuffer(ofBufferObject &buffer, int numCoords, int stride, int offset=0)
Definition ofVbo.cpp:699
void setColorData(const ofFloatColor *colors, int total, int usage)
Definition ofVbo.cpp:352
ofBufferObject & getVertexBuffer()
Definition ofVbo.cpp:757
void enableIndices()
Definition ofVbo.cpp:594
GLuint getIndexId() const
Definition ofVbo.cpp:685
bool getUsingIndices() const
Definition ofVbo.cpp:655
ofBufferObject & getAttributeBuffer(int location)
Definition ofVbo.cpp:782
GLuint getNormalId() const
Definition ofVbo.cpp:675
void setIndexBuffer(ofBufferObject &buffer)
Definition ofVbo.cpp:737
bool getUsingTexCoords() const
Definition ofVbo.cpp:650
int getNumVertices() const
Definition ofVbo.cpp:1096
ofVbo()
Definition ofVbo.cpp:207
ofVec2f is a class for storing a two dimensional vector.
Definition ofVec2f.h:72
ofVec3f is a class for storing a three dimensional vector.
Definition ofVec3f.h:79
TESSindex ofIndexType
Definition ofConstants.h:290
ofColor_< float > ofFloatColor
Definition ofVbo.h:12