QBuffer Class

(Qt3DRender::QBuffer)

Provides a data store for raw data to later be used as vertices or uniforms. More...

Header: #include <QBuffer>
qmake: QT += 3drender
Instantiated By: Buffer
Inherits: Qt3DCore::QNode

Public Types

enum BufferType { VertexBuffer, IndexBuffer, PixelPackBuffer, PixelUnpackBuffer, UniformBuffer, ShaderStorageBuffer }
enum UsageType { StreamDraw, StreamRead, StreamCopy, StaticDraw, ..., DynamicCopy }

Properties

Public Functions

QBuffer(BufferType ty = QBuffer::VertexBuffer, Qt3DCore::QNode *parent = nullptr)
QByteArray data() const
QBufferDataGeneratorPtr dataGenerator() const
bool isSyncData() const
void setData(const QByteArray &bytes)
void setDataGenerator(const QBufferDataGeneratorPtr &functor)
BufferType type() const
UsageType usage() const

Public Slots

void setSyncData(bool syncData)
void setType(BufferType type)
void setUsage(UsageType usage)

Signals

void dataChanged(const QByteArray &bytes)
void syncDataChanged(bool syncData)
void typeChanged(BufferType type)
void usageChanged(UsageType usage)

Additional Inherited Members

  • 1 public variable inherited from QObject
  • 10 static public members inherited from QObject
  • 2 protected functions inherited from Qt3DCore::QNode
  • 9 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

Provides a data store for raw data to later be used as vertices or uniforms.

Data can either be provided directly using QBuffer::setData() or by specifying a generator with QBuffer::setDataGenerator() and providing a Qt3DRender::QBufferDataGeneratorPtr.

When using a generator the data will be loaded asynchronously in a job. The loaded data can be read back if the QBuffer::syncData flag is set to true.

Member Type Documentation

enum QBuffer::BufferType

The type of the buffer.

ConstantValueDescription
Qt3DRender::QBuffer::VertexBuffer0x8892GL_ARRAY_BUFFER
Qt3DRender::QBuffer::IndexBuffer0x8893GL_ELEMENT_ARRAY_BUFFER
Qt3DRender::QBuffer::PixelPackBuffer0x88EBGL_PIXEL_PACK_BUFFER
Qt3DRender::QBuffer::PixelUnpackBuffer0x88ECGL_PIXEL_UNPACK_BUFFER
Qt3DRender::QBuffer::UniformBuffer0x8A11GL_UNIFORM_BUFFER
Qt3DRender::QBuffer::ShaderStorageBuffer0x90D2GL_SHADER_STORAGE_BUFFER

enum QBuffer::UsageType

The type of the usage.

ConstantValueDescription
Qt3DRender::QBuffer::StreamDraw0x88E0GL_STREAM_DRAW
Qt3DRender::QBuffer::StreamRead0x88E1GL_STREAM_READ
Qt3DRender::QBuffer::StreamCopy0x88E2GL_STREAM_COPY
Qt3DRender::QBuffer::StaticDraw0x88E4GL_STATIC_DRAW
Qt3DRender::QBuffer::StaticRead0x88E5GL_STATIC_READ
Qt3DRender::QBuffer::StaticCopy0x88E6GL_STATIC_COPY
Qt3DRender::QBuffer::DynamicDraw0x88E8GL_DYNAMIC_DRAW
Qt3DRender::QBuffer::DynamicRead0x88E9GL_DYNAMIC_READ
Qt3DRender::QBuffer::DynamicCopy0x88EAGL_DYNAMIC_COPY

Property Documentation

syncData : bool

Holds the syncData flag. When syncData is true, this will force data created by a Qt3DRender::QBufferDataGenerator to also be updated on the frontend Qt3DRender::QBuffer node. By default syncData is false.

Note: : This has no effect if the buffer's data was set directly using the data property.

Access functions:

bool isSyncData() const
void setSyncData(bool syncData)

Notifier signal:

void syncDataChanged(bool syncData)

type : BufferType

Holds the buffer type.

Access functions:

BufferType type() const
void setType(BufferType type)

Notifier signal:

void typeChanged(BufferType type)

usage : UsageType

Holds the buffer usage.

Access functions:

UsageType usage() const
void setUsage(UsageType usage)

Notifier signal:

void usageChanged(UsageType usage)

Member Function Documentation

QBuffer::QBuffer(BufferType ty = QBuffer::VertexBuffer, Qt3DCore::QNode *parent = nullptr)

Default constructs an instance of QBuffer.

QByteArray QBuffer::data() const

Returns the data.

See also setData().

[signal] void QBuffer::dataChanged(const QByteArray &bytes)

This signal is emitted with bytes when data changes.

QBufferDataGeneratorPtr QBuffer::dataGenerator() const

Returns the buffer functor.

See also setDataGenerator().

void QBuffer::setData(const QByteArray &bytes)

Sets bytes as data.

See also data().

void QBuffer::setDataGenerator(const QBufferDataGeneratorPtr &functor)

Sets the buffer functor.

See also dataGenerator().