This repository has been archived on 2020-09-07. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
libs/qglview/glvbo.h
Бычков Андрей ba8bc27298 1
git-svn-id: svn://db.shs.com.ru/libs@1 a8b55f48-bf90-11e4-a774-851b48703e85
2015-02-28 21:28:53 +00:00

62 lines
1.8 KiB
C++

/*
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 <http://www.gnu.org/licenses/>.
*/
#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<GLfloat> & vertices() {changed = true; return vertices_;}
QVector<GLfloat> & normals() {changed = true; return normals_;}
QVector<GLfloat> & texcoords() {changed = true; return texcoords_;}
QVector<GLfloat> & colors() {changed = true; return colors_;}
bool saveToFile(const QString & filename);
bool loadFromFile(const QString & filename);
private:
QVector<GLfloat> vertices_, normals_, texcoords_, colors_;
GLenum usage;
GLuint buffer_;
int vert_count;
bool changed, has_normals, has_texcoords, has_colors;
};
#endif // GLVBO_H