1
git-svn-id: svn://db.shs.com.ru/libs@1 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
61
qglview/glvbo.h
Normal file
61
qglview/glvbo.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
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
|
||||
Reference in New Issue
Block a user