class EE::Graphics::VertexBufferOGL

Overview

The Vertex Buffer OGL is the implementation of a Vertex Buffer without using the specific VBOs extensions from OpenGL. More…

#include <vertexbufferogl.hpp>

class VertexBufferOGL: public EE::Graphics::VertexBuffer {
public:
    // construction

    VertexBufferOGL(const Uint32& vertexFlags = VERTEX_FLAGS_DEFAULT, PrimitiveType drawType = PRIMITIVE_QUADS, const Int32& reserveVertexSize = 0, const Int32& reserveIndexSize = 0, VertexBufferUsageType usageType = VertexBufferUsageType::Static);

    // methods

    virtual void bind();
    virtual void draw();
    virtual bool compile();
    virtual void update(const Uint32& types, bool indices);
    virtual void reload();
    virtual void unbind();
};

Inherited Members

public:
    // methods

    static VertexBuffer* New(const Uint32& vertexFlags = VERTEX_FLAGS_DEFAULT, PrimitiveType drawType = PRIMITIVE_QUADS, const Int32& reserveVertexSize = 0, const Int32& reserveIndexSize = 0, VertexBufferUsageType usageType = VertexBufferUsageType::Static);
    static VertexBuffer* NewVertexArray(const Uint32& vertexFlags = VERTEX_FLAGS_DEFAULT, PrimitiveType drawType = PRIMITIVE_QUADS, const Int32& reserveVertexSize = 0, const Int32& reserveIndexSize = 0, VertexBufferUsageType usageType = VertexBufferUsageType::Static);
    void addVertex(const Uint32& type, const Vector2f& vertex);
    void addVertex(const Vector2f& vertex);
    void addTextureCoord(const Vector2f& vertexCoord, const Uint32& textureLevel = 0);
    void addColor(const Color& color);
    void addIndex(const Uint32& indexValue);
    void setVertex(const Uint32& index, const Uint32& type, const Vector2f& vertex);
    void setVertex(const Uint32& index, const Vector2f& vertex);
    void setTextureCoord(const Uint32& index, const Vector2f& vertexCoord, const Uint32& textureLevel = 0);
    void setColor(const Uint32& index, const Color& color);
    void setIndex(const Uint32& index, const Uint32& indexValue);
    void resizeArray(const Uint32& type, const Uint32& size);
    void resizeIndices(const Uint32& size);
    void addQuad(const Vector2f& pos, const Sizef& size, const Color& color);
    void setQuad(const Vector2u& gridPos, const Vector2f& pos, const Sizef& size, const Color& color);
    void setQuadColor(const Vector2u& gridPos, const Color& color);
    void setQuadFree(const Vector2u& gridPos, const Vector2f& pos0, const Vector2f& pos1, const Vector2f& pos2, const Vector2f& pos3, const Color& color);
    void setQuadTexCoords(const Vector2u& gridPos, const Rectf& coords, const Uint32& textureLevel);
    void setGridSize(const Sizei& size);
    std::vector<Vector2f>& getPositionArray();
    std::vector<Color>& getColorArray();
    std::vector<Uint32>& getIndices();
    std::vector<Vector2f>& getTextureCoordArray(const Uint32& textureLevel);
    Uint32 getVertexCount();
    Uint32 getIndexCount();
    Color getColor(const Uint32& index);
    Uint32 getIndex(const Uint32& index);
    void setElementNum(Int32 num);
    const Int32& getElementNum() const;
    virtual void bind() = 0;
    virtual void unbind() = 0;
    virtual void draw() = 0;
    virtual bool compile() = 0;
    virtual void update(const Uint32& types, bool indices) = 0;
    virtual void reload() = 0;
    virtual void clear();

Detailed Documentation

The Vertex Buffer OGL is the implementation of a Vertex Buffer without using the specific VBOs extensions from OpenGL.

See also:

VertexBuffer

Methods

virtual void bind()

Activates the vertex buffer.

virtual void draw()

Draw the vertex buffer.

virtual bool compile()

Compile the vertex buffer. After adding all the vertex buffer data Compile() must be called to upload the data to the GPU.

virtual void update(const Uint32& types, bool indices)

Update is used in the case of some data is modified and need to be reuploaded to the GPU.

virtual void reload()

Reupload all the data to the GPU.

virtual void unbind()

Deactivates the vertex buffer.