/* QGLView Copyright (C) 2012 Ivan Pelipenko peri4ko@gmail.com This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef GLVBO_H #define GLVBO_H #include "gltypes.h" class GLVBO { friend class GLObjectBase; public: GLVBO(GLenum usage = GL_DYNAMIC_DRAW); ~GLVBO(); //GLVBO & operator =(const GLVBO & o) {return *this;} void init(); void destroy() {deleteGLBuffer(buffer_);} bool rebuffer(bool clear_ = false); void draw(GLenum type, bool simplest = false); void clear(); GLuint buffer() const {return buffer_;} int verticesCount() const {return vert_count;} bool isIinit() const {return buffer_ != 0;} bool isEmpty() const {return vert_count == 0;} QVector & vertices() {changed = true; return vertices_;} QVector & normals() {changed = true; return normals_;} QVector & texcoords() {changed = true; return texcoords_;} QVector & colors() {changed = true; return colors_;} bool saveToFile(const QString & filename); bool loadFromFile(const QString & filename); private: QVector vertices_, normals_, texcoords_, colors_; GLenum usage; GLuint buffer_; int vert_count; bool changed, has_normals, has_texcoords, has_colors; }; #endif // GLVBO_H