All Classes Files Functions Variables Typedefs Pages
Public Member Functions | Static Public Member Functions | List of all members
VertexSeq Class Reference

Description

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:

See Also
HotVertexSeq
HotVertexSeq<>

Inherits GLObject.

Public Member Functions

 VertexSeq (const VertexSeq &copy)
 
VertexSeqoperator= (const VertexSeq &copy)
 
 VertexSeq (VertexSeq &&m)
 
VertexSeqoperator= (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
 
NotCopyableoperator= (const NotCopyable &)=delete
 
- Static Protected Attributes inherited from GLContextFreeObject
static constexpr PrintGL GLERR = PrintGL::Error
 

Member Function Documentation

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.

Note
You cannot call this while another VertexSeq is primed!
Parameters
vertexSizeThe 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.
vertexCountThe number of vertices this sequence should hold. If you want to represent a triangle, you need 3 vertices.
indexCountThe number of indicies in the index buffer (0 if you don't need an index buffer)
void prime ( lambda)

Primes the VertexSeq to obtain a HotVertexSeq.

Binds all OpenGL resources in order to use (writing data) the VertexSeq.

Note
You cannot call prime while another VertexSeq is primed!
Parameters
lambdaA functor that accepts a HotVertexSeq& as parameter. It will be called after the HotVertexSeq is created.
Template Parameters
CsA 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.

Note
You cannot call prime while another VertexSeq is primed!
Parameters
funcA functor that accepts a HotVertexSeq<>& as parameter. It will be called after the HotVertexSeq is created.