Graphite  Version 3
An experimental 3D geometry processing program
OGF::SkinImGUIRenderingContext Class Reference

A class derived from RenderingContext that interfaces the Application class with Graphite. More...

#include <OGF/skin_imgui/types/rendering_context.h>

Inheritance diagram for OGF::SkinImGUIRenderingContext:
OGF::RenderingContext GEO::Counted

Public Member Functions

 SkinImGUIRenderingContext (GLUPcontext glup_context)
 SkinImGUIRenderingContext constructor. More...
 
void begin_frame () override
 Begins a new frame. More...
 
void end_frame () override
 Terminates a frame. More...
 
void resize (index_t w, index_t h) override
 Must be called whenever the rendering context is resized. More...
 
void draw_last_frame ()
 Draws the frame that was rendered in the FBO.
 
void snapshot (Image *image, bool hide_gui=true)
 Copies the content of this RenderingContext to an Image. More...
 
- Public Member Functions inherited from OGF::RenderingContext
 RenderingContext (GLUPcontext glup_context=nullptr)
 RenderingContext constructor. More...
 
 ~RenderingContext ()
 RenderingContext destructor.
 
index_t get_width () const
 Gets the width. More...
 
index_t get_height () const
 Gets the height. More...
 
bool initialized () const
 Tests whether this RenderingContext is initialized. More...
 
virtual void make_current ()
 Makes this RenderingContext the current one. More...
 
virtual void done_current ()
 This function should be called when client code is done with rendering to the current context. More...
 
virtual void swap_buffers ()
 Meant to make the rendered frame visible. More...
 
void clear ()
 Clears this RenderingContext. More...
 
void load_viewing_matrix (const mat4 &m)
 Sets the current viewing matrix. More...
 
void mul_viewing_matrix (const mat4 &m)
 Multiplies the current viewing matrix by another one. More...
 
const mat4viewing_matrix () const
 Gets the current viewing matrix. More...
 
const mat4inverse_viewing_matrix () const
 Gets the inverse of the current viewing matrix. More...
 
void load_projection_matrix (const mat4 &m)
 Sets the projection matrix and sends it to OpenGL. More...
 
mat4 projection_matrix () const
 Gets the projection matrix. More...
 
const Colorbackground_color () const
 Gets the primary background color. More...
 
void set_background_color (const Color &c)
 Sets the primary background color. More...
 
const Colorbackground_color_2 () const
 Gets the secondary background color. More...
 
void set_background_color_2 (const Color &c)
 Sets the secondary background color. More...
 
void set_background_image (Image *image)
 Sets the background image. More...
 
void update_background_image_from_data (Memory::pointer ptr, Image::ColorEncoding color_encoding, Image::ComponentEncoding component_encoding, index_t width, index_t height)
 Updates the background image from raw data pointer. More...
 
void set_lighting_matrix (const mat4 &m)
 Sets the lighting matrix. More...
 
const mat4lighting_matrix () const
 Gets the lighting matrix. More...
 
mat4 clipping_matrix () const
 Gets the clipping matrix. More...
 
void set_clipping_matrix (const mat4 &m)
 Sets the lighting matrix. More...
 
void set_clipping (bool x)
 Activates or deactivates clipping. More...
 
bool get_clipping () const
 Tests whether clipping is active. More...
 
void set_clipping_equation (const vec4 &x)
 Sets the clipping equation. More...
 
const vec4get_clipping_translation () const
 Gets the clipping equation. More...
 
void set_clipping_viewer (bool x)
 Sets whether clipping translation and rotation are applied in object bounding box or in viewer coordinates. More...
 
bool get_clipping_viewer () const
 Tests whether clipping translation and rotation are applied in object bounding box or in viewer coordinates. More...
 
GLUPclipMode get_clipping_mode () const
 Gets the current clipping mode. More...
 
void set_clipping_mode (GLUPclipMode mode)
 Sets the current clipping mode. More...
 
bool double_buffer () const
 Tests whether this RenderingContext uses double buffering. More...
 
bool stereo () const
 Tests whether this RenderingContext uses stereo rendering. More...
 
virtual void set_double_buffer (bool b)
 Specifies whether double buffering should be used. More...
 
virtual void snapshot (Image *image, bool make_current=true, index_t x0=0, index_t y0=0, index_t width=0, index_t height=0)
 
std::string gl_vendor () const
 Gets the OpenGL vendor. More...
 
std::string gl_renderer () const
 Gets the OpenGL renderer. More...
 
std::string gl_version () const
 Gets the OpenGL version. More...
 
std::string gl_extensions () const
 Gets the OpenGL extension. More...
 
std::string get_gpu_information () const
 Gets the information on the GPU. More...
 
std::string get_gpu_extensions () const
 Gets the GPU extensions. More...
 
void set_full_screen_effect (FullScreenEffectImpl *fse)
 Sets the full screen effect. More...
 
FullScreenEffectImplget_full_screen_effect () const
 Gets the current full screen effect. More...
 
vec2 screen_to_ndc (index_t x, index_t y) const
 Transforms screen coordinates to normalized device coordinates (viewport transform). More...
 
void ndc_to_screen (const vec2 &ndc, index_t &x, index_t &y) const
 Transforms normalized device coordinates to screen coordinates (inverse viewport transform). \parma[in] ndc the normalized device coordinates of the point (x and y between -1.0 and 1.0). More...
 
virtual void begin_picking (const vec2 &ndc)
 Enters picking mode. More...
 
virtual void end_picking ()
 Exits picking mode. More...
 
index_t picked_id () const
 Gets the picked id that was encoded in the pixel color under the mouse pointer. More...
 
double picked_depth () const
 Gets the depth of the picked point in screen coordinates. More...
 
const vec3picked_point () const
 Gets the picked point in world coordinates. More...
 
bool picked_background () const
 Tests whether the background was picked. More...
 
vec3 unproject (const vec2 &p_ndc, double depth) const
 Back-transforms a point given by its normalized device coordinates and depth. More...
 
void check_gl () const
 Tests whether there was any OpenGL error. More...
 
GLuint frame_buffer_id () const
 Gets the default frame buffer id. More...
 
bool contains_picking_image () const
 Tests whether the image is a picking image. More...
 
Overlayoverlay ()
 Gets the Overlay. More...
 
- Public Member Functions inherited from GEO::Counted
void ref () const
 Increments the reference count. More...
 
void unref () const
 Decrements the reference count. More...
 
bool is_shared () const
 Check if the object is shared. More...
 
int nb_refs () const
 Gets the number of references that point to this object. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from OGF::RenderingContext
static RenderingContextcurrent ()
 Gets the current RenderingContext. More...
 
static bool is_currently_rendering ()
 Tests whether a rendering operation is occuring. More...
 
static bool is_currently_picking ()
 Tests whether a picking operation is occuring. More...
 
- Static Public Member Functions inherited from GEO::Counted
static void ref (const Counted *counted)
 Increments the reference count. More...
 
static void unref (const Counted *counted)
 Decrements the reference count. More...
 
- Protected Member Functions inherited from OGF::RenderingContext
virtual void draw_background ()
 Draws the background. More...
 
void setup_viewport ()
 Setups the viewport transform. More...
 
void setup_projection_ortho (double zNear, double zFar)
 Setups the OpenGL projection matrix in orthographic mode. More...
 
void setup_projection_perspective (double zScreen, double zNear, double zFar, double eye_offset=0.0)
 Setups the OpenGL projection matrix in orthographic mode. More...
 
void setup_modelview (double zScreen)
 Setups the OpenGL model view transform from the viewing parameters. More...
 
void setup_lighting ()
 Setups OpenGL lighting parameters.
 
void update_clipping ()
 Create a clipping plane perpendicular to the Z axis, transformed by the current clipping matrix and the modelview matrix.
 
Texturebackground_texture () const
 Gets the background texture. More...
 
void set_initialized (bool x=true)
 Indicates whether this RenderingContext is initialized. More...
 
void set_width (index_t w)
 Sets the width. More...
 
void set_height (index_t h)
 Sets the height. More...
 
void get_view_parameters ()
 Queries the Graphite environment for global rendering parameters, e.g. stereo & perspective, and updates member variables if this RenderingContext accordingly.
 
void get_picked_point ()
 In picking mode, this function gets all the information about the picked point, by reading the depth buffer and the color buffer with color-coded id.
 
- Protected Member Functions inherited from GEO::Counted
 Counted ()
 Creates a reference counted object. More...
 
virtual ~Counted ()
 Destroys a reference counted object. More...
 
- Static Protected Member Functions inherited from OGF::RenderingContext
static const double * convert_matrix (const mat4 &M)
 Converts (transposes) a Graphite matrix for OpenGL use. More...
 
- Protected Attributes inherited from OGF::RenderingContext
bool initialized_
 
index_t width_
 
index_t height_
 
bool double_buffer_
 
int viewport_x_
 
int viewport_y_
 
int viewport_width_
 
int viewport_height_
 
mat4 viewing_matrix_
 
mat4 inverse_viewing_matrix_
 
bool inverse_viewing_matrix_dirty_
 
bool lighting_
 
mat4 lighting_matrix_
 
bool clipping_
 
mat4 clipping_matrix_
 
vec4 clipping_equation_
 
bool clipping_viewer_
 
GLUPclipMode clipping_mode_
 
Color background_color_
 
Color background_color_2_
 
Texture_var background_texture_
 
FullScreenEffectImpl_var full_screen_effect_
 
bool perspective_
 
bool stereo_
 
bool stereo_odd_frame_
 
double stereo_eye_dist_
 
vec3 head_position_
 
double head_tilt_
 
bool picking_mode_
 
vec2 picked_ndc_
 
double picked_depth_
 
index_t picked_id_
 
vec3 picked_point_
 
bool picked_background_
 
bool last_frame_was_picking_
 
GLuint frame_buffer_id_
 The identifier of the default frame buffer associated with this RenderingContext. More...
 
bool frame_buffer_id_init_
 
GLUPcontext glup_context_
 The GLUP context. More...
 
bool owns_glup_context_
 
bool use_core_profile_
 
bool use_ES_profile_
 
bool transparent_
 
Overlay overlay_
 
- Static Protected Attributes inherited from OGF::RenderingContext
static RenderingContextcurrent_
 
static bool geogram_gfx_initialized_
 
static index_t nb_render_locks_
 The number of RenderingContext instances that are currently rendering something, i.e. between begin_frame() and end_frame().
 
static index_t nb_picking_locks_
 The number of RenderingContext instances that are currently picking something, or that contain a picking image in their color buffer.
 

Detailed Description

A class derived from RenderingContext that interfaces the Application class with Graphite.

Uses a FrameBufferObject so that the GUI can be refreshed without needing to redraw 3D content.

Definition at line 55 of file rendering_context.h.

Constructor & Destructor Documentation

◆ SkinImGUIRenderingContext()

OGF::SkinImGUIRenderingContext::SkinImGUIRenderingContext ( GLUPcontext  glup_context)
inline

SkinImGUIRenderingContext constructor.

Parameters
[in]glup_contextthe GLUP context to be used for rendering.

Definition at line 63 of file rendering_context.h.

Member Function Documentation

◆ begin_frame()

void OGF::SkinImGUIRenderingContext::begin_frame ( )
overridevirtual

Begins a new frame.

This clears the color and depth buffer, and setups the viewing matrix. This function calls make_current() before issuing any OpenGL call.

Reimplemented from OGF::RenderingContext.

◆ end_frame()

void OGF::SkinImGUIRenderingContext::end_frame ( )
overridevirtual

Terminates a frame.

Reimplemented from OGF::RenderingContext.

◆ resize()

void OGF::SkinImGUIRenderingContext::resize ( index_t  w,
index_t  h 
)
overridevirtual

Must be called whenever the rendering context is resized.

Updates the viewport transform.

Parameters
[in]wthe new width
[in]hthe new height

Reimplemented from OGF::RenderingContext.

◆ snapshot()

void OGF::SkinImGUIRenderingContext::snapshot ( Image image,
bool  hide_gui = true 
)

Copies the content of this RenderingContext to an Image.

Parameters
[out]imagea pointer to the image. It should have RGB or RGBA storage, and have the same size as this RenderingContext.
[in]hide_guiif true, gui elements are not captured (only the content of the frame buffer object), else the current OpenGL framebuffer is copied (with the GUI if it called after GUI refresh).

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