Tucano
0.1
A library for rapid prototyping with modern OpenGL and GLSL
|
A vertex attribute of a mesh. More...
#include <mesh.hpp>
Public Member Functions | |
VertexAttribute (string in_name, int in_num_elements, int in_element_size, GLenum in_type, GLenum in_array_type=GL_ARRAY_BUFFER) | |
string | getName (void) const |
Returns the name of the attribute. More... | |
int | getSize (void) const |
Returns the number of elements of this attribute (usually number of vertices in VAO) More... | |
int | getElementSize (void) const |
Returns the number of elements per attribute For example, returns 3 if attribute is of type vec3. More... | |
GLenum | getType (void) const |
Returns the type of the attribute (ex. GL_FLOAT) More... | |
GLenum | getArrayType (void) const |
Returns the type of array (ex. GL_ARRAY_BUFFER) More... | |
void | setArrayType (GLenum at) |
Sets the type of array (default is GL_ARRAY_BUFFER) More... | |
GLint | getLocation (void) const |
Returns the location of the attribute. The location is usually set by the shader, since it can be used by different shaders in different situations, and we don't want to force the shader layout id to be known beforehand. More... | |
void | setLocation (GLint loc) |
Sets the location of the attribute for a shader. More... | |
GLuint | getBufferID (void) |
Returns the id of the vertex array of this attribute. More... | |
void | bind (void) |
Bind the attribute. More... | |
void | enable (GLint loc) |
Bind the attribute to a given location. More... | |
void | enable () |
Binds the attribute to its location. More... | |
void | unbind (void) |
Unbind the attribute. More... | |
void | disable (void) |
Disables associated location if attribute has one. More... | |
Public Attributes | |
string | name |
Attribute's name. More... | |
int | size = 0 |
size of attribute array (usually number of vertices) More... | |
int | element_size = 0 |
number of elements per attribute More... | |
GLint | location = -1 |
this is set by the shader using the attribute More... | |
GLuint | bufferID = 0 |
Vertex array Buffer ID. More... | |
GLenum | type = GL_FLOAT |
Type of attribute element (ex. GL_FLOAT) More... | |
GLenum | array_type = GL_ARRAY_BUFFER |
Type of attribute array (GL_ARRAY_BUFFER for most cases), indices are GL_ELEMENT_ARRAY_BUFFER. More... | |
std::shared_ptr< GLuint > | bufferID_sptr |
Friends | |
class | Mesh |
A vertex attribute of a mesh.
Some common attributes (coordinate, color, normal, texCoord) have custom loaders. Otherwise, a generic attribute can be loaded.
|
inline |
|
inline |
Bind the attribute.
|
inline |
Disables associated location if attribute has one.
|
inline |
Bind the attribute to a given location.
|
inline |
Binds the attribute to its location.
|
inline |
Returns the type of array (ex. GL_ARRAY_BUFFER)
|
inline |
Returns the id of the vertex array of this attribute.
|
inline |
Returns the number of elements per attribute For example, returns 3 if attribute is of type vec3.
|
inline |
Returns the location of the attribute. The location is usually set by the shader, since it can be used by different shaders in different situations, and we don't want to force the shader layout id to be known beforehand.
|
inline |
Returns the name of the attribute.
|
inline |
Returns the number of elements of this attribute (usually number of vertices in VAO)
|
inline |
Returns the type of the attribute (ex. GL_FLOAT)
|
inline |
Sets the type of array (default is GL_ARRAY_BUFFER)
at | Array type |
|
inline |
Sets the location of the attribute for a shader.
loc | Attribute shader location |
|
inline |
Unbind the attribute.
|
friend |
GLenum Tucano::VertexAttribute::array_type = GL_ARRAY_BUFFER |
Type of attribute array (GL_ARRAY_BUFFER for most cases), indices are GL_ELEMENT_ARRAY_BUFFER.
GLuint Tucano::VertexAttribute::bufferID = 0 |
Vertex array Buffer ID.
std::shared_ptr< GLuint > Tucano::VertexAttribute::bufferID_sptr |
int Tucano::VertexAttribute::element_size = 0 |
number of elements per attribute
GLint Tucano::VertexAttribute::location = -1 |
this is set by the shader using the attribute
string Tucano::VertexAttribute::name |
Attribute's name.
int Tucano::VertexAttribute::size = 0 |
size of attribute array (usually number of vertices)
GLenum Tucano::VertexAttribute::type = GL_FLOAT |
Type of attribute element (ex. GL_FLOAT)