sincerely Singaporean

If you have not done so, read this full tutorial on how to use SGEXTN to build an application.

SGRCommandRequest

see header file

see source file

class SGRCommandRequest;

part of SGEXTN module SG_RI

class allowing draw commands to be sent to the GPU

detailed description

list of all including inherited members

implementation details

preprocessor file inclusion directive: #include ‹SGRCommandRequest.h›

CMake target for BuildLah: SGEXTN::SG_RI

see this link for more information about BuildLah

parent class: (none)

children classes: (none)

instance member functions

void addVertexBufferObject(SGRVertexBufferObject *vbo, int bufferOffsetInBytes) const;

void chooseElementBufferObject(SGRElementBufferObject* ebo);

void drawTriangles(int numberOfTriangles, int startLocation) const;

void finaliseForDraw();

Detailed Description

SGRCommandRequest allows SG - RI ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ renderers to send draw commands to the GPU. This is only provided in SGRBaseRenderer::requestRenderCommands and attempting to cache it for use at another time is undefined behaviour.

Implementation Details

SG - RI ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ internally uses QRhi, SGRCommandRequest wraps QRhiCommandBuffer.

void addVertexBufferObject(SGRVertexBufferObject *vbo, int bufferOffsetInBytes) const;

Adds the vertex buffer object vbo starting at bufferOffsetInBytes bytes into the buffer. Data before the bufferOffsetInBytes is ignored. Vertex buffer objects are added sequentially, so the first added vertex buffer object will have a binding point of 0, the second added vertex buffer object will have a binding point of 1, etc.

SG - RI ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ permits binding multiple vertex buffer objects.

Out of bounds offset will cause a crash.

void chooseElementBufferObject(SGRElementBufferObject* ebo);

Selects ebo to be used for the next draw command. If you want to only use the element buffer object starting at a certain index, set that in SGRCommandRequest::drawTriangles.

SG - RI ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ forces you to use a element buffer object even if it is not really needed.

Specify the offset into the element buffer object inside SGRCommandRequest::drawTriangles.

void drawTriangles(int numberOfTriangles, int startLocation) const;

Draws numberOfTriangles triangles using indices found in the chosen element buffer object starting at startLocation bytes into the buffer.

Drawing other shapes is not supported by SG - RI ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾, for rectangles, simply use 2 triangles.

This will crash if SGRCommandRequest::finaliseForDraw has not yet been called.

void finaliseForDraw();

Prepares the vertex buffer objects added using SGRCommandRequest::addVertexBufferObject and the element buffer object selected using SGRCommandRequest::chooseElementBufferObject for drawing.

Forgetting to bind vertex buffer objects and a element buffer object will crash.

Adding more vertex buffer objects or changing the element buffer object after this is called is undefined behaviour.

©2025 05524F.sg (Singapore)

contact 05524F / report a bug / make a suggestion

about 05524F SINGAPORE values

list of 05524F projects