Carna  Version 3.3.2
Public Member Functions | Public Attributes | List of all members
Carna::base::MeshBase Class Reference

Format-independent abstract Mesh base class. Each mesh consists of a VertexBuffer, an IndexBuffer and a vertex array. This class realizes the RAII-idiom w.r.t. the vertex array. More...

#include <Mesh.h>

+ Inheritance diagram for Carna::base::MeshBase:
+ Collaboration diagram for Carna::base::MeshBase:

Public Member Functions

 MeshBase (const VertexAttributes &va, Association< VertexBufferBase > *vertexBuffer, Association< IndexBufferBase > *indexBuffer)
 
virtual ~MeshBase ()
 Deletes. More...
 
void bind () const
 Binds the vertex array object. More...
 
void render () const
 Renders the mesh. More...
 
const VertexBufferBasevertexBuffer () const
 References the mesh's vertex buffer.
 
const IndexBufferBaseindexBuffer () const
 References the mesh's index buffer.
 
VertexBufferBasevertexBuffer ()
 References the mesh's vertex buffer.
 
IndexBufferBaseindexBuffer ()
 References the mesh's index buffer.
 

Public Attributes

const unsigned int id
 Holds the ID of the OpenGL vertex array object.
 
const GLContextglContext
 References the OpenGL context this mesh is valid within.
 

Detailed Description

Format-independent abstract Mesh base class. Each mesh consists of a VertexBuffer, an IndexBuffer and a vertex array. This class realizes the RAII-idiom w.r.t. the vertex array.

The class maintains a so-called OpenGL vertex array in RAII-manner, which, contrary to its name, basically is a conjunction of vertex and index buffer. Because a vertex array is not sharable across OpenGL contexts, objects from this class are always coupled to a particular context.

Any OpenGL object types which are not containers are sharable, as well as Sync Objects and GLSL Objects (excluding program pipeline objects). All container objects are not shared between contexts. [1]

Container objects:

  • Framebuffer Objects
  • Program Pipeline
  • Transform Feedback Objects
  • Vertex Array Objects [2]

References:

  1. https://www.opengl.org/wiki/OpenGL_Context
  2. https://www.opengl.org/wiki/OpenGL_Object#Container_objects
Author
Leonid Kostrykin
Date
1.9.14 - 24.3.15

Definition at line 63 of file Mesh.h.

Constructor & Destructor Documentation

◆ MeshBase()

Carna::base::MeshBase::MeshBase ( const VertexAttributes va,
Association< VertexBufferBase > *  vertexBuffer,
Association< IndexBufferBase > *  indexBuffer 
)

Creates new mesh. It is only valid within the current OpenGL context.

Postcondition
&GLContext::current() == &glContext

◆ ~MeshBase()

virtual Carna::base::MeshBase::~MeshBase ( )
virtual

Deletes.

Precondition
&GLContext::current() == &glContext

Member Function Documentation

◆ bind()

void Carna::base::MeshBase::bind ( ) const

Binds the vertex array object.

Precondition
&GLContext::current() == &glContext

◆ render()

void Carna::base::MeshBase::render ( ) const

Renders the mesh.

Precondition
&GLContext::current() == &glContext

The documentation for this class was generated from the following file: