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

Additional Inherited Members

- Static Public Member Functions inherited from OGF::RenderingContext
static RenderingContextcurrent ()
 Gets the current RenderingContext.
 
static bool is_currently_rendering ()
 Tests whether a rendering operation is occuring.
 
static bool is_currently_picking ()
 Tests whether a picking operation is occuring.
 
- Static Public Member Functions inherited from GEO::Counted
static void ref (const Counted *counted)
 Increments the reference count.
 
static void unref (const Counted *counted)
 Decrements the reference count.
 
- Protected Member Functions inherited from OGF::RenderingContext
virtual void draw_background ()
 Draws the background.
 
void setup_viewport ()
 Setups the viewport transform.
 
void setup_projection_ortho (double zNear, double zFar)
 Setups the OpenGL projection matrix in orthographic mode.
 
void setup_projection_perspective (double zScreen, double zNear, double zFar, double eye_offset=0.0)
 Setups the OpenGL projection matrix in orthographic mode.
 
void setup_modelview (double zScreen)
 Setups the OpenGL model view transform from the viewing parameters.
 
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.
 
void set_initialized (bool x=true)
 Indicates whether this RenderingContext is initialized.
 
void set_width (index_t w)
 Sets the width.
 
void set_height (index_t h)
 Sets the height.
 
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.
 
virtual ~Counted ()
 Destroys a reference counted object.
 
- Static Protected Member Functions inherited from OGF::RenderingContext
static const double * convert_matrix (const mat4 &M)
 Converts (transposes) a Graphite matrix for OpenGL use.
 
- 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.
 
bool frame_buffer_id_init_
 
GLUPcontext glup_context_
 The GLUP context.
 
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  make_current = true,
index_t  x0 = 0,
index_t  y0 = 0,
index_t  w = 0,
index_t  h = 0 
)
overridevirtual

Copies the color buffer onto the specified image.

Parameters
[out]imageThe image, it should have the same size as this RenderingContext and should be in RGB mode.
[in]make_currentif true, makes this rendering context the current rendering context before reading the pixels.
[in]x0,y0,width,heightoptional image bounds. If let unspecified, the entire picking buffer is copied.

Reimplemented from OGF::RenderingContext.


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