6#ifndef MATERIALX_GLSLRENDERER_H
7#define MATERIALX_GLSLRENDERER_H
20MATERIALX_NAMESPACE_BEGIN
23using SimpleWindowPtr = std::shared_ptr<class SimpleWindow>;
46 static GlslRendererPtr create(
unsigned int width = 512,
unsigned int height = 512, Image::BaseType baseType = Image::BaseType::UINT8);
51 return GLTextureHandler::create(imageLoader);
86 void setSize(
unsigned int width,
unsigned int height)
override;
119 _screenColor = screenColor;
131 GlslRenderer(
unsigned int width,
unsigned int height, Image::BaseType baseType);
134 GlslProgramPtr _program;
139 SimpleWindowPtr _window;
144MATERIALX_NAMESPACE_END
std::shared_ptr< class GLContext > GLContextPtr
GLContext shared pointer.
Definition: GLContext.h:37
OpenGL framebuffer handling.
std::shared_ptr< GLFramebuffer > GLFramebufferPtr
Shared pointer to a GLFramebuffer.
Definition: GLFramebuffer.h:21
std::shared_ptr< class GlslRenderer > GlslRendererPtr
Shared pointer to a GlslRenderer.
Definition: GlslRenderer.h:26
shared_ptr< Image > ImagePtr
A shared pointer to an image.
Definition: Image.h:23
std::shared_ptr< ImageLoader > ImageLoaderPtr
Shared pointer to an ImageLoader.
Definition: ImageHandler.h:35
std::shared_ptr< ImageHandler > ImageHandlerPtr
Shared pointer to an ImageHandler.
Definition: ImageHandler.h:32
shared_ptr< Shader > ShaderPtr
Shared pointer to a Shader.
Definition: Library.h:34
Macros for declaring imported and exported symbols.
Base class for shader rendering.
void * RenderContextHandle
Render context handle Provides a provision for an application to share any renderer specific settings...
Definition: ShaderRenderer.h:23
shared_ptr< const Value > ConstValuePtr
A shared pointer to a const Value.
Definition: Value.h:31
A three-component color value.
Definition: Types.h:342
Helper class for rendering generated GLSL code to produce images.
Definition: GlslRenderer.h:43
void validateInputs() override
Validate inputs for the program.
Color3 getScreenColor() const
Return the screen background color.
Definition: GlslRenderer.h:123
void setScreenColor(const Color3 &screenColor)
Set the screen background color.
Definition: GlslRenderer.h:117
void updateUniform(const string &name, ConstValuePtr value) override
Update the program with value of the uniform.
static GlslRendererPtr create(unsigned int width=512, unsigned int height=512, Image::BaseType baseType=Image::BaseType::UINT8)
Create a GLSL renderer instance.
void drawScreenSpaceQuad(const Vector2 &uvMin=Vector2(0.0f), const Vector2 &uvMax=Vector2(1.0f))
Submit geometry for a screen-space quad.
void createProgram(ShaderPtr shader) override
Create GLSL program based on an input shader.
GLFramebufferPtr getFramebuffer() const
Return the GL frame buffer.
Definition: GlslRenderer.h:102
GlslProgramPtr getProgram()
Return the GLSL program.
Definition: GlslRenderer.h:108
ImageHandlerPtr createImageHandler(ImageLoaderPtr imageLoader)
Create a texture handler for OpenGL textures.
Definition: GlslRenderer.h:49
void render() override
Render the current program to an offscreen buffer.
void renderTextureSpace(const Vector2 &uvMin, const Vector2 &uvMax)
Render the current program in texture space to an off-screen buffer.
ImagePtr captureImage(ImagePtr image=nullptr) override
Capture the current contents of the off-screen hardware buffer as an image.
virtual ~GlslRenderer()
Destructor.
Definition: GlslRenderer.h:55
void createProgram(const StageMap &stages) override
Create GLSL program based on shader stage source code.
void initialize(RenderContextHandle renderContextHandle=nullptr) override
Internal initialization of stages and OpenGL constructs required for program validation and rendering...
void setSize(unsigned int width, unsigned int height) override
Set the size of the rendered image.
Base class for renderers that generate shader code to produce images.
Definition: ShaderRenderer.h:31
StringMap StageMap
A map with name and source code for each shader stage.
Definition: ShaderRenderer.h:40
A vector of two floating-point values.
Definition: Types.h:286