summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@trolltech.com>2010-03-18 06:03:57 (GMT)
committerGunnar Sletta <gunnar@trolltech.com>2010-03-22 13:05:36 (GMT)
commit92806ba63ed159ed082083fbbfb2478428a1b8a2 (patch)
tree3191e557da0cd055d7da82c67a404ade1b5a9092
parent58e9855afce71448c709469270950e5add87d601 (diff)
downloadQt-92806ba63ed159ed082083fbbfb2478428a1b8a2.zip
Qt-92806ba63ed159ed082083fbbfb2478428a1b8a2.tar.gz
Qt-92806ba63ed159ed082083fbbfb2478428a1b8a2.tar.bz2
Added warnings on non-created buffer in QGLBuffer
Reviewed-by: Rhys Weatherley
-rw-r--r--src/opengl/qglbuffer.cpp24
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)