123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- #ifndef QGLBUFFER_H
- #define QGLBUFFER_H
- #include <QtCore/qscopedpointer.h>
- #include <QtOpenGL/qgl.h>
- QT_BEGIN_NAMESPACE
- class QGLBufferPrivate;
- class Q_OPENGL_EXPORT QGLBuffer
- {
- public:
- enum Type
- {
- VertexBuffer = 0x8892,
- IndexBuffer = 0x8893,
- PixelPackBuffer = 0x88EB,
- PixelUnpackBuffer = 0x88EC
- };
- QGLBuffer();
- explicit QGLBuffer(QGLBuffer::Type type);
- QGLBuffer(const QGLBuffer &other);
- ~QGLBuffer();
- QGLBuffer &operator=(const QGLBuffer &other);
- enum UsagePattern
- {
- StreamDraw = 0x88E0,
- StreamRead = 0x88E1,
- StreamCopy = 0x88E2,
- StaticDraw = 0x88E4,
- StaticRead = 0x88E5,
- StaticCopy = 0x88E6,
- DynamicDraw = 0x88E8,
- DynamicRead = 0x88E9,
- DynamicCopy = 0x88EA
- };
- enum Access
- {
- ReadOnly = 0x88B8,
- WriteOnly = 0x88B9,
- ReadWrite = 0x88BA
- };
- QGLBuffer::Type type() const;
- QGLBuffer::UsagePattern usagePattern() const;
- void setUsagePattern(QGLBuffer::UsagePattern value);
- bool create();
- bool isCreated() const;
- void destroy();
- bool bind();
- void release();
- static void release(QGLBuffer::Type type);
- GLuint bufferId() const;
- int size() const;
- bool read(int offset, void *data, int count);
- void write(int offset, const void *data, int count);
- void allocate(const void *data, int count);
- inline void allocate(int count) { allocate(Q_NULLPTR, count); }
- void *map(QGLBuffer::Access access);
- bool unmap();
- private:
- QGLBufferPrivate *d_ptr;
- Q_DECLARE_PRIVATE(QGLBuffer)
- };
- QT_END_NAMESPACE
- #endif
|