MaterialX 1.38.10
Loading...
Searching...
No Matches
GLFramebuffer.h
Go to the documentation of this file.
1//
2// Copyright Contributors to the MaterialX Project
3// SPDX-License-Identifier: Apache-2.0
4//
5
6#ifndef MATERIALX_GLFRAMEBUFFER_H
7#define MATERIALX_GLFRAMEBUFFER_H
8
11
13
15
16MATERIALX_NAMESPACE_BEGIN
17
18class GLFramebuffer;
19
21using GLFramebufferPtr = std::shared_ptr<GLFramebuffer>;
22
25class MX_RENDERGLSL_API GLFramebuffer
26{
27 public:
29 static GLFramebufferPtr create(unsigned int width, unsigned int height, unsigned int channelCount, Image::BaseType baseType);
30
32 virtual ~GLFramebuffer();
33
35 unsigned int getWidth() const
36 {
37 return _width;
38 }
39
41 unsigned int getHeight() const
42 {
43 return _height;
44 }
45
48 void setEncodeSrgb(bool encode)
49 {
50 _encodeSrgb = encode;
51 }
52
55 {
56 return _encodeSrgb;
57 }
58
60 void bind();
61
63 void unbind();
64
66 unsigned int getColorTexture() const
67 {
68 return _colorTexture;
69 }
70
72 unsigned int getDepthTexture() const
73 {
74 return _depthTexture;
75 }
76
80 ImagePtr getColorImage(ImagePtr image = nullptr);
81
83 void blit();
84
85 protected:
86 GLFramebuffer(unsigned int width, unsigned int height, unsigned int channelCount, Image::BaseType baseType);
87
88 protected:
89 unsigned int _width;
90 unsigned int _height;
91 unsigned int _channelCount;
92 Image::BaseType _baseType;
93 bool _encodeSrgb;
94
95 unsigned int _framebuffer;
96 unsigned int _colorTexture;
97 unsigned int _depthTexture;
98};
99
100MATERIALX_NAMESPACE_END
101
102#endif
std::shared_ptr< GLFramebuffer > GLFramebufferPtr
Shared pointer to a GLFramebuffer.
Definition: GLFramebuffer.h:21
shared_ptr< Image > ImagePtr
A shared pointer to an image.
Definition: Image.h:23
Image handler interfaces.
Macros for declaring imported and exported symbols.
Wrapper for an OpenGL framebuffer.
Definition: GLFramebuffer.h:26
unsigned int getHeight() const
Return the height of the framebuffer.
Definition: GLFramebuffer.h:41
void setEncodeSrgb(bool encode)
Set the encode sRGB flag, which controls whether values written to the framebuffer are encoded to the...
Definition: GLFramebuffer.h:48
unsigned int getColorTexture() const
Return our color texture handle.
Definition: GLFramebuffer.h:66
bool getEncodeSrgb()
Return the encode sRGB flag.
Definition: GLFramebuffer.h:54
unsigned int getWidth() const
Return the width of the framebuffer.
Definition: GLFramebuffer.h:35
unsigned int getDepthTexture() const
Return our depth texture handle.
Definition: GLFramebuffer.h:72