openMSX
Public Member Functions | Protected Attributes | Friends | List of all members
gl::Texture Class Reference

Most basic/generic texture: only contains a texture ID. More...

#include <GLUtil.hh>

Inheritance diagram for gl::Texture:
Inheritance graph
[legend]

Public Member Functions

 Texture (const Texture &)=delete
 
Textureoperator= (const Texture &)=delete
 
 Texture (bool interpolation=false, bool wrap=false)
 Allocate a openGL texture name and enable/disable interpolation.
 
 Texture (Null)
 Create null-handle (not yet allocate an openGL handle).
 
 ~Texture ()
 Release openGL texture name.
 
 Texture (Texture &&other) noexcept
 Move constructor and assignment.
 
Textureoperator= (Texture &&other) noexcept
 
void allocate ()
 Allocate an openGL texture name.
 
void reset ()
 Release openGL texture name.
 
GLuint get () const
 Returns the underlying openGL handler id.
 
void bind ()
 Makes this texture the active GL texture.
 
void setInterpolation (bool interpolation)
 Enable/disable bilinear interpolation for this texture.
 
void setWrapMode (bool wrap)
 

Protected Attributes

GLuint textureId
 

Friends

class FrameBufferObject
 

Detailed Description

Most basic/generic texture: only contains a texture ID.

Current implementation always assumes 2D textures.

Definition at line 35 of file GLUtil.hh.

Constructor & Destructor Documentation

◆ Texture() [1/4]

gl::Texture::Texture ( const Texture )
delete

◆ Texture() [2/4]

gl::Texture::Texture ( bool  interpolation = false,
bool  wrap = false 
)
explicit

Allocate a openGL texture name and enable/disable interpolation.

Definition at line 29 of file GLUtil.cc.

References allocate(), setInterpolation(), and setWrapMode().

◆ Texture() [3/4]

gl::Texture::Texture ( Null  )
inlineexplicit

Create null-handle (not yet allocate an openGL handle).

Definition at line 45 of file GLUtil.hh.

◆ ~Texture()

gl::Texture::~Texture ( )
inline

Release openGL texture name.

Definition at line 48 of file GLUtil.hh.

References reset().

◆ Texture() [4/4]

gl::Texture::Texture ( Texture &&  other)
inlinenoexcept

Move constructor and assignment.

Definition at line 51 of file GLUtil.hh.

Member Function Documentation

◆ allocate()

void gl::Texture::allocate ( )

Allocate an openGL texture name.

Definition at line 36 of file GLUtil.cc.

References textureId.

Referenced by Texture().

◆ bind()

void gl::Texture::bind ( )
inline

Makes this texture the active GL texture.

The other methods of this class and its subclasses will implicitly bind the texture, so you only need this method to explicitly bind this texture for use in GL function calls outside of this class.

Definition at line 77 of file GLUtil.hh.

References textureId.

Referenced by openmsx::GLImage::draw(), openmsx::GLScaler::execute(), openmsx::GLHQLiteScaler::GLHQLiteScaler(), openmsx::GLHQScaler::GLHQScaler(), openmsx::OffScreenSurface::OffScreenSurface(), openmsx::ImGuiCharacter::paint(), openmsx::ImGuiSpriteViewer::paint(), openmsx::GLSnow::paint(), gl::ColorTexture::resize(), openmsx::GLHQLiteScaler::scaleImage(), openmsx::GLHQScaler::scaleImage(), setInterpolation(), setWrapMode(), openmsx::GLHQLiteScaler::uploadBlock(), and openmsx::GLHQScaler::uploadBlock().

◆ get()

GLuint gl::Texture::get ( ) const
inline

Returns the underlying openGL handler id.

0 iff no openGL texture is allocated.

Definition at line 70 of file GLUtil.hh.

References textureId.

Referenced by openmsx::GLImage::draw(), openmsx::ImGuiCharacter::paint(), and openmsx::ImGuiSpriteViewer::paint().

◆ operator=() [1/2]

Texture & gl::Texture::operator= ( const Texture )
delete

◆ operator=() [2/2]

Texture & gl::Texture::operator= ( Texture &&  other)
inlinenoexcept

Definition at line 56 of file GLUtil.hh.

References textureId.

◆ reset()

void gl::Texture::reset ( )

Release openGL texture name.

Definition at line 41 of file GLUtil.cc.

References textureId.

Referenced by ~Texture().

◆ setInterpolation()

void gl::Texture::setInterpolation ( bool  interpolation)

Enable/disable bilinear interpolation for this texture.

IOW selects between GL_NEAREST or GL_LINEAR filtering.

Definition at line 58 of file GLUtil.cc.

References bind().

Referenced by openmsx::GLHQLiteScaler::scaleImage(), openmsx::GLRGBScaler::scaleImage(), openmsx::GLSimpleScaler::scaleImage(), and Texture().

◆ setWrapMode()

void gl::Texture::setWrapMode ( bool  wrap)

Definition at line 66 of file GLUtil.cc.

References bind().

Referenced by Texture().

Friends And Related Symbol Documentation

◆ FrameBufferObject

friend class FrameBufferObject
friend

Definition at line 91 of file GLUtil.hh.

Member Data Documentation

◆ textureId

GLuint gl::Texture::textureId
protected

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