MaterialX 1.38.2
GLFramebuffer.h
Go to the documentation of this file.
1//
2// TM & (c) 2017 Lucasfilm Entertainment Company Ltd. and Lucasfilm Ltd.
3// All rights reserved. See LICENSE.txt for license.
4//
5
6#ifndef MATERIALX_GLFRAMEBUFFER_H
7#define MATERIALX_GLFRAMEBUFFER_H
8
11
13
15
16namespace MaterialX
17{
18
19class GLFramebuffer;
20
22using GLFrameBufferPtr = std::shared_ptr<GLFramebuffer>;
23
26class MX_RENDERGLSL_API GLFramebuffer
27{
28 public:
30 static GLFrameBufferPtr create(unsigned int width, unsigned int height, unsigned int channelCount, Image::BaseType baseType);
31
33 virtual ~GLFramebuffer();
34
36 void resize(unsigned int width, unsigned int height);
37
40 void setEncodeSrgb(bool encode)
41 {
42 _encodeSrgb = encode;
43 }
44
47 {
48 return _encodeSrgb;
49 }
50
52 void bind();
53
55 void unbind();
56
58 unsigned int getColorTexture() const
59 {
60 return _colorTexture;
61 }
62
64 unsigned int getDepthTexture() const
65 {
66 return _depthTexture;
67 }
68
72 ImagePtr getColorImage(ImagePtr image = nullptr);
73
75 void blit();
76
77 protected:
78 GLFramebuffer(unsigned int width, unsigned int height, unsigned int channelCount, Image::BaseType baseType);
79
80 protected:
81 unsigned int _width;
82 unsigned int _height;
83 unsigned int _channelCount;
84 Image::BaseType _baseType;
85 bool _encodeSrgb;
86
87 unsigned int _frameBuffer;
88 unsigned int _colorTexture;
89 unsigned int _depthTexture;
90};
91
92} // namespace MaterialX
93
94#endif
std::shared_ptr< GLFramebuffer > GLFrameBufferPtr
Shared pointer to a GLFramebuffer.
Definition: GLFramebuffer.h:22
shared_ptr< Image > ImagePtr
A shared pointer to an image.
Definition: Image.h:24
Image handler interfaces.
Macros for declaring imported and exported symbols.
Wrapper for an OpenGL framebuffer.
Definition: GLFramebuffer.h:27
void setEncodeSrgb(bool encode)
Set the encode sRGB flag, which controls whether values written to the framebuffer are encoded to the...
Definition: GLFramebuffer.h:40
unsigned int getColorTexture() const
Return our color texture handle.
Definition: GLFramebuffer.h:58
bool getEncodeSrgb()
Return the encode sRGB flag.
Definition: GLFramebuffer.h:46
unsigned int getDepthTexture() const
Return our depth texture handle.
Definition: GLFramebuffer.h:64