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

#include <painter_surface_gl.hpp>

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

Public Member Functions

 PainterSurfaceGL (ivec2 dims, const PainterEngineGL &backend, enum render_type_t render_type=color_buffer_type)
 
 PainterSurfaceGL (ivec2 dims, GLuint gl_texture, const PainterEngineGL &backend, enum render_type_t render_type=color_buffer_type)
 
void blit_surface (const Viewport &src, const Viewport &dst, GLenum filter=GL_NEAREST) const
 
void blit_surface (GLenum filter=GL_NEAREST) const
 
virtual const vec4clear_color (void) const override final
 
virtual void clear_color (const vec4 &) override final
 
virtual ivec2 dimensions (void) const override final
 
virtual reference_counted_ptr< const Imageimage (ImageAtlas &atlas) const override final
 
void * opaque_data (void) const
 
virtual enum render_type_t render_type (void) const override final
 
GLuint texture (void) const
 
virtual const Viewportviewport (void) const override final
 
virtual void viewport (const Viewport &vwp) override final
 
- Public Member Functions inherited from fastuidraw::PainterSurface
ivec2 compute_visible_dimensions (void) const
 
- Public Member Functions inherited from fastuidraw::reference_counted_base< T, Counter >
 reference_counted_base (void)
 

Additional Inherited Members

- Public Types inherited from fastuidraw::PainterSurface
enum  render_type_t { color_buffer_type, deferred_coverage_buffer_type, number_buffer_types }
 Enumeration to specify the render target of a Surface. More...
 
- 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)
 

Detailed Description

A PainterSurfaceGL is the implementatin of PainterSurface for the GL backend. A PainterSurfaceGL must only be used with at most one GL context (even GL contexts in the same share group cannot shader PainterSurfaceGL objects).

Definition at line 43 of file painter_surface_gl.hpp.

Constructor & Destructor Documentation

◆ PainterSurfaceGL() [1/2]

fastuidraw::gl::PainterSurfaceGL::PainterSurfaceGL ( ivec2  dims,
const PainterEngineGL backend,
enum render_type_t  render_type = color_buffer_type 
)
explicit

Ctor. Creates and uses a backing color texture. The viewport() is initialized to be exactly the entire backing store.

Parameters
dimsthe width and height of the PainterSurfaceGL
backendthe PainterEngineGL that produces Painter Backend objects can use the created PainterSurfaceGL
render_typethe render type of the surface (i.e. is it a color buffer or deferred coverage buffer)

◆ PainterSurfaceGL() [2/2]

fastuidraw::gl::PainterSurfaceGL::PainterSurfaceGL ( ivec2  dims,
GLuint  gl_texture,
const PainterEngineGL backend,
enum render_type_t  render_type = color_buffer_type 
)
explicit

Ctor. Use the passed GL texture to which to render content; the gl_texture must have as its texture target GL_TEXTURE_2D and must already have its backing store allocated (i.e. glTexImage or glTexStorage has been called on the texture). The texture object's ownership is NOT passed to the PainterSurfaceGL, the caller is still responible to delete the texture (with GL) and the texture must not be deleted (or have its backing store changed via glTexImage) until the PainterSurfaceGL is deleted. The viewport() is initialized to be exactly the entire backing store.

Parameters
dimswidth and height of the GL texture
gl_textureGL name of texture
backendthe PainterEngineGL that produces Painter Backend objects can use the created PainterSurfaceGL
render_typethe render type of the surface (i.e. is it a color buffer or deferred coverage buffer)

Member Function Documentation

◆ blit_surface() [1/2]

void fastuidraw::gl::PainterSurfaceGL::blit_surface ( const Viewport src,
const Viewport dst,
GLenum  filter = GL_NEAREST 
) const

Blit the PainterSurfaceGL color buffer to the FBO currently bound to GL_DRAW_FRAMEBUFFER.

Parameters
srcsource from this PainterSurfaceGL to which to bit
dstdestination in FBO to which to blit
filterGL filter to apply to blit operation

◆ blit_surface() [2/2]

void fastuidraw::gl::PainterSurfaceGL::blit_surface ( GLenum  filter = GL_NEAREST) const

Provided as a convenience, equivalent to

PainterBackend::Viewport vw(0, 0, dimensions().x(), dimensions.y());
blit_surface(vw, vw, filter);
Parameters
filterGL filter to apply to blit operation

◆ clear_color() [1/2]

virtual const vec4& fastuidraw::gl::PainterSurfaceGL::clear_color ( void  ) const
finaloverridevirtual

To be implemented by a derived class to return the clear color.

Implements fastuidraw::PainterSurface.

◆ clear_color() [2/2]

virtual void fastuidraw::gl::PainterSurfaceGL::clear_color ( const vec4 )
finaloverridevirtual

To be implemented by a derived class to set the clear color.

Implements fastuidraw::PainterSurface.

◆ dimensions()

virtual ivec2 fastuidraw::gl::PainterSurfaceGL::dimensions ( void  ) const
finaloverridevirtual

To be implemented by a derived class to return the dimensions of the Surface backing store.

Implements fastuidraw::PainterSurface.

◆ image()

virtual reference_counted_ptr<const Image> fastuidraw::gl::PainterSurfaceGL::image ( ImageAtlas atlas) const
finaloverridevirtual

Return an Image whose backing is the same as this PainterSurface. It is expected that backing Image is the same for the lifetime of the PainterSurface. The caller gaurantees that the same ImageAtlas object will be passed on each call to image().

Parameters
atlasImageAtlas to manage the returned Image

Implements fastuidraw::PainterSurface.

◆ opaque_data()

void* fastuidraw::gl::PainterSurfaceGL::opaque_data ( void  ) const
inline

Used internally by the GL backend; do not touch the data behind the void pointer.

Definition at line 127 of file painter_surface_gl.hpp.

◆ render_type()

virtual enum render_type_t fastuidraw::gl::PainterSurfaceGL::render_type ( void  ) const
finaloverridevirtual

To be implemented by a derived class to return the surface type of the Surface (i.e. is it a color buffer or a deferred coverage buffer).

Implements fastuidraw::PainterSurface.

◆ texture()

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

Returns the GL name of the texture backing the color buffer of the PainterSurfaceGL.

◆ viewport() [1/2]

virtual const Viewport& fastuidraw::gl::PainterSurfaceGL::viewport ( void  ) const
finaloverridevirtual

To be implemented by a derived class to return the viewport into the Surface.

Implements fastuidraw::PainterSurface.

◆ viewport() [2/2]

virtual void fastuidraw::gl::PainterSurfaceGL::viewport ( const Viewport vwp)
finaloverridevirtual

To be implemented by a derived class to set the viewport into the surface. The viewport cannot be changed while the Surface is in use by a Painter Backend or Painter.

Parameters
vwpnew viewport into the surface to use

Implements fastuidraw::PainterSurface.


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