Ocean
MediumTexture.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_PLATFORM_GL_GL_MEDIUM_TEXTURE_H
9 #define META_OCEAN_PLATFORM_GL_GL_MEDIUM_TEXTURE_H
10 
11 #include "ocean/platform/gl/GL.h"
13 
15 
16 namespace Ocean
17 {
18 
19 namespace Platform
20 {
21 
22 namespace GL
23 {
24 
25 /**
26  * This class implements a 2D OpenGL texture that receives the image content from a frame medium.
27  * @ingroup platformgl
28  */
29 class OCEAN_PLATFORM_GL_EXPORT MediumTexture : public Texture
30 {
31  public:
32 
33  /**
34  * Creates a new OpenGL texture object.
35  */
36  MediumTexture();
37 
38  /**
39  * Creates a new OpenGL texture object.
40  * @param frameMedium The frame medium for the texture
41  */
42  explicit MediumTexture(const Media::FrameMediumRef& frameMedium);
43 
44  /**
45  * Updates this texture.
46  * @return True, if succeeded
47  */
48  bool update();
49 
50  /**
51  * Returns the frame medium of this texture.
52  * @return The texture's medium
53  */
54  inline const Media::FrameMediumRef& medium() const;
55 
56  /**
57  * Sets a new frame medium for this texture.
58  * @param medium Frame medium to set
59  */
60  inline void setMedium(const Media::FrameMediumRef& medium);
61 
62  protected:
63 
64  /// Frame timestamp.
66 
67  /// Frame medium holding the image data.
69 };
70 
72  textureFrameTimestamp(false)
73 {
74  // nothing to do here
75 }
76 
78  textureFrameTimestamp(false),
79  textureFrameMedium(frameMedium)
80 {
81  // nothing to do here
82 }
83 
85 {
86  return textureFrameMedium;
87 }
88 
90 {
92 
94 }
95 
96 }
97 
98 }
99 
100 }
101 
102 #endif // META_OCEAN_PLATFORM_GL_GL_MEDIUM_TEXTURE_H
This class implements a 2D OpenGL texture that receives the image content from a frame medium.
Definition: MediumTexture.h:30
bool update()
Updates this texture.
Media::FrameMediumRef textureFrameMedium
Frame medium holding the image data.
Definition: MediumTexture.h:68
const Media::FrameMediumRef & medium() const
Returns the frame medium of this texture.
Definition: MediumTexture.h:84
Timestamp textureFrameTimestamp
Frame timestamp.
Definition: MediumTexture.h:65
void setMedium(const Media::FrameMediumRef &medium)
Sets a new frame medium for this texture.
Definition: MediumTexture.h:89
MediumTexture()
Creates a new OpenGL texture object.
Definition: MediumTexture.h:71
This class implements a 2D OpenGL texture.
Definition: platform/gl/Texture.h:30
This class implements a timestamp.
Definition: Timestamp.h:36
Timestamp & toInvalid()
Sets the timestamp to invalid.
Definition: Timestamp.h:276
SmartMediumRef< FrameMedium > FrameMediumRef
Definition of a smart medium reference holding a frame medium object.
Definition: FrameMedium.h:32
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15