code format
This commit is contained in:
@@ -1,36 +1,36 @@
|
||||
/*
|
||||
QGL Buffer
|
||||
Ivan Pelipenko peri4ko@yandex.ru
|
||||
QGL Buffer
|
||||
Ivan Pelipenko peri4ko@yandex.ru
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser 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 free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
|
||||
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 Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <QOpenGLExtraFunctions>
|
||||
#include "glbuffer.h"
|
||||
|
||||
#include <QOpenGLExtraFunctions>
|
||||
|
||||
|
||||
Buffer::Buffer(GLenum target, GLenum _usage) {
|
||||
target_ = target;
|
||||
usage_ = _usage;
|
||||
buffer_ = 0;
|
||||
target_ = target;
|
||||
usage_ = _usage;
|
||||
buffer_ = 0;
|
||||
prev_size = 0;
|
||||
}
|
||||
|
||||
|
||||
Buffer::~Buffer() {
|
||||
}
|
||||
Buffer::~Buffer() {}
|
||||
|
||||
|
||||
void Buffer::init(QOpenGLExtraFunctions * f) {
|
||||
@@ -49,13 +49,13 @@ void Buffer::destroy(QOpenGLExtraFunctions * f) {
|
||||
|
||||
|
||||
void Buffer::reinit() {
|
||||
buffer_ = 0;
|
||||
buffer_ = 0;
|
||||
prev_size = 0;
|
||||
}
|
||||
|
||||
|
||||
void Buffer::bind(QOpenGLExtraFunctions * f) {
|
||||
//qDebug() << "bind" << target_ << buffer_;
|
||||
// qDebug() << "bind" << target_ << buffer_;
|
||||
f->glBindBuffer(target_, buffer_);
|
||||
}
|
||||
|
||||
@@ -78,10 +78,10 @@ void Buffer::unmap(QOpenGLExtraFunctions * f) {
|
||||
|
||||
bool Buffer::resize(QOpenGLExtraFunctions * f, int new_size) {
|
||||
if (new_size <= 0) return false;
|
||||
//qDebug() << "check resize buffer" << buffer_ << "bytes" << new_size << ", old =" << prev_size;
|
||||
// qDebug() << "check resize buffer" << buffer_ << "bytes" << new_size << ", old =" << prev_size;
|
||||
if (new_size <= prev_size) return false;
|
||||
prev_size = new_size;
|
||||
//qDebug() << "resize buffer " << buffer_ << target_ << "for" << new_size << "bytes";
|
||||
// qDebug() << "resize buffer " << buffer_ << target_ << "for" << new_size << "bytes";
|
||||
f->glBufferData(target_, new_size, 0, usage_);
|
||||
return true;
|
||||
}
|
||||
@@ -89,6 +89,6 @@ bool Buffer::resize(QOpenGLExtraFunctions * f, int new_size) {
|
||||
|
||||
void Buffer::load(QOpenGLExtraFunctions * f, const void * data, int size, int offset) {
|
||||
if (!data || size <= 0) return;
|
||||
//qDebug() << "load buffer" << buffer_ << "bytes" << size;
|
||||
// qDebug() << "load buffer" << buffer_ << "bytes" << size;
|
||||
f->glBufferSubData(target_, offset, size, data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user