glvertexarray.h File Reference

Go to the documentation of this file. Source: include/ffw/graphics/glvertexarray.h

/* This file is part of FineFramework project */
#ifndef FFW_GRAPHICS_GL_VERTEX_ARRAY
#define FFW_GRAPHICS_GL_VERTEX_ARRAY

#include <vector>
#include <cstdint>
#include "glrenderextensions.h"

namespace ffw {
    class RenderContext;
    class FFW_API GLVertexArray {
    public:
        GLVertexArray();
        GLVertexArray(bool create);
        GLVertexArray(const GLVertexArray& other) = delete;
        GLVertexArray(GLVertexArray&& other) NOEXCEPT;
        void swap(GLVertexArray& other) NOEXCEPT;

        virtual ~GLVertexArray();
        inline bool isCreated() const {
            return buffer != 0;
        }
        void destroy();
        void bind() const;
        void unbind() const;
        inline GLuint getHandle() const {
            return buffer;
        }
        void enableVertexAttribArray(GLint location) const;
        void disableVertexAttribArray(GLint location) const;
        void setAttributePointerf(GLint location, GLint size, GLsizei stride, const GLvoid* offset) const;
        void setAttributeDivisor(GLuint index, GLuint divisor) const;
        
        GLVertexArray& operator = (const GLVertexArray& other) = delete;
        GLVertexArray& operator = (GLVertexArray&& other) NOEXCEPT;
    protected:
        GLuint buffer;
    };
};

inline void swap(ffw::GLVertexArray& first, ffw::GLVertexArray& second) NOEXCEPT {
    first.swap(second);
}
#endif