sincerely
Singaporean
If you have not done so, read this full tutorial on how to use SGEXTN to build an application.
class SGRRenderingProgramme;
part of SGEXTN module SG_RI
provides interface for custom renderers to interact with the rendering pipeline
list of all including inherited members
preprocessor file inclusion directive: #include ‹SGRRenderingProgramme.h›
CMake target for BuildLah: SGEXTN::SG_RI
see this link for more information about BuildLah
parent class: (none)
children classes: (none)
SGRRenderingProgramme(SGRBaseRenderer* renderControl);
void addTexture(int shaderDeclaredBinding) const;
void addUniformBufferObject(int std140AlignedSize, int shaderDeclaredBinding) const;
void addVertexBufferObject(int vertexSize) const;
void addVertexProperty(int vertexBufferObjectIndex, int offsetFromVertexStart, int shaderDeclaredLocation, SGRGraphicsLanguageType::Type propertyType, int vectorLength) const;
void finaliseRenderingProgramme();
void finaliseShaderResource();
void finaliseVertices();
void setShaderQSBFiles(const SGXString& vertexShaderPath, const SGXString& fragmentShaderPath);
void updateDataBuffer(SGRDataBuffer* buffer, int startLocation, int dataSize, void* pointerToData) const;
void updateShaderUniforms(int shaderDeclaredBinding, int startLocation, int dataSize, void* pointerToData) const;
void updateTexture(int shaderDeclaredBinding, SGRImage* sourceImage) const;
SGRRenderingProgramme manages the shaders and rendering pipeline of SG - RI ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ renderers, and provides access to functions setting up the rendering pipeline and uploading shader data. Unlike any other GPU framework, this is not tedious at all and is accessible to even beginners.
SG - RI ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ internally uses QRhi.
Creates a SGRRenderingProgramme associated with the SG - RI ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ renderer renderControl.
renderControl owns this SGRRenderingProgramme and will delete it when no longer needed.
Passing nullptr to renderControl will crash.
Adds a texture attached to the binding point shaderDeclaredBinding.
The actual texture is internally managed by SG - RI ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾, images can be uploaded as SGRImage using SGRRenderingProgramme::updateTexture.
shaderDeclaredBinding not being in the shaders or wrong binding point being passed is undefined behaviour.
Adds a uniform buffer object with a size of std140AlignedSize bytes attached to the binding point shaderDeclaredBinding.
The actual buffer is internally managed by SG - RI ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾.
Binding point 0 is reserved for SG - RI ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ internal uniform buffer object, shaderDeclaredBinding being 0 will crash.
std140AlignedSize being wrong or not following std140 is undefined behaviour.
shaderDeclaredBinding not being in the shaders or wrong binding point being passed is undefined behaviour.
Adding a texture as a uniform buffer object is undefined behaviour.
Registers a vertex buffer object with each vertex having a size of vertexSize bytes.
This does not create anything, it only tells the SGRRenderingProgramme that such a vertex buffer object will be used later.
The index of vertex buffer objects corresponds to the order in which they are declared using SGRRenderingProgramme::addVertexBufferObject, with the first one having index 0.
Zero or negative vertexSize will crash.
Registers a vertex property corresponding to the in variable at location shaderDeclaredLocation in the input shader, which is sourced from vertex buffer object number vertexBufferObjectIndex at a offset of offsetFromVertexStart bytes. This vertex shader in variable contains vectorLength of the GLSL data type propertyType.
This does not create anything, it just tells the SGRRenderingProgramme how to interpret vertex buffer objects.
Forgetting to register any vertex shader in variable is undefined behaviour.
Forgetting to bind the vertex buffer object before drawing is undefined behaviour.
Passing a vertex buffer object that does not match the layout is undefined behaviour.
Registering a vertex property that does not exist in the vertex shader is undefined behaviour.
Negative offsetFromVertexStart will crash.
Negative vertexBufferObjectIndex will crash.
vectorLength below 1 or above 4 will crash.
Prepares the SGRRenderingProgramme for usage.
If any component of the SGRRenderingProgramme is not prepared yet, this will crash, but it will print a clear message telling you what need to be fixed.
Modifying the SGRRenderingProgramme after this has been called is undefined behaviour.
Using a SGRRenderingProgramme that has not been prepared yet will crash.
Calling this outside of SGRBaseRenderer::initialise is undefined behaviour.
Prepares textures and uniform buffer objects.
Adding more textures and uniform buffer objects after this has been called is undefined behaviour.
Completes registering vertex related properties.
Registering more vertex buffer objects or vertex properties after this has been called is undefined behaviour.
Sets this SGRRenderingProgramme to use the vertex shader at vertexShaderPath and the fragment shader at fragmentShaderPath.
The compiled shader must exist in the resource system. To ensure that, put the shader GLSL source code in the shaders folder. For more information about compiling and using shaders, see this tutorial.
Uploads dataSize bytes of data from pointerToData to an offset of startLocation bytes into the buffer buffer.
Using this outside of SGRBaseRenderer::uploadShaderData or SGRBaseRenderer::initialise is undefined behaviour.
buffer being nullptr will crash.
Negative startLocation or startLocation + dataSize - 1 being more than or equal to length of buffer will crash.
SGLArray or SGLVector where pointerToData came from having a byte length below dataSize is undefined behaviour.
pointerToData being nullptr will crash.
Uploads dataSize bytes of data from pointerToData to an offset of startLocation bytes into the uniform buffer object at binding point shaderDeclaredBinding.
Using this outside of SGRBaseRenderer::uploadShaderData or SGRBaseRenderer::initialise is undefined behaviour.
Nonexistent shaderDeclaredBinding will crash.
startLocation + dataSize being more than or equal to length of the uniform buffer object at shaderDeclaredBinding is undefined behaviour.
SGLArray or SGLVector where pointerToData came from having a byte length below dataSize is undefined behaviour.
pointerToData being nullptr will crash.
shaderDeclaredBinding being negative will crash.
startLocation being negative will crash.
dataSize being negative will crash.
Uploads sourceImage to the texture at shaderDeclaredBinding.
sourceImage does not need to have the same size as the previously bound texture.
sourceImage is uploaded to the GPU every time this function is used. To swap between multiple textures, consider creating separate SGRRendererWidget for them and using SGWWidget::setItemVisibility to control the active SGWidget ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾.
Using this outside of SGRBaseRenderer::uploadShaderData or SGRBaseRenderer::initialise is undefined behaviour.
Nonexistent shaderDeclaredBinding will crash.
shaderDeclaredBinding being negative will crash.
sourceImage being nullptr will crash.
©2025 05524F.sg (Singapore)