![]() |
Scanframe Modular Application 0.1.0
|
OpenGL base class and wrapper for vertex arrays. More...
#include <VertexArray.h>


Public Types | |
| typedef GLuint | handle_type |
| Type for the handle of the vertex array. | |
Public Types inherited from sf::xgl::VertexArrayBase | |
| enum | EVertexMember : VertexMember { vmPosition = 1 << 0 , vmNormal = 1 << 1 , vmColor = 1 << 2 , vmTexCoord = 1 << 3 } |
| Possible member of a vertex structure. Where the position cannot be omitted as part of the vertex. More... | |
| enum | EDrawMode { dmDrawArrays , dmDrawElements } |
| Drawing mode of by the template. More... | |
| enum | ERenderOption : int { roNone = 0 , roWires = 1 << 0 , roNormals = 1 << 1 } |
| Render options. More... | |
| typedef unsigned | VertexMember |
| Type used to describe vertex structure members. | |
| typedef TVector< std::pair< vector3f, vector3f > > | NormalsDataType |
| Type for extracting normals from all used vertices. | |
Public Member Functions | |
| VertexArray (ShaderProgram *sp) | |
| Constructor. | |
| ~VertexArray () override | |
| Virtual destructor. | |
| bool | setup () override |
| Sets up the vertex array for the OpenGL context. | |
| void | draw () override |
| Draws the vertex array. Specifically called from the paintGL() function of the OpenGL widget. | |
| void | paint () override |
| Paints the object old style OpenGL. | |
Public Member Functions inherited from sf::xgl::VertexArrayBase | |
| VertexArrayBase (QOpenGLShaderProgram *parent) | |
| Default Qt object constructor. When the shader program is deleted, all vertex arrays referencing it should also be deleted. | |
| virtual bool | hasColor () const =0 |
| Determines if Vertex has a color component. | |
| virtual bool | hasTexture () const =0 |
| Determines if Vertex has a texture mapping component. | |
| virtual NormalsDataType | getNormalsData () const =0 |
| Gets the information from the vertices to make normals visible. | |
| void | triggerGenerate () |
| Sets a flag to trigger data generation when the data is called for. | |
| void | setRenderOptions (RenderOptions options) |
| Modify the render options which will trigger a regeneration of the vertices and indices. | |
| RenderOptions | getRenderOptions () const |
| Gets the render options. | |
Protected Member Functions | |
| virtual bool | doCreate ()=0 |
| Method to be overridden by a derived class. | |
| virtual void | doDraw ()=0 |
| Method to be overridden by a derived class. Called when the handle is valid from the draw() function. | |
| virtual void | doPaint ()=0 |
| Method to be overridden by a derived class. | |
| ShaderProgram * | shaderProgram () |
| Gets the associated shader program. | |
| template<typename VertexType , typename FieldType > | |
| void | setAttribPointer (ShaderProgram::Attribute sa, size_t offset) |
| Makes a call to glVertexAttribPointer() in a smart way. | |
Protected Member Functions inherited from sf::xgl::VertexArrayBase | |
| virtual void | clearData ()=0 |
| Clears the data to generate array buffers. | |
| bool | callGenerate () |
| Makes a call to virtual function generate() when the _triggerGenerate flag is set using triggerGenerate(). | |
| virtual void | generate ()=0 |
| Generate the data needed for the creation of a vertex-array and/or indices. Is or must be called by setup() function. | |
| virtual void | modifyContext (bool before, bool draw, size_t mode_index) |
| Allows modifying the OpenGL context before and after drawing. | |
| bool | isTriggered () const |
| Gets the flag if data is to be (re-)generated. Flag is set to True initially. | |
Additional Inherited Members | |
Static Public Member Functions inherited from sf::xgl::VertexArrayBase | |
| static const Color & | getDefaultColor () |
| Gets the default color used by the vertex structures when not set by the derived class. Created to have a single location for the default color. An example of how it is used: | |
| static void | setDefaultColor (const QColor &color) |
| Sets the default color used by the vertex structures when not set by the derived class. | |
OpenGL base class and wrapper for vertex arrays.
| typedef GLuint sf::xgl::VertexArray::handle_type |
Type for the handle of the vertex array.
|
explicit |
Constructor.
|
override |
Virtual destructor.
|
protectedpure virtual |
Method to be overridden by a derived class.
|
protectedpure virtual |
Method to be overridden by a derived class. Called when the handle is valid from the draw() function.
|
protectedpure virtual |
Method to be overridden by a derived class.
|
overridevirtual |
Draws the vertex array. Specifically called from the paintGL() function of the OpenGL widget.
Implements sf::xgl::VertexArrayBase.
|
overridevirtual |
Paints the object old style OpenGL.
Implements sf::xgl::VertexArrayBase.
|
protected |
Makes a call to glVertexAttribPointer() in a smart way.
| VertexType | The vertex structure. |
| FieldType | Structure field which is a std::array<> having a 'value_type'. |
| sa | Shader attribute. |
| offset |
|
overridevirtual |
Sets up the vertex array for the OpenGL context.
Implements sf::xgl::VertexArrayBase.
|
protected |
Gets the associated shader program.