Represents a sequence of vertices.
VertexSeq represents a sequence of vertices with arbitrary attributes, which may be indexed. It uses an OpenGL vertex buffer and an optional index buffer.
The typical creation cycle is:
create to create the underlying data structuresprime to obtain a HotVertexSeq (the VertexSeq needs to be created first)Inherits GLObject.
Public Member Functions | |
| VertexSeq (const VertexSeq ©) | |
| VertexSeq & | operator= (const VertexSeq ©) |
| VertexSeq (VertexSeq &&m) | |
| VertexSeq & | operator= (VertexSeq &&m) |
| void | create (uint16_t vertexSize, uint32_t vertexCount, uint32_t indexCount=0) |
| Creates internal data structures. More... | |
| template<typename... Cs, typename L > | |
| void | prime (L lambda) |
| Primes the VertexSeq to obtain a HotVertexSeq. More... | |
| void | prime (std::function< void(HotVertexSeq<> &)> func) |
| Primes the VertexSeq to obtain a HotVertexSeq. More... | |
| GLuint | nativeVertexHandle () const |
| Returns the native OpenGL handle of the vertex buffer. | |
| GLuint | nativeIndexHandle () const |
| Returns the native OpenGL handle of the index buffer. | |
| GLuint | nativeVAOHandle () const |
| Returns the native OpenGL handle of the vertex array object. | |
| int | size () const |
| Returns the number of vertices in the sequence. | |
| bool | isVertexLayoutActive () const |
| Determines if a vertex layout is active. | |
| operator bool () const | |
| Returns true if the VertexSeq was created. | |
Public Member Functions inherited from SingleBase | |
| void | setServiceContext (config::ServiceContext cnt) |
| template<typename Ex , LogLevel LL, typename... Ts> | |
| Error Notice Debug void | logAndThrow (Ts...args) |
Static Public Member Functions | |
| static void | setupOpenGL () |
Additional Inherited Members | |
Protected Member Functions inherited from GLContextFreeObject | |
| template<typename... Ts> | |
| void | checkGLError (Ts...) |
| template<typename... Ts> | |
| void | checkGLWarning (Ts...) |
| template<typename... Ts> | |
| void | logThrowGL (Ts...) |
Protected Member Functions inherited from SingleBase | |
| template<typename... Ts> | |
| void | logCritical (Ts...args) |
| template<typename... Ts> | |
| void | logError (Ts...args) |
| template<typename... Ts> | |
| void | logWarning (Ts...args) |
| template<typename... Ts> | |
| void | logNotice (Ts...args) |
| template<typename... Ts> | |
| void | log (Ts...args) |
| template<typename... Ts> | |
| void | logDebug (Ts...args) |
| template<typename Ex , LogLevel LL = LogLevel::Error, typename... Ts> | |
| void | logAndThrow (Ts...args) |
Protected Member Functions inherited from NotCopyable | |
| NotCopyable (const NotCopyable &)=delete | |
| NotCopyable & | operator= (const NotCopyable &)=delete |
Static Protected Attributes inherited from GLContextFreeObject | |
| static constexpr PrintGL | GLERR = PrintGL::Error |
| void create | ( | uint16_t | vertexSize, |
| uint32_t | vertexCount, | ||
| uint32_t | indexCount = 0 |
||
| ) |
Creates internal data structures.
Creates a OpenGL vertex buffer (VBO), a vertex array object (VAO), and an optional index buffer when indexCount is not 0.
| vertexSize | The size of one vertex in number of GLfloats. If your vertex contains just a position of three floats (x,y,z) the size is 3. |
| vertexCount | The number of vertices this sequence should hold. If you want to represent a triangle, you need 3 vertices. |
| indexCount | The number of indicies in the index buffer (0 if you don't need an index buffer) |
| void prime | ( | L | lambda | ) |
Primes the VertexSeq to obtain a HotVertexSeq.
Binds all OpenGL resources in order to use (writing data) the VertexSeq.
| lambda | A functor that accepts a HotVertexSeq& as parameter. It will be called after the HotVertexSeq is created. |
| Cs | A list of types of which a vertex consists. If your vertices contain a 3D-Position and a 2D-UV-Coordinate, use those templates: Vec3f, Vec2f |
| void prime | ( | std::function< void(HotVertexSeq<> &)> | func | ) |
Primes the VertexSeq to obtain a HotVertexSeq.
Binds all OpenGL resources in order to use (writing data) the VertexSeq. This is the type-unsafe overload of prime. Whenever you can, you should use the type-safe variant.
| func | A functor that accepts a HotVertexSeq<>& as parameter. It will be called after the HotVertexSeq is created. |