diff options
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/qglbuffer.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/opengl/qglbuffer.cpp b/src/opengl/qglbuffer.cpp index 2ab7c32..755f34c 100644 --- a/src/opengl/qglbuffer.cpp +++ b/src/opengl/qglbuffer.cpp @@ -289,6 +289,10 @@ bool QGLBuffer::read(int offset, void *data, int count) */ void QGLBuffer::write(int offset, const void *data, int count) { +#ifndef QT_NO_DEBUG + if (!isCreated()) + qWarning("QGLBuffer::allocate(): buffer not created"); +#endif Q_D(QGLBuffer); if (d->guard.id()) glBufferSubData(d->type, offset, count, data); @@ -305,6 +309,10 @@ void QGLBuffer::write(int offset, const void *data, int count) */ void QGLBuffer::allocate(const void *data, int count) { +#ifndef QT_NO_DEBUG + if (!isCreated()) + qWarning("QGLBuffer::allocate(): buffer not created"); +#endif Q_D(QGLBuffer); if (d->guard.id()) glBufferData(d->type, count, data, d->actualUsagePattern); @@ -336,6 +344,10 @@ void QGLBuffer::allocate(const void *data, int count) */ bool QGLBuffer::bind() const { +#ifndef QT_NO_DEBUG + if (!isCreated()) + qWarning("QGLBuffer::bind(): buffer not created"); +#endif Q_D(const QGLBuffer); GLuint bufferId = d->guard.id(); if (bufferId) { @@ -364,6 +376,10 @@ bool QGLBuffer::bind() const */ void QGLBuffer::release() const { +#ifndef QT_NO_DEBUG + if (!isCreated()) + qWarning("QGLBuffer::release(): buffer not created"); +#endif Q_D(const QGLBuffer); if (d->guard.id()) glBindBuffer(d->type, 0); @@ -453,6 +469,10 @@ int QGLBuffer::size() const void *QGLBuffer::map(QGLBuffer::Access access) { Q_D(QGLBuffer); +#ifndef QT_NO_DEBUG + if (!isCreated()) + qWarning("QGLBuffer::map(): buffer not created"); +#endif if (!d->guard.id()) return 0; if (!glMapBufferARB) @@ -476,6 +496,10 @@ void *QGLBuffer::map(QGLBuffer::Access access) bool QGLBuffer::unmap() { Q_D(QGLBuffer); +#ifndef QT_NO_DEBUG + if (!isCreated()) + qWarning("QGLBuffer::unmap(): buffer not created"); +#endif if (!d->guard.id()) return false; if (!glUnmapBufferARB) |