The Vish Visualization Shell 0.3
Vish
Classes | Public Member Functions | Static Public Member Functions | List of all members
Wizt::Framebuffer Class Reference

Class interface to the OpenGL Framebuffer API. More...

#include <ocean/GLvish/Framebuffer.hpp>

Inheritance diagram for Wizt::Framebuffer:
MemCore::ReferenceBase< Framebuffer > Wizt::SampledSize Wizt::Size

Classes

class  Bind
 Exception-safe framebuffer binding with framebuffer stack support. More...
 

Public Member Functions

bool attachColorBuffer (const MemCore::RefPtr< Renderbuffer > &Rb, int i=0)
 Render to render buffer pointer.
 
bool attachColorBuffer (const Renderbuffer &Rb, int i=0)
 Render to render buffer.
 
void attachColorTexture (GLTexture2DBase &image, GLint level=0, int BufferNumber=0)
 Render colors to 2D texture.
 
void attachDepthTexture (GLTexture2DBase &image)
 Render depth into 2D texture.
 
bool bind () const
 Select this framebuffer for reading and drawing.
 
bool bind_for_drawing () const
 Select this framebuffer for subsequent draw operations.
 
bool bind_for_reading () const
 Select this framebuffer for read operations from attached Renderbuffers().
 
bool BlitFromSource (const MemCore::RefPtr< Framebuffer > &Source, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) const
 Copy framebuffer content from a source framebuffer to another one.
 
bool BlitToScreen (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) const
 Copy framebuffer content to the screen.
 
MemCore::RefPtr< Renderbuffer > buffer (GLenum internalformat) const
 Return a compatible renderbuffer object.
 
 Framebuffer (const SampledSize &Sz=SampledSize())
 Call GenFramebuffer(1).
 
GLuint id () const
 Return the OpenGL ID.
 
MemCore::RefPtr< Renderbuffer > mkRenderbuffer (GLenum internalformat) const
 Return a compatible renderbuffer object.
 
 ~Framebuffer ()
 Destroy the Framebuffer ID (requires valid OpenGL context)
 
- Public Member Functions inherited from MemCore::ReferenceBase< Framebuffer >
auto getObjectCountID () const noexcept
 Get a unique ID for this object in the given domain.
 
bool isIdentical (const WeakPtr< Framebuffer, Framebuffer > &PossibleSelf) const noexcept
 Check if this object is identical to the one used by the given pointer.
 
void mkAutoDestructive ()
 Marks this object as being automatically destructed, e.g.
 
refcount_t refcount () const noexcept
 The strong reference count.
 
 ReferenceBase (Framebuffer *that) noexcept
 Constructor, initializes reference counter to zero.
 
const auto & self () const
 Return weak pointer to the object self.
 
refcount_t wrefcount () const noexcept
 The weak reference count.
 

Static Public Member Functions

static void unbind ()
 Select the screen for read and draw operations.
 
static void unbind_for_drawing ()
 Select the screen for drawing operations.
 
static void unbind_for_reading ()
 Select the screen for read operations.
 

Additional Inherited Members

- Public Types inherited from MemCore::ReferenceBase< Framebuffer >
using reference_domain_t = Framebuffer
 The type of the base class.
 
using SelfPtr_t = WeakPtr< Framebuffer, Framebuffer >
 Type for a pointer to this object itself.
 
- Public Attributes inherited from Wizt::SampledSize
unsigned samples
 Multisampling property.
 
- Protected Member Functions inherited from MemCore::ReferenceBase< Framebuffer >
virtual void extremeUnction ()
 A virtual function that will be called just before the object is destroyed.
 
ReferenceBaseoperator= (const ReferenceBase &R)
 Protected assignment operator (should not be called).
 
void suicide ()
 Delete this.
 
virtual ~ReferenceBase ()
 Virtual destructor.
 

Detailed Description

Class interface to the OpenGL Framebuffer API.

http://oss.sgi.com/projects/ogl-sample/registry/EXT/framebuffer_object.txt

Application-created framebuffer objects (i.e., those with a non-zero
name) differ from the default window-system-provided framebuffer in
a few important ways.  First and foremost, unlike the
window-system-provided framebuffer, application-created-framebuffers
have modifiable attachment points for each logical buffer in the
framebuffer.  Framebuffer-attachable images can be attached to and
detached from these attachment points, which are described further
in section 4.4.2.  Also, the size and format of the images attached
to application-created framebuffers are controlled entirely within
the GL interface, and are not affected by window-system events, such
as pixel format selection, window resizes, and display mode changes.

Additionally, when rendering to or reading from an application
created-framebuffer object,

      - The pixel ownership test always succeeds.  In other words,
        application-created framebuffer objects own all of their
        pixels.

      - There are no visible color buffer bitplanes.  This means
        there is no color buffer corresponding to the back, front,
        left, or right color bitplanes.

      - The only color buffer bitplanes are the ones defined by the
        framebuffer attachment points named COLOR_ATTACHMENT0_EXT
        through COLOR_ATTACHMENTn_EXT.

      - The only depth buffer bitplanes are the ones defined by the
        framebuffer attachment point DEPTH_ATTACHMENT_EXT.

      - The only stencil buffer bitplanes are the ones defined by
        the framebuffer attachment point STENCIL_ATTACHMENT_EXT.

      - There is no multisample buffer so the value of the
        implementation-dependent state variables SAMPLES and
        SAMPLE_BUFFERS are both 0

      - There are no accum buffer bitplanes, so the value of the
        implementation-dependent state variables ACCUM_RED_BITS,
        ACCUM_GREEN_BITS, ACCUM_BLUE_BITS, and ACCUM_ALPHA_BITS, are
        all zero.

      - There are no AUX buffer bitplanes, so the value of the
        implementation-dependent state variable AUX_BUFFERS is zero.

Constructor & Destructor Documentation

◆ Framebuffer()

Wizt::Framebuffer::Framebuffer ( const SampledSize Sz = SampledSize())

Call GenFramebuffer(1).

Constructor and all member functions MUST be called with a valid OpenGL context.

Member Function Documentation

◆ attachColorBuffer()

bool Wizt::Framebuffer::attachColorBuffer ( const MemCore::RefPtr< Renderbuffer > &  Rb,
int  i = 0 
)
inline

Render to render buffer pointer.

Deprecated:

◆ bind()

bool Wizt::Framebuffer::bind ( ) const

Select this framebuffer for reading and drawing.

Returns
True if all went right, false in case of any errors.

◆ bind_for_reading()

bool Wizt::Framebuffer::bind_for_reading ( ) const

Select this framebuffer for read operations from attached Renderbuffers().

Note that multisample renderbuffers cannot be read (if they are not bound to the screen) and need to be copied to a non-multisample framebuffer first.

Calls glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT,);

Referenced by BlitToScreen().

◆ BlitFromSource()

bool Wizt::Framebuffer::BlitFromSource ( const MemCore::RefPtr< Framebuffer > &  Source,
GLint  srcX0,
GLint  srcY0,
GLint  srcX1,
GLint  srcY1,
GLint  dstX0,
GLint  dstY0,
GLint  dstX1,
GLint  dstY1,
GLbitfield  mask,
GLenum  filter 
) const

Copy framebuffer content from a source framebuffer to another one.

This operation affects the framebuffer bindings. http://www.opengl.org/registry/specs/EXT/framebuffer_blit.txt

References bind_for_drawing(), and unbind_for_reading().

◆ buffer()

MemCore::RefPtr< Renderbuffer > Wizt::Framebuffer::buffer ( GLenum  internalformat) const
inline

Return a compatible renderbuffer object.

This only works if there was at least one Renderbuffer already attached to this Framebuffer or the Framebuffer was already constructed with appropriate size information.

◆ id()

GLuint Wizt::Framebuffer::id ( ) const
inline

Return the OpenGL ID.

This is usually not required since this class should provide a complete API.

◆ mkRenderbuffer()

MemCore::RefPtr< Renderbuffer > Wizt::Framebuffer::mkRenderbuffer ( GLenum  internalformat) const

Return a compatible renderbuffer object.

This only works if there was at least one Renderbuffer already attached to this Framebuffer or the Framebuffer was already constructed with appropriate size information.