FastUIDraw
Public Member Functions | Static Public Member Functions | List of all members
fastuidraw::gl::TextureImage Class Reference

#include <texture_image_gl.hpp>

Inheritance diagram for fastuidraw::gl::TextureImage:
Inheritance graph
[legend]

Public Member Functions

GLuint texture (void) const
 
- Public Member Functions inherited from fastuidraw::Image
uint64_t bindless_handle (void) const
 
ivec2 dimensions (void) const
 
float dimensions_index_divisor (void) const
 
enum format_t format (void) const
 
ivec3 master_index_tile (void) const
 
vec2 master_index_tile_dims (void) const
 
unsigned int number_index_lookups (void) const
 
unsigned int number_mipmap_levels (void) const
 
type_t type (void) const
 
- Public Member Functions inherited from fastuidraw::reference_counted_base< T, Counter >
 reference_counted_base (void)
 

Static Public Member Functions

static reference_counted_ptr< TextureImagecreate (ImageAtlas &patlas, int w, int h, unsigned int m, GLuint texture, bool object_owns_texture, enum format_t fmt=rgba_format, bool allow_bindless=true)
 
static reference_counted_ptr< TextureImagecreate (ImageAtlas &patlas, int w, int h, unsigned int m, GLenum tex_magnification, GLenum tex_minification, enum format_t fmt=rgba_format, bool allow_bindless=true)
 
static reference_counted_ptr< TextureImagecreate (ImageAtlas &patlas, int w, int h, const ImageSourceBase &image_data, GLenum tex_magnification, GLenum tex_minification, bool allow_bindless=true)
 
- Static Public Member Functions inherited from fastuidraw::reference_counted_base< T, Counter >
static void add_reference (const reference_counted_base< T, Counter > *p)
 
static void remove_reference (const reference_counted_base< T, Counter > *p)
 

Additional Inherited Members

- Public Types inherited from fastuidraw::Image
enum  format_t { rgba_format, premultipied_rgba_format }
 
enum  type_t { on_atlas, bindless_texture2d, context_texture2d }
 
- Protected Member Functions inherited from fastuidraw::Image
 Image (ImageAtlas &atlas, int w, int h, unsigned int m, enum type_t type, uint64_t handle, enum format_t fmt, const reference_counted_ptr< ResourceReleaseAction > &action=reference_counted_ptr< ResourceReleaseAction >())
 

Detailed Description

A TextureImage is an Image that is backed by a GL texture. Creating a TextureImage requires that a GL context is current. If the GL context supports bindless (i.e one of the GL_ARB_bindless_texture or GL_NV_bindless_texture is present), then the created TextureImage will have that Image::type() is Image::bindless_texture2d, otherwise it will be Image::context_texture2d.

Definition at line 44 of file texture_image_gl.hpp.

Member Function Documentation

◆ create() [1/3]

static reference_counted_ptr<TextureImage> fastuidraw::gl::TextureImage::create ( ImageAtlas patlas,
int  w,
int  h,
unsigned int  m,
GLuint  texture,
bool  object_owns_texture,
enum format_t  fmt = rgba_format,
bool  allow_bindless = true 
)
static

Create a TextureImage from a previously created GL texture whose binding target is GL_TEXTURE_2D.

Parameters
patlasthe ImageAtlas that the created image is part of
wwidth of the texture
hheight of the texture
mnumber of mipmap levels of the texture
textureGL texture name
object_owns_texturethe created TextureImage will own the GL texture and will delete the GL texture when the returned TextureImage is deleted. If false, the GL texture must be deleted by the caller AFTER the TextureImage is deleted.
fmtformat of the RGBA of the texture
allow_bindlessif both this is true and the GL/GLES implementation supports bindless texturing, return an object whose type() returns bindless_texture2d.

◆ create() [2/3]

static reference_counted_ptr<TextureImage> fastuidraw::gl::TextureImage::create ( ImageAtlas patlas,
int  w,
int  h,
unsigned int  m,
GLenum  tex_magnification,
GLenum  tex_minification,
enum format_t  fmt = rgba_format,
bool  allow_bindless = true 
)
static

Create a GL texture and use it to back a TextureImage; the created TextureImage will own the GL texture.

Parameters
patlasthe ImageAtlas that the created image is part of
wwidth of the texture
hheight of the texture
mnumber of mipmap levels of the texture
tex_magnificationmagnification filter to get the texture
tex_minificationminification filter to get the texture
fmtformat of the RGBA of the texture
allow_bindlessif both this is true and the GL/GLES implementation supports bindless texturing, return an object whose type() returns bindless_texture2d.

◆ create() [3/3]

static reference_counted_ptr<TextureImage> fastuidraw::gl::TextureImage::create ( ImageAtlas patlas,
int  w,
int  h,
const ImageSourceBase image_data,
GLenum  tex_magnification,
GLenum  tex_minification,
bool  allow_bindless = true 
)
static

Create a GL texture and use it to back a TextureImage; the created TextureImage will own the GL texture.

Parameters
wwidth of the image to create
hheight of the image to create
patlasthe ImageAtlas that the created image is part of
image_dataimage data to which to initialize the image
tex_magnificationmagnification filter to get the texture
tex_minificationminification filter to get the texture
allow_bindlessif both this is true and the GL/GLES implementation supports bindless texturing, return an object whose type() returns bindless_texture2d.

◆ texture()

GLuint fastuidraw::gl::TextureImage::texture ( void  ) const

Returns the GL texture backing the TextureImage. The texture binding target is always GL_TEXTURE_2D. One can modify the -contents- of the texture via glGetTexParameter familiy of functions or the contents of the backing store via glTexSubImage2D, but one should never change its backing store (via glTexImage2D) or delete it (via glDeleteTextures). Lastly, recall that Painter works by generating index and draw buffers that are sent to the GL/GLES API at Painter::end(), thus if one wants to modify the texture within a Painter::begin() / Painter::end() pair, one must modify it from a PainterDrawBreakAction so that the texture is consumed by the gfx API before it is modified.


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