HDK
|
#include <GlslRenderer.h>
Public Member Functions | |
ImageHandlerPtr | createImageHandler (ImageLoaderPtr imageLoader) |
Create a texture handler for OpenGL textures. More... | |
virtual | ~GlslRenderer () |
Destructor. More... | |
Setup | |
void | initialize (RenderContextHandle renderContextHandle=nullptr) override |
Rendering | |
void | createProgram (ShaderPtr shader) override |
void | createProgram (const StageMap &stages) override |
void | validateInputs () override |
Validate inputs for the program. More... | |
void | updateUniform (const string &name, ConstValuePtr value) override |
Update the program with value of the uniform. More... | |
void | setSize (unsigned int width, unsigned int height) override |
Set the size of the rendered image. More... | |
void | render () override |
Render the current program to an offscreen buffer. More... | |
void | renderTextureSpace (const Vector2 &uvMin, const Vector2 &uvMax) |
Render the current program in texture space to an off-screen buffer. More... | |
Utilities | |
ImagePtr | captureImage (ImagePtr image=nullptr) override |
Capture the current contents of the off-screen hardware buffer as an image. More... | |
GLFramebufferPtr | getFramebuffer () const |
Return the GL frame buffer. More... | |
GlslProgramPtr | getProgram () |
Return the GLSL program. More... | |
void | drawScreenSpaceQuad (const Vector2 &uvMin=Vector2(0.0f), const Vector2 &uvMax=Vector2(1.0f)) |
Submit geometry for a screen-space quad. More... | |
void | setScreenColor (const Color3 &screenColor) |
Set the screen background color. More... | |
Color3 | getScreenColor () const |
Return the screen background color. More... | |
Public Member Functions inherited from ShaderRenderer | |
virtual | ~ShaderRenderer () |
void | setCamera (CameraPtr camera) |
Set the camera. More... | |
CameraPtr | getCamera () const |
Return the camera. More... | |
void | setImageHandler (ImageHandlerPtr imageHandler) |
Set the image handler used by this renderer for image I/O. More... | |
ImageHandlerPtr | getImageHandler () const |
Return the image handler. More... | |
void | setLightHandler (LightHandlerPtr lightHandler) |
Set the light handler used by this renderer for light bindings. More... | |
LightHandlerPtr | getLightHandler () const |
Return the light handler. More... | |
void | setGeometryHandler (GeometryHandlerPtr geometryHandler) |
Set the geometry handler. More... | |
GeometryHandlerPtr | getGeometryHandler () const |
Return the geometry handler. More... | |
Static Public Member Functions | |
static GlslRendererPtr | create (unsigned int width=512, unsigned int height=512, Image::BaseType baseType=Image::BaseType::UINT8) |
Create a GLSL renderer instance. More... | |
Protected Member Functions | |
GlslRenderer (unsigned int width, unsigned int height, Image::BaseType baseType) | |
Protected Member Functions inherited from ShaderRenderer | |
ShaderRenderer (unsigned int width, unsigned int height, Image::BaseType baseType, MatrixConvention matrixConvention=MatrixConvention::OpenGL) | |
Additional Inherited Members | |
Public Types inherited from ShaderRenderer | |
enum | MatrixConvention { MatrixConvention::OpenGL = 0, MatrixConvention::Metal = 1 } |
Viewing API matrix conventions designation (default to OpenGL). More... | |
using | StageMap = StringMap |
A map with name and source code for each shader stage. More... | |
Protected Attributes inherited from ShaderRenderer | |
unsigned int | _width |
unsigned int | _height |
Image::BaseType | _baseType |
MatrixConvention | _matrixConvention |
CameraPtr | _camera |
ImageHandlerPtr | _imageHandler |
GeometryHandlerPtr | _geometryHandler |
LightHandlerPtr | _lightHandler |
Helper class for rendering generated GLSL code to produce images.
There are two main interfaces which can be used. One which takes in a HwShader and one which allows for explicit setting of shader stage code.
The main services provided are:
Definition at line 42 of file GlslRenderer.h.
|
inlinevirtual |
Destructor.
Definition at line 55 of file GlslRenderer.h.
|
protected |
Capture the current contents of the off-screen hardware buffer as an image.
Reimplemented from ShaderRenderer.
|
static |
Create a GLSL renderer instance.
|
inline |
Create a texture handler for OpenGL textures.
Definition at line 49 of file GlslRenderer.h.
Create GLSL program based on an input shader
shader | Input HwShader |
Reimplemented from ShaderRenderer.
Create GLSL program based on shader stage source code.
stages | Map of name and source code for the shader stages. |
Reimplemented from ShaderRenderer.
void GlslRenderer::drawScreenSpaceQuad | ( | const Vector2 & | uvMin = Vector2(0.0f) , |
const Vector2 & | uvMax = Vector2(1.0f) |
||
) |
Submit geometry for a screen-space quad.
|
inline |
Return the GL frame buffer.
Definition at line 102 of file GlslRenderer.h.
|
inline |
Return the GLSL program.
Definition at line 108 of file GlslRenderer.h.
|
inline |
Return the screen background color.
Definition at line 123 of file GlslRenderer.h.
|
overridevirtual |
Internal initialization of stages and OpenGL constructs required for program validation and rendering. An exception is thrown on failure. The exception will contain a list of initialization errors.
renderContextHandle | allows initializing the GlslRenderer with a Shared OpenGL Context |
Reimplemented from ShaderRenderer.
|
overridevirtual |
Render the current program to an offscreen buffer.
Reimplemented from ShaderRenderer.
Render the current program in texture space to an off-screen buffer.
Set the screen background color.
Definition at line 117 of file GlslRenderer.h.
Set the size of the rendered image.
Reimplemented from ShaderRenderer.
|
overridevirtual |
Update the program with value of the uniform.
Reimplemented from ShaderRenderer.
|
overridevirtual |
Validate inputs for the program.
Reimplemented from ShaderRenderer.