Carna  Version 3.3.2
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
Carna::base::ManagedTexture3D Class Reference

Represents 3D OpenGL texture object whose lifetime is managed by instances of this class. More...

#include <ManagedTexture3D.h>

+ Inheritance diagram for Carna::base::ManagedTexture3D:
+ Collaboration diagram for Carna::base::ManagedTexture3D:

Public Types

typedef ManagedTexture3DInterface ManagedInterface
 Defines the type to be used for interfacing the video resource.
 

Public Member Functions

virtual bool controlsSameVideoResource (const GeometryFeature &) const override
 Tells whether this instance maintains the same video resources like other. More...
 
virtual ManagedTexture3DInterfaceacquireVideoResource () override
 Acquires the video resources from this GeometryFeature by returning new instance of a class derived from ManagedInterface, that realizes the RAII idiom. Refer to its documentation for details. May return nullptr if this GeometryFeature does not provide any video resources.
 
- Public Member Functions inherited from Carna::base::GeometryFeature
unsigned int videoResourceAcquisitionsCount () const
 Tells current number of video resource acquisitions.
 
void release ()
 Denotes that this object is no longer required and may be deleted as soon as it is valid to delete it. More...
 
void addTo (Geometry &sceneGraphNode, unsigned int role)
 Puts this geometry feature on the sceneGraphNode. More...
 
void removeFrom (Geometry &sceneGraphNode)
 Removes this geometry feature from the sceneGraphNode. More...
 

Static Public Member Functions

static ManagedTexture3Dcreate (const math::Vector3ui &size, int internalFormat, int pixelFormat, int bufferType, const void *bufferPtr)
 Instantiates. Invoke release when it isn't needed any longer. More...
 

Public Attributes

const math::Vector3ui size
 Tells the resolution of this texture. More...
 
const int internalFormat
 Holds the number of color components in the texture, e.g. GL_RGBA8UI or GL_INTENSITY16. More...
 
const int pixelFormat
 Holds the format of the pixel data, e.g. GL_RED, GL_RGB or GL_RGBA. More...
 
const int bufferType
 Specifies the data type of the pixel data to be uploaded to the texture.
 
const void *const bufferPtr
 Points to the pixel data that will be uploaded to the texture.
 
const base::math::Matrix4f textureCoordinatesCorrection
 Stretches texture coordinates s.t. the centers of the texels, that are located in the texture corners, become located in those corners. More...
 

Protected Member Functions

 ManagedTexture3D (const math::Vector3ui &size, int internalFormat, int pixelFormat, int bufferType, const void *bufferPtr)
 Instantiates. More...
 
 ~ManagedTexture3D ()
 Deletes.
 
- Protected Member Functions inherited from Carna::base::GeometryFeature
 GeometryFeature ()
 Instantiates.
 
virtual ~GeometryFeature ()
 Deletes and logs an error if video resources are leaked.
 

Protected Attributes

std::unique_ptr< Texture< 3 > > textureObject
 Holds the maintained OpenGL texture object.
 

Friends

class GeometryFeature
 
class ManagedTexture3DInterface
 

Detailed Description

Represents 3D OpenGL texture object whose lifetime is managed by instances of this class.

Author
Leonid Kostrykin
Date
22.2.15 - 24.3.15

Definition at line 44 of file ManagedTexture3D.h.

Constructor & Destructor Documentation

◆ ManagedTexture3D()

Carna::base::ManagedTexture3D::ManagedTexture3D ( const math::Vector3ui size,
int  internalFormat,
int  pixelFormat,
int  bufferType,
const void *  bufferPtr 
)
protected

Instantiates.

Parameters
sizeis the resolution of this texture.
internalFormatspecifies the number of color components in the texture, e.g. GL_RGBA8UI or GL_INTENSITY16.
pixelFormatspecifies the format of the pixel data, e.g. GL_RED, GL_RGB or GL_RGBA.
bufferTypespecifies the data type of the pixel data pointed to by bufferPtr.
bufferPtrpoints to the pixel data that will be uploaded to the texture.
See also
Valid values for the parameters are available here: https://www.opengl.org/sdk/docs/man3/xhtml/glTexImage3D.xml
Attention
The instance does neither upload the pixel data from bufferPtr immediately, nor does it create a copy. Hence the pixel data located at bufferPtr must stay valid as long as an upload might be required.

Member Function Documentation

◆ controlsSameVideoResource()

virtual bool Carna::base::ManagedTexture3D::controlsSameVideoResource ( const GeometryFeature ) const
overridevirtual

Tells whether this instance maintains the same video resources like other.

This implementation always returns false.

Implements Carna::base::GeometryFeature.

Reimplemented in Carna::base::BufferedVectorFieldTexture< BufferedVectorFieldType >.

◆ create()

static ManagedTexture3D& Carna::base::ManagedTexture3D::create ( const math::Vector3ui size,
int  internalFormat,
int  pixelFormat,
int  bufferType,
const void *  bufferPtr 
)
static

Instantiates. Invoke release when it isn't needed any longer.

Parameters
sizeis the resolution of this texture.
internalFormatspecifies the number of color components in the texture, e.g. GL_RGBA8UI or GL_INTENSITY16.
pixelFormatspecifies the format of the pixel data, e.g. GL_RED, GL_RGB or GL_RGBA.
bufferTypespecifies the data type of the pixel data pointed to by bufferPtr.
bufferPtrpoints to the pixel data that will be uploaded to the texture.
See also
Valid values for the parameters are available here: https://www.opengl.org/sdk/docs/man3/xhtml/glTexImage3D.xml
Attention
The instance does neither upload the pixel data from bufferPtr immediately, nor does it create a copy. Hence the pixel data located at bufferPtr must stay valid as long as an upload might be required.

Member Data Documentation

◆ internalFormat

const int Carna::base::ManagedTexture3D::internalFormat

Holds the number of color components in the texture, e.g. GL_RGBA8UI or GL_INTENSITY16.

Definition at line 118 of file ManagedTexture3D.h.

◆ pixelFormat

const int Carna::base::ManagedTexture3D::pixelFormat

Holds the format of the pixel data, e.g. GL_RED, GL_RGB or GL_RGBA.

Definition at line 119 of file ManagedTexture3D.h.

◆ size

const math::Vector3ui Carna::base::ManagedTexture3D::size

Tells the resolution of this texture.

Precondition
isValid() == true

Definition at line 117 of file ManagedTexture3D.h.

◆ textureCoordinatesCorrection

const base::math::Matrix4f Carna::base::ManagedTexture3D::textureCoordinatesCorrection

Stretches texture coordinates s.t. the centers of the texels, that are located in the texture corners, become located in those corners.

Consider a \(4 \times 4\) texture. Each texel occupies \(\frac{1}{4}\) along each axis, hence the texels' centers are located at \(\frac{1}{8}\), \(\frac{3}{8}\), \(\frac{5}{8}\) and \(\frac{7}{8}\) along those axis.

This matrix transforms texture coordinates s.t. \( 0 \mapsto \frac{1}{8}\) and \( 1 \mapsto \frac{7}{8}\) following the considerations from above.

Definition at line 135 of file ManagedTexture3D.h.


The documentation for this class was generated from the following file: