cgv
Loading...
Searching...
No Matches
cgv::render::context Class Referenceabstract

base class for all drawables, which is independent of the used rendering API. More...

#include <context.h>

Inheritance diagram for cgv::render::context:
cgv::render::context_config cgv::render::gl::gl_context

Classes

struct  BlendState
 Represents a blend state used to configure fragment blending. More...
 
struct  BufferMask
 Represents a buffer mask used to mask depth and color buffer outputs. More...
 
struct  DepthTestState
 Represents a depth test state used to configure depth testing. More...
 
struct  light_source_status
 status information of light sources More...
 
struct  render_info
 information necessary for a rendering pass More...
 

Public Member Functions

shader_program_baseget_current_program () const
 check for current program, prepare it for rendering and return pointer to it
 
void enable_shader_file_cache ()
 enable the usage of the shader file caches
 
void disable_shader_file_cache ()
 disable the usage of the shader file caches
 
bool is_shader_file_cache_enabled () const
 whether the shader file caches are enabled
 
 context ()
 init the cursor position to (0,0)
 
virtual ~context ()
 virtual destructor
 
virtual void error (const std::string &message, const render_component *rc=0) const
 error handling
 
virtual GPUVendorID get_gpu_vendor_id () const
 device information
 
interface for implementation of specific contexts
virtual void init_render_pass ()
 
virtual void draw_textual_info ()
 
virtual void perform_screen_shot ()
 
virtual void finish_render_pass ()
 
render process
virtual void configure_new_child (cgv::base::base_ptr child)
 helper method to integrate a new child
 
virtual RenderAPI get_render_api () const =0
 return the used rendering API
 
unsigned get_render_pass_recursion_depth () const
 return current render pass recursion depth
 
virtual RenderPass get_render_pass () const
 return the current render pass
 
virtual RenderPassFlags get_render_pass_flags () const
 return the current render pass flags
 
virtual voidget_render_pass_user_data () const
 return the current render pass user data
 
virtual RenderPassFlags get_default_render_pass_flags () const
 return the default render pass flags
 
virtual void set_default_render_pass_flags (RenderPassFlags)
 return the default render pass flags
 
virtual void render_pass (RenderPass render_pass=RP_MAIN, RenderPassFlags render_pass_flags=RPF_ALL, void *user_data=0)
 perform the given render task
 
void set_debug_render_passes (bool _debug)
 set flag whether to debug render passes
 
bool get_debug_render_passes () const
 check whether render passes are debugged
 
virtual bool in_render_process () const =0
 return whether the context is currently in process of rendering
 
virtual bool is_created () const =0
 return whether the context is created
 
virtual bool is_current () const =0
 return whether the context is current
 
virtual bool recreate_context ()
 recreate context based on current context config settings
 
virtual bool make_current () const =0
 make the current context current if possible
 
virtual void clear_current () const =0
 clear the current context, typically used in multi-threaded rendering to allow usage of context in several threads
 
virtual void attach_alpha_buffer (bool attach=true)=0
 attach or detach (attach=false) an alpha buffer to the current frame buffer if not present
 
virtual void attach_depth_buffer (bool attach=true)=0
 attach or detach (attach=false) depth buffer to the current frame buffer if not present
 
virtual void attach_stencil_buffer (bool attach=true)=0
 attach or detach (attach=false) stencil buffer to the current frame buffer if not present
 
virtual bool is_stereo_buffer_supported () const =0
 return whether the graphics card supports stereo buffer mode
 
virtual void attach_stereo_buffer (bool attach=true)=0
 attach or detach (attach=false) stereo buffer to the current frame buffer if not present
 
virtual void attach_accumulation_buffer (bool attach=true)=0
 attach or detach (attach=false) accumulation buffer to the current frame buffer if not present
 
virtual void attach_multi_sample_buffer (bool attach=true)=0
 attach or detach (attach=false) multi sample buffer to the current frame buffer if not present
 
virtual unsigned int get_width () const =0
 return the width of the window
 
virtual unsigned int get_height () const =0
 return the height of the window
 
virtual void resize (unsigned int width, unsigned int height)=0
 resize the context to the given dimensions
 
virtual bool read_frame_buffer (data::data_view &dv, unsigned int x=0, unsigned int y=0, FrameBufferType buffer_type=FB_BACK, cgv::type::info::TypeId type=cgv::type::info::TI_UINT8, data::ComponentFormat cf=data::CF_RGB, int w=-1, int h=-1)=0
 read the current frame buffer or a rectangular region of it into the given data view.
 
bool write_frame_buffer_to_image (const std::string &file_name, data::ComponentFormat cf=data::CF_RGB, FrameBufferType buffer_type=FB_BACK, unsigned int x=0, unsigned int y=0, int w=-1, int h=-1, float depth_offset=0.9f, float depth_scale=10.0f)
 write the content of the frame buffer to an image file.
 
void push_bg_color ()
 push a copy of the current background color onto the stack
 
void pop_bg_color ()
 pop the top of the current background color from the stack
 
virtual void set_bg_color (vec4 rgba)
 set a user defined background color
 
void set_bg_color (float r, float g, float b, float a)
 set a user defined background color
 
vec4 get_bg_color () const
 return the current color value for clearing the background
 
void put_bg_color (float *rgba) const
 copy the current background rgba color into the given float array
 
void set_bg_alpha (float a)
 set a user defined background alpha value
 
float get_bg_alpha () const
 return the current alpha value for clearing the background
 
void set_bg_clr_idx (unsigned int idx)
 set an indexed background color
 
unsigned int get_bg_clr_idx () const
 return the current index of the background color
 
void push_bg_depth ()
 push a copy of the current background depth value onto the stack
 
void pop_bg_depth ()
 pop the top of the current background depth value from the stack
 
virtual void set_bg_depth (float d)
 set a user defined background depth value
 
float get_bg_depth () const
 return the current depth value for clearing the background
 
void push_bg_stencil ()
 push a copy of the current background stencil value onto the stack
 
void pop_bg_stencil ()
 pop the top of the current background stencil value from the stack
 
virtual void set_bg_stencil (int s)
 set a user defined background stencil value
 
int get_bg_stencil () const
 return the current stencil value for clearing the background
 
void push_bg_accum_color ()
 push a copy of the current background accumulation color onto the stack
 
void pop_bg_accum_color ()
 pop the top of the current background accumulation color from the stack
 
virtual void set_bg_accum_color (vec4 rgba)
 set a user defined background color for the accumulation buffer
 
void set_bg_accum_color (float r, float g, float b, float a)
 set a user defined background color for the accumulation buffer
 
vec4 get_bg_accum_color () const
 return the current color value for clearing the accumulation buffer
 
void put_bg_accum_color (float *rgba) const
 copy the current accumulation background rgba color into the given float array
 
void set_bg_accum_alpha (float a)
 set a user defined background alpha value for the accumulation buffer
 
float get_bg_accum_alpha () const
 return the current alpha value for clearing the accumulation buffer
 
virtual void clear_background (bool color_flag, bool depth_flag, bool stencil_flag=false, bool accum_flag=false)=0
 clear the buffer contents of the flagged buffers to the set background colors
 
virtual void post_redraw ()=0
 the context will be redrawn when the system is idle again
 
virtual void force_redraw ()=0
 the context will be redrawn right now. This method cannot be called inside the following methods of a drawable: init, init_frame, draw, finish_draw
 
virtual void announce_external_frame_buffer_change (void *&cgv_fbo_storage)=0
 announce an external frame buffer change performed with rendering API to the cgv framework providing space to temporarily store frame buffer of cgv framework
 
virtual void recover_from_external_frame_buffer_change (void *cgv_fbo_storage)=0
 restore cgv frame buffer to the state before the external change
 
font selection and measure
virtual void enable_font_face (media::font::font_face_ptr font_face, float font_size)
 enable the given font face with the given size in pixels
 
virtual float get_current_font_size () const
 return the size in pixels of the currently enabled font face
 
virtual media::font::font_face_ptr get_current_font_face () const
 return the currently enabled font face
 
surface rendering and material management
virtual void enable_phong_shading ()
 enable phong shading with the help of a shader (enabled by default)
 
virtual void disable_phong_shading ()
 
virtual void enable_material (const cgv::media::illum::phong_material &mat=cgv::media::illum::default_material(), MaterialSide ms=MS_FRONT_AND_BACK, float alpha=1)
 
virtual void disable_material (const cgv::media::illum::phong_material &mat=cgv::media::illum::default_material())
 
virtual void enable_material (const textured_material &mat, MaterialSide ms=MS_FRONT_AND_BACK, float alpha=1)
 
void set_gamma (float _gamma)
 set the current per channel gamma values to single value
 
virtual void set_gamma3 (const vec3 &_gamma3)
 set the current per channel gamma values to single value
 
float get_gamma () const
 query current gamma computed as average over gamma3 per channel values
 
vec3 get_gamma3 () const
 query current per color channel gamma
 
virtual void enable_sRGB_framebuffer (bool do_enable=true)
 enable or disable sRGB framebuffer
 
bool sRGB_framebuffer_enabled ()
 check whether sRGB framebuffer is enabled
 
const rgbaget_color () const
 return current color
 
virtual void set_color (const rgba &clr)
 set the current color
 
virtual void set_color (const rgb &clr, float opacity=1.0f)
 set the current color
 
virtual void set_material (const cgv::media::illum::surface_material &mat)
 set the current material
 
const cgv::media::illum::surface_materialget_current_material () const
 return pointer to current material or nullptr if no current material is available
 
virtual void set_textured_material (const textured_material &mat)
 set the current material
 
virtual void enable_material (textured_material &mat)=0
 enable a material with textures
 
virtual void disable_material (textured_material &mat)=0
 disable a material with textures
 
void set_current_gamma (shader_program &prog) const
 set the shader program gamma values
 
void set_current_view (shader_program &prog, bool modelview_deps=true, bool projection_deps=true) const
 set the shader program view matrices to the currently enabled view matrices
 
void set_current_material (shader_program &prog) const
 set the shader program material to the currently enabled material
 
void set_current_lights (shader_program &prog) const
 set the shader program lights to the currently enabled lights
 
vec3 get_light_eye_position (const cgv::media::illum::light_source &light, bool place_now) const
 helper function to place lights
 
vec3 get_light_eye_spot_direction (const cgv::media::illum::light_source &light, bool place_now) const
 helper function to place spot lights
 
virtual shader_programref_default_shader_program (bool texture_support=false)=0
 return a reference to a shader program used to render without illumination
 
virtual shader_programref_surface_shader_program (bool texture_support=false)=0
 return a reference to the default shader program used to render surfaces
 
virtual void enumerate_program_uniforms (shader_program &prog, std::vector< std::string > &names, std::vector< int > *locations_ptr=0, std::vector< int > *sizes_ptr=0, std::vector< int > *types_ptr=0, bool show=false) const =0
 get list of program uniforms
 
virtual void enumerate_program_attributes (shader_program &prog, std::vector< std::string > &names, std::vector< int > *locations_ptr=0, std::vector< int > *sizes_ptr=0, std::vector< int > *types_ptr=0, bool show=false) const =0
 get list of program attributes
 
lights
void * enable_light (const cgv::media::illum::light_source &light)
 
void disable_light (void *handle)
 
unsigned get_max_nr_lights () const
 
size_t get_nr_light_sources () const
 return the number of light sources
 
voidadd_light_source (const cgv::media::illum::light_source &light, bool enabled=true, bool place_now=false)
 add a new light source, enable it if enable is true and place it relative to current model view transformation if place_now is true; return handle to light source
 
bool remove_light_source (void *handle)
 remove a light source by handle and whether it existed
 
const cgv::media::illum::light_sourceget_light_source (void *handle) const
 read access to light source
 
const light_source_statusget_light_source_status (void *handle) const
 read access to light source status
 
void set_light_source (void *handle, const cgv::media::illum::light_source &light, bool place_now=true)
 set light source newly
 
void place_light_source (void *handle)
 place the given light source relative to current model viel transformation
 
virtual unsigned get_max_nr_enabled_light_sources () const
 return maximum number of light sources, that can be enabled in parallel
 
size_t get_nr_enabled_light_sources () const
 return the number of light sources
 
voidget_enabled_light_source_handle (size_t i) const
 access to handle of i-th light source
 
bool is_light_source_enabled (void *handle)
 check whether light source is enabled
 
bool enable_light_source (void *handle)
 enable a given light source and return whether there existed a light source with given handle
 
bool disable_light_source (void *handle)
 disable a given light source and return whether there existed a light source with given handle
 
size_t get_nr_default_light_sources () const
 return number of default light sources
 
const cgv::media::illum::light_sourceget_default_light_source (size_t i) const
 return i-th default light source
 
void set_default_light_source (size_t i, const cgv::media::illum::light_source &ls)
 set i-th default light source
 
text output
virtual std::ostream & output_stream ()
 returns an output stream whose output is printed at the current cursor location, which is managed by the context.
 
virtual void set_cursor (int x, int y)
 flush the output_stream and set a new cursor position given in opengl coordinates with (0,0) in lower left corner
 
virtual void get_cursor (int &x, int &y) const
 return current cursor location in opengl coordinates with (0,0) in lower left corner
 
virtual void put_cursor_coords (const vecn &p, int &x, int &y) const
 transform point p in current world coordinates into opengl coordinates with (0,0) in lower left corner and put x and y coordinates into the passed variables
 
virtual void set_cursor (const vecn &pos, const std::string &text="", TextAlignment ta=TA_BOTTOM_LEFT, int x_offset=0, int y_offset=0)
 flush output_stream and set the current text position from a 3D or 4D location in current world coordinates.
 
drawing
virtual void draw_edges_of_faces (const float *vertices, const float *normals, const float *tex_coords, const int *vertex_indices, const int *normal_indices, const int *tex_coord_indices, int nr_faces, int face_degree, bool flip_normals=false) const =0
 pass geometry of given faces to current shader program and generate draw calls to render lines for the edges
 
virtual void draw_edges_of_strip_or_fan (const float *vertices, const float *normals, const float *tex_coords, const int *vertex_indices, const int *normal_indices, const int *tex_coord_indices, int nr_faces, int face_degree, bool is_fan, bool flip_normals=false) const =0
 pass geometry of given strip or fan to current shader program and generate draw calls to render lines for the edges
 
virtual void draw_faces (const float *vertices, const float *normals, const float *tex_coords, const int *vertex_indices, const int *normal_indices, const int *tex_coord_indices, int nr_faces, int face_degree, bool flip_normals=false) const =0
 pass geometry of given faces to current shader program and generate draw calls to render triangles
 
virtual void draw_strip_or_fan (const float *vertices, const float *normals, const float *tex_coords, const int *vertex_indices, const int *normal_indices, const int *tex_coord_indices, int nr_faces, int face_degree, bool is_fan, bool flip_normals=false) const =0
 pass geometry of given strip or fan to current shader program and generate draw calls to render triangles
 
void tesselate_unit_square (bool flip_normals=false, bool edges=false)
 tesselate a unit square in the xy-plane with texture coordinates
 
void tesselate_unit_cube (bool flip_normals=false, bool edges=false)
 tesselate a unit cube with extent from [-1,-1,-1] to [1,1,1] with face normals that can be flipped
 
virtual void tesselate_box (const cgv::media::axis_aligned_box< double, 3 > &B, bool flip_normals, bool edges=false) const
 tesselate an axis aligned box
 
void tesselate_unit_prism (bool flip_normals=false, bool edges=false)
 tesselate a prism
 
void tesselate_unit_disk (int resolution=25, bool flip_normals=false, bool edges=false)
 tesselate a circular disk of radius 1
 
void tesselate_unit_cone (int resolution=25, bool flip_normals=false, bool edges=false)
 tesselate a cone of radius 1
 
void tesselate_unit_cylinder (int resolution=25, bool flip_normals=false, bool edges=false)
 tesselate a cylinder of radius 1
 
void tesselate_unit_sphere (int resolution=25, bool flip_normals=false, bool edges=false)
 tesselate a sphere of radius 1
 
void tesselate_unit_tetrahedron (bool flip_normals=false, bool edges=false)
 tesselate a tetrahedron
 
void tesselate_unit_octahedron (bool flip_normals=false, bool edges=false)
 tesselate a octahedron
 
void tesselate_unit_dodecahedron (bool flip_normals=false, bool edges=false)
 tesselate a dodecahedron
 
void tesselate_unit_icosahedron (bool flip_normals=false, bool edges=false)
 tesselate an icosahedron
 
void tesselate_unit_torus (float minor_radius=0.2f, int resolution=25, bool flip_normals=false, bool edges=false)
 tesselate a torus with major radius of one and given minor radius
 
virtual void tesselate_arrow (double length=1, double aspect=0.1, double rel_tip_radius=2.0, double tip_aspect=0.3, int res=25, bool edges=false)
 tesselate an arrow from the origin in z-direction
 
virtual void tesselate_arrow (const dvec3 &start, const dvec3 &end, double aspect=0.1f, double rel_tip_radius=2.0f, double tip_aspect=0.3f, int res=25, bool edges=false)
 define length and direction from start and end point and draw an arrow
 
virtual void draw_light_source (const cgv::media::illum::light_source &l, float intensity_scale, float light_scale)
 draw a light source with an emissive material
 
render state
void push_depth_test_state ()
 push a copy of the current depth test state onto the stack saved attributes: depth test enablement, depth test function
 
void pop_depth_test_state ()
 pop the top of the current depth test state from the stack
 
DepthTestState get_depth_test_state () const
 return the current depth test state
 
virtual void set_depth_test_state (DepthTestState state)
 set the depth test state
 
virtual void set_depth_func (CompareFunction func)
 set the depth test function
 
virtual void enable_depth_test ()
 enable the depth test
 
virtual void disable_depth_test ()
 disable the depth test
 
void push_cull_state ()
 push a copy of the current culling state onto the stack saved attributes: cull face enablement, cull face
 
void pop_cull_state ()
 pop the top of the current culling state from the stack
 
CullingMode get_cull_state () const
 return the current culling state
 
virtual void set_cull_state (CullingMode culling_mode)
 set the culling state
 
void push_blend_state ()
 push a copy of the current blend state onto the stack saved attributes: blend enablement, color and alpha source and destinatin functions
 
void pop_blend_state ()
 pop the top of the current culling state from the stack
 
BlendState get_blend_state () const
 return the current blend state
 
virtual void set_blend_state (BlendState state)
 set the complete blend state
 
virtual void set_blend_func (BlendFunction src_factor, BlendFunction dst_factor)
 set the blend function
 
virtual void set_blend_func_separate (BlendFunction src_color_factor, BlendFunction dst_color_factor, BlendFunction src_alpha_factor, BlendFunction dst_alpha_factor)
 set the blend function separately for color and alpha
 
void set_blend_func_front_to_back ()
 set the default blend function for front to back blending
 
void set_blend_func_back_to_front ()
 set the default blend function for back to front blending
 
virtual void enable_blending ()
 enable blending
 
virtual void disable_blending ()
 disable blending
 
void push_buffer_mask ()
 push a copy of the current buffer mask onto the stack saved attributes: depth mask, color mask
 
void pop_buffer_mask ()
 pop the top of the current buffer mask from the stack
 
BufferMask get_buffer_mask () const
 return the current buffer mask
 
virtual void set_buffer_mask (BufferMask mask)
 set the buffer mask for depth and color buffers
 
bool get_depth_mask () const
 get the depth buffer mask
 
virtual void set_depth_mask (bool flag)
 set the depth buffer mask
 
bvec4 get_color_mask () const
 get the color buffer mask
 
virtual void set_color_mask (bvec4 flags)
 set the color buffer mask
 
- Public Member Functions inherited from cgv::render::context_config
 context_config ()
 construct config with default parameters
 
bool self_reflect (cgv::reflect::reflection_handler &srh)
 reflect the shader_path member
 

Protected Member Functions

virtual void on_lights_changed ()
 helper function to send light update events
 
virtual void process_text (const std::string &text)
 callback method for processing of text from the output stream
 
virtual void draw_text (const std::string &text)
 draw some text at cursor position and update cursor position
 
virtual int query_integer_constant (ContextIntegerConstant cic) const =0
 
virtual void destruct_render_objects ()
 
virtual void put_id (void *handle, void *ptr) const =0
 
virtual cgv::data::component_format texture_find_best_format (const cgv::data::component_format &cf, render_component &rc, const std::vector< cgv::data::data_view > *palettes=0) const =0
 
virtual bool texture_create (texture_base &tb, cgv::data::data_format &df) const =0
 
virtual bool texture_create (texture_base &tb, cgv::data::data_format &target_format, const cgv::data::const_data_view &data, int level, int cube_side=-1, int num_array_layers=0, const std::vector< cgv::data::data_view > *palettes=0) const =0
 
virtual bool texture_create_from_buffer (texture_base &tb, cgv::data::data_format &df, int x, int y, int level) const =0
 
virtual bool texture_replace (texture_base &tb, int x, int y, int z_or_cube_side, const cgv::data::const_data_view &data, int level, const std::vector< cgv::data::data_view > *palettes=0) const =0
 
virtual bool texture_replace_from_buffer (texture_base &tb, int x, int y, int z_or_cube_side, int x_buffer, int y_buffer, unsigned int width, unsigned int height, int level) const =0
 
virtual bool texture_create_mipmaps (texture_base &tb, cgv::data::data_format &df) const =0
 
virtual bool texture_generate_mipmaps (texture_base &tb, unsigned int dim) const =0
 
virtual bool texture_destruct (texture_base &tb) const =0
 
virtual bool texture_set_state (const texture_base &tb) const =0
 
virtual bool texture_enable (texture_base &tb, int tex_unit, unsigned int nr_dims) const =0
 
virtual bool texture_disable (texture_base &tb, int tex_unit, unsigned int nr_dims) const =0
 
virtual bool texture_bind_as_image (texture_base &tb, int tex_unit, int level, bool bind_array, int layer, AccessType access) const =0
 
virtual bool render_buffer_create (render_buffer_base &rc, cgv::data::component_format &cf, int &_width, int &_height) const =0
 
virtual bool render_buffer_destruct (render_buffer_base &rc) const =0
 
virtual bool frame_buffer_create (frame_buffer_base &fbb) const
 
virtual bool frame_buffer_attach (frame_buffer_base &fbb, const render_buffer_base &rb, bool is_depth, int i) const
 
virtual bool frame_buffer_attach (frame_buffer_base &fbb, const texture_base &t, bool is_depth, int level, int i, int z) const
 
virtual bool frame_buffer_is_complete (const frame_buffer_base &fbb) const =0
 
virtual bool frame_buffer_enable (frame_buffer_base &fbb)
 
virtual bool frame_buffer_disable (frame_buffer_base &fbb)
 
virtual bool frame_buffer_destruct (frame_buffer_base &fbb) const
 
virtual void frame_buffer_blit (const frame_buffer_base *src_fbb_ptr, const ivec4 &S, frame_buffer_base *dst_fbb_ptr, const ivec4 &_D, BufferTypeBits btbs, bool interpolate) const =0
 
virtual int frame_buffer_get_max_nr_color_attachments () const =0
 
virtual int frame_buffer_get_max_nr_draw_buffers () const =0
 
virtual bool shader_code_create (render_component &sc, ShaderType st, const std::string &source) const =0
 
virtual bool shader_code_compile (render_component &sc) const =0
 
virtual void shader_code_destruct (render_component &sc) const =0
 
virtual bool shader_program_create (shader_program_base &spb) const =0
 
virtual void shader_program_attach (shader_program_base &spb, const render_component &sc) const =0
 
virtual void shader_program_detach (shader_program_base &spb, const render_component &sc) const =0
 
virtual bool shader_program_link (shader_program_base &spb) const
 
virtual bool shader_program_set_state (shader_program_base &spb) const =0
 
virtual bool shader_program_enable (shader_program_base &spb)
 
virtual bool shader_program_disable (shader_program_base &spb)
 
virtual bool shader_program_destruct (shader_program_base &spb) const
 
virtual int get_uniform_location (const shader_program_base &spb, const std::string &name) const =0
 
virtual bool set_uniform_void (shader_program_base &spb, int loc, type_descriptor value_type, const void *value_ptr) const =0
 
virtual bool set_uniform_array_void (shader_program_base &spb, int loc, type_descriptor value_type, const void *value_ptr, size_t nr_elements) const =0
 
virtual int get_attribute_location (const shader_program_base &spb, const std::string &name) const =0
 
virtual bool set_attribute_void (shader_program_base &spb, int loc, type_descriptor value_type, const void *value_ptr) const =0
 
virtual bool attribute_array_binding_create (attribute_array_binding_base &aab) const =0
 
virtual bool attribute_array_binding_destruct (attribute_array_binding_base &aab) const
 
virtual bool attribute_array_binding_enable (attribute_array_binding_base &aab)
 
virtual bool attribute_array_binding_disable (attribute_array_binding_base &aab)
 
virtual bool set_attribute_array_void (attribute_array_binding_base *aab, int loc, type_descriptor value_type, const vertex_buffer_base *vbb, const void *ptr, size_t nr_elements=0, unsigned stride_in_bytes=0) const =0
 
virtual bool set_element_array (attribute_array_binding_base *aab, const vertex_buffer_base *vbb) const =0
 
virtual bool enable_attribute_array (attribute_array_binding_base *aab, int loc, bool do_enable) const =0
 
virtual bool is_attribute_array_enabled (const attribute_array_binding_base *aab, int loc) const =0
 
virtual bool vertex_buffer_bind (const vertex_buffer_base &vbb, VertexBufferType _type, unsigned _idx=-1) const =0
 
virtual bool vertex_buffer_unbind (const vertex_buffer_base &vbb, VertexBufferType _type, unsigned _idx=-1) const =0
 
virtual bool vertex_buffer_create (vertex_buffer_base &vbb, const void *array_ptr, size_t size_in_bytes) const =0
 
virtual bool vertex_buffer_resize (vertex_buffer_base &vbb, const void *array_ptr, size_t size_in_bytes) const =0
 
virtual bool vertex_buffer_replace (vertex_buffer_base &vbb, size_t offset, size_t size_in_bytes, const void *array_ptr) const =0
 
virtual bool vertex_buffer_copy (const vertex_buffer_base &src, size_t src_offset, vertex_buffer_base &target, size_t target_offset, size_t size_in_bytes) const =0
 
virtual bool vertex_buffer_copy_back (vertex_buffer_base &vbb, size_t offset, size_t size_in_bytes, void *array_ptr) const =0
 
virtual bool vertex_buffer_destruct (vertex_buffer_base &vbb) const =0
 

Static Protected Member Functions

static void get_buffer_list (frame_buffer_base &fbb, bool &depth_buffer, std::vector< int > &buffers, int offset=0)
 

Protected Attributes

GPUVendorID gpu_vendor
 
bool use_shader_file_cache
 whether to use the caching facilities of shader_program and shader_code to store loaded shader file contents as strings for faster loading
 
bool auto_set_view_in_current_shader_program
 whether to automatically set viewing matrixes in current shader program, defaults to true
 
bool auto_set_lights_in_current_shader_program
 whether to automatically set lights in current shader program, defaults to true
 
bool auto_set_material_in_current_shader_program
 whether to automatically set material in current shader program, defaults to true
 
bool auto_set_gamma_in_current_shader_program
 whether to automatically set gamma in current shader program, defaults to true
 
bool support_compatibility_mode
 whether to support view and lighting management of compatibility mode, defaults to true
 
bool draw_in_compatibility_mode
 whether to do all drawing in compatibility mode, only possible if support_compatibility_mode is true, , defaults to false
 
bool debug_render_passes
 whether to debug render passes
 
bool enable_vsync
 whether vsync should be enabled
 
rgba current_color
 current color value
 
bool sRGB_framebuffer
 whether to use opengl option to support sRGB framebuffer
 
vec3 gamma3
 per color channel gamma value passed to shader programs that have gamma uniform
 
std::stack< vec4bg_color_stack
 stack of background colors
 
std::stack< float > bg_depth_stack
 stack of background depth values
 
std::stack< int > bg_stencil_stack
 stack of background stencil values
 
std::stack< vec4bg_accum_color_stack
 stack of background accumulation colors
 
std::stack< DepthTestStatedepth_test_state_stack
 stack of depth test states
 
std::stack< CullingModecull_state_stack
 stack of culling mode states
 
std::stack< BlendStateblend_state_stack
 stack of blend states
 
std::stack< BufferMaskbuffer_mask_stack
 stack of buffer masks
 
std::stack< dmat4modelview_matrix_stack
 keep two matrix stacks for model view and projection matrices
 
std::stack< dmat4projection_matrix_stack
 
std::stack< std::vector< window_transformation > > window_transformation_stack
 keep stack of window transformations
 
std::stack< frame_buffer_base * > frame_buffer_stack
 stack of currently enabled frame buffers
 
std::stack< shader_program_base * > shader_program_stack
 stack of currently enabled shader programs
 
std::stack< attribute_array_binding_base * > attribute_array_binding_stack
 stack of currently enabled attribute array binding
 
std::vector< void * > enabled_light_source_handles
 keep track of enabled light source handles
 
size_t light_source_handle
 counter to construct light source handles
 
std::map< void *, std::pair< cgv::media::illum::light_source, light_source_status > > light_sources
 map handle to light source and light source status information
 
cgv::media::illum::light_source default_light_source [nr_default_light_sources]
 default light sources
 
void * default_light_source_handles [nr_default_light_sources]
 handles of default light sources
 
cgv::media::illum::surface_material default_material
 store a default material
 
const cgv::media::illum::surface_materialcurrent_material_ptr
 store pointer to current material
 
bool current_material_is_textured
 store flag to tell whether current material is textured
 
std::stack< render_inforender_pass_stack
 store the current render pass
 
RenderPassFlags default_render_flags
 default render flags with which the main render pass is initialized
 
bool phong_shading
 whether to use phong shading
 
int current_background
 current back ground color index
 
int cursor_x
 current cursor location for textual output
 
int cursor_y
 
cgv::signal::callback_stream out_stream
 use a callback stream to write text to the opengl context
 
float current_font_size
 store current font size
 
cgv::media::font::font_face_ptr current_font_face
 store current font
 
int tab_size
 size a tabs
 
int x_offset
 offset in x and y direction where text starts
 
int y_offset
 
int nr_identations
 current number of indentations
 
bool at_line_begin
 store whether we are at the beginning of the line
 
bool do_screen_shot
 

Static Protected Attributes

static const unsigned nr_default_light_sources = 2
 number of default light sources
 

Friends

class CGV_API attribute_array_manager
 
class CGV_API render_component
 
class CGV_API texture
 
class CGV_API render_buffer
 
class CGV_API frame_buffer
 
class CGV_API shader_code
 
class CGV_API shader_program
 
class CGV_API attribute_array_binding
 
class CGV_API vertex_buffer
 
class shader_program_base
 

transformations

dmatn get_V () const
 
void set_V (const dmatn &V) const
 
void push_V ()
 
void pop_V ()
 
dmatn get_P () const
 
void set_P (const dmatn &P) const
 
void push_P ()
 
void pop_P ()
 
dmatn get_D () const
 
dmatn get_DPV () const
 
virtual void push_pixel_coords ()=0
 use this to push new modelview and new projection matrices onto the transformation stacks such that x and y coordinates correspond to opengl coordinates with (0,0) in lower left corner.
 
virtual void pop_pixel_coords ()=0
 pop previously pushed transformation matrices from modelview and projection stacks
 
virtual dmat4 get_modelview_matrix () const =0
 return homogeneous 4x4 viewing matrix, which transforms from world to eye space
 
virtual void set_modelview_matrix (const dmat4 &MV)
 set the current modelview matrix, which transforms from world to eye space
 
virtual void mul_modelview_matrix (const dmat4 &MV)
 multiply given matrix from right to current modelview matrix
 
void push_modelview_matrix ()
 push the current viewing matrix onto a matrix stack for viewing matrices.
 
void pop_modelview_matrix ()
 see push_V for an explanation
 
virtual dmat4 get_projection_matrix () const =0
 return homogeneous 4x4 projection matrix, which transforms from eye to clip space
 
virtual void set_projection_matrix (const dmat4 &P)
 set the current projection matrix, which transforms from eye to clip space
 
virtual void mul_projection_matrix (const dmat4 &P)
 multiply given matrix from right to current projection matrix
 
void push_projection_matrix ()
 same as push_V but for the projection matrix - a different matrix stack is used.
 
void pop_projection_matrix ()
 see push_P for an explanation
 
void push_window_transformation_array ()
 push a copy of the current viewport and depth range arrays defining the window transformations
 
virtual void pop_window_transformation_array ()
 restore previous viewport and depth range arrays defining the window transformations
 
virtual void announce_external_viewport_change (ivec4 &cgv_viewport_storage)=0
 announce an external viewport change performed with rendering API to the cgv framework providing space to temporarily store viewport of cgv framework
 
virtual void recover_from_external_viewport_change (const ivec4 &cgv_viewport_storage)=0
 restore cgv viewport to the state before the external change
 
virtual unsigned get_max_window_transformation_array_size () const =0
 query the maximum number of supported window transformations, which is at least 1
 
virtual void set_viewport (const ivec4 &viewport, int array_index=-1)
 set the current viewport or one of the viewports in the window transformation array
 
virtual void set_depth_range (const dvec2 &depth_range=dvec2(0, 1), int array_index=-1)
 set the current depth range or one of the depth ranges in the window transformation array
 
const std::vector< window_transformation > & get_window_transformation_array () const
 return the current window transformation array
 
dmat4 get_window_matrix (unsigned array_index=0) const
 return a homogeneous 4x4 matrix to transform clip to window coordinates
 
dmat4 get_modelview_projection_window_matrix (unsigned array_index=0) const
 return a homogeneous 4x4 matrix to transfrom from model to window coordinates, i.e. the product of modelview, projection and device matrix in reversed order (window_matrix*projection_matrix*modelview_matrix)
 
virtual double get_window_z (int x_window, int y_window) const =0
 read the window z-coordinate from the depth buffer for the given opengl x- and y-coordinates
 
vec3 get_model_point (int x_window, int y_window) const
 compute model space 3D point from the given opengl pixel location (window location)
 
vec3 get_model_point (int x_window, int y_window, double z_window) const
 compute model space 3D point from the given opengl pixel location (window location)
 
vec3 get_model_point (int x_window, int y_window, const dmat4 &modelview_projection_window_matrix) const
 compute model space 3D point from the given opengl pixel location (window location) and modelview_projection_window matrix
 
vec3 get_model_point (const vec3 &p_window) const
 compute model space 3D point from the given window space point
 
dmat4 get_device_matrix () const
 return homogeneous 4x4 projection matrix, which transforms from clip to device space
 
dmat4 get_modelview_projection_device_matrix () const
 return matrix to transfrom from model to device coordinates, i.e. the product of modelview, projection and device matrix in reversed order (device_matrix*projection_matrix*modelview_matrix)
 
double get_z_D (int x_D, int y_D) const
 read the window z-coordinate from the z-buffer for the given device x- and y-coordinates
 
vec3 get_point_W (int x_D, int y_D) const
 compute the location in world space of a device x/y-location. For this the device point is extended with the device z-coordinate currently stored in the displayed depth buffer.
 
vec3 get_point_W (int x_D, int y_D, const dmat4 &MPD) const
 compute the location in world space of a device x/y-location by inversion of the given transformation from world to device space. For this the device point is extended with the device z-coordinate currently stored in the displayed depth buffer.
 
vec3 get_point_W (int x_D, int y_D, double z_D) const
 compute the location in world space of a device point. For this the current world to device transformation is inverted.
 
vec3 get_point_W (int x_D, int y_D, double z_D, const dmat4 &MPD) const
 compute the location in world space of a device point by inversion of the given world to device transformation.
 
vec3 get_point_W (const vec3 &p_D) const
 compute a the location in world space of a device point.
 
vec3 get_point_W (const vec3 &p_D, const dmat4 &MPD) const
 compute a the location in world space of a device point.
 
bool ensure_window_transformation_index (int &array_index)
 
static vec3 get_model_point (int x_window, int y_window, double z_window, const dmat4 &modelview_projection_window_matrix)
 compute model space 3D point from the given opengl pixel location (window location) with the given modelview_projection_window matrix
 
static vec3 get_model_point (const dvec3 &p_window, const dmat4 &modelview_projection_window_matrix)
 compute model space 3D point from the given window space point and the given modelview_projection_window matrix
 

Additional Inherited Members

- Public Attributes inherited from cgv::render::context_config
bool depth_buffer
 default: true
 
bool double_buffer
 default: true
 
bool alpha_buffer
 default: false
 
bool stereo_buffer
 default: false
 
bool stencil_buffer
 default: false
 
bool accumulation_buffer
 default: false
 
bool multi_sample_buffer
 default: false
 
int depth_bits
 default: -1
 
int stencil_bits
 default: -1
 
int accumulation_bits
 default: -1
 
int nr_multi_samples
 default: -1
 
int version_major
 default: -1 ... major version of maximum supported OpenGL version
 
int version_minor
 default: -1 ... minor version of maximum supported OpenGL version
 
bool forward_compatible
 default: false
 
bool debug
 default: false in release and true in debug version
 
bool core_profile
 default: true
 
std::vector< int > context_creation_attrib_list
 provide integer vector to store context creation attribute list
 

Detailed Description

base class for all drawables, which is independent of the used rendering API.

Definition at line 620 of file context.h.

Constructor & Destructor Documentation

◆ context()

◆ ~context()

cgv::render::context::~context ( )
virtual

virtual destructor

Definition at line 236 of file context.cxx.

Member Function Documentation

◆ add_light_source()

void * cgv::render::context::add_light_source ( const cgv::media::illum::light_source light,
bool  enabled = true,
bool  place_now = false 
)

add a new light source, enable it if enable is true and place it relative to current model view transformation if place_now is true; return handle to light source

Definition at line 504 of file context.cxx.

References enabled_light_source_handles, get_light_eye_position(), get_light_eye_spot_direction(), light_source_handle, light_sources, and on_lights_changed().

Referenced by render_pass().

◆ announce_external_frame_buffer_change()

virtual void cgv::render::context::announce_external_frame_buffer_change ( void *&  cgv_fbo_storage)
pure virtual

announce an external frame buffer change performed with rendering API to the cgv framework providing space to temporarily store frame buffer of cgv framework

Implemented in cgv::render::gl::gl_context.

◆ announce_external_viewport_change()

virtual void cgv::render::context::announce_external_viewport_change ( ivec4 cgv_viewport_storage)
pure virtual

announce an external viewport change performed with rendering API to the cgv framework providing space to temporarily store viewport of cgv framework

Implemented in cgv::render::gl::gl_context.

◆ attribute_array_binding_destruct()

bool cgv::render::context::attribute_array_binding_destruct ( attribute_array_binding_base aab) const
protectedvirtual

Definition at line 2233 of file context.cxx.

◆ attribute_array_binding_disable()

bool cgv::render::context::attribute_array_binding_disable ( attribute_array_binding_base aab)
protectedvirtual

Definition at line 2280 of file context.cxx.

◆ attribute_array_binding_enable()

bool cgv::render::context::attribute_array_binding_enable ( attribute_array_binding_base aab)
protectedvirtual

Definition at line 2261 of file context.cxx.

◆ clear_background()

virtual void cgv::render::context::clear_background ( bool  color_flag,
bool  depth_flag,
bool  stencil_flag = false,
bool  accum_flag = false 
)
pure virtual

clear the buffer contents of the flagged buffers to the set background colors

Implemented in cgv::render::gl::gl_context.

Referenced by cgv::app::navigator::finish_draw().

◆ configure_new_child()

void cgv::render::context::configure_new_child ( cgv::base::base_ptr  child)
virtual

◆ destruct_render_objects()

void cgv::render::context::destruct_render_objects ( )
protectedvirtual

Definition at line 254 of file context.cxx.

◆ disable_blending()

void cgv::render::context::disable_blending ( )
virtual

disable blending

Reimplemented in cgv::render::gl::gl_context.

Definition at line 1760 of file context.cxx.

References blend_state_stack.

Referenced by cgv::render::gl::gl_context::disable_blending().

◆ disable_depth_test()

void cgv::render::context::disable_depth_test ( )
virtual

◆ disable_light()

void cgv::render::context::disable_light ( void *  handle)
inline

Definition at line 1128 of file context.h.

◆ disable_light_source()

bool cgv::render::context::disable_light_source ( void handle)

disable a given light source and return whether there existed a light source with given handle

Definition at line 700 of file context.cxx.

References enabled_light_source_handles, cgv::base::action::end(), light_sources, and on_lights_changed().

◆ disable_material() [1/2]

void cgv::render::context::disable_material ( const cgv::media::illum::phong_material mat = cgv::media::illum::default_material())
virtual

Definition at line 425 of file context.cxx.

◆ disable_material() [2/2]

virtual void cgv::render::context::disable_material ( textured_material mat)
pure virtual

disable a material with textures

Implemented in cgv::render::gl::gl_context.

◆ disable_phong_shading()

void cgv::render::context::disable_phong_shading ( )
virtual

Definition at line 414 of file context.cxx.

◆ disable_shader_file_cache()

void cgv::render::context::disable_shader_file_cache ( )

disable the usage of the shader file caches

Definition at line 457 of file context.cxx.

References use_shader_file_cache.

◆ draw_edges_of_faces()

virtual void cgv::render::context::draw_edges_of_faces ( const float *  vertices,
const float *  normals,
const float *  tex_coords,
const int *  vertex_indices,
const int *  normal_indices,
const int *  tex_coord_indices,
int  nr_faces,
int  face_degree,
bool  flip_normals = false 
) const
pure virtual

pass geometry of given faces to current shader program and generate draw calls to render lines for the edges

Implemented in cgv::render::gl::gl_context.

Referenced by tesselate_box(), tesselate_unit_cube(), tesselate_unit_disk(), cgv::render::tesselate_unit_dodecahedron_or_icosahedron(), tesselate_unit_octahedron(), tesselate_unit_prism(), tesselate_unit_square(), and tesselate_unit_tetrahedron().

◆ draw_edges_of_strip_or_fan()

virtual void cgv::render::context::draw_edges_of_strip_or_fan ( const float *  vertices,
const float *  normals,
const float *  tex_coords,
const int *  vertex_indices,
const int *  normal_indices,
const int *  tex_coord_indices,
int  nr_faces,
int  face_degree,
bool  is_fan,
bool  flip_normals = false 
) const
pure virtual

pass geometry of given strip or fan to current shader program and generate draw calls to render lines for the edges

Implemented in cgv::render::gl::gl_context.

Referenced by tesselate_unit_cone(), tesselate_unit_cylinder(), tesselate_unit_prism(), tesselate_unit_sphere(), and tesselate_unit_torus().

◆ draw_faces()

virtual void cgv::render::context::draw_faces ( const float *  vertices,
const float *  normals,
const float *  tex_coords,
const int *  vertex_indices,
const int *  normal_indices,
const int *  tex_coord_indices,
int  nr_faces,
int  face_degree,
bool  flip_normals = false 
) const
pure virtual

◆ draw_light_source()

void cgv::render::context::draw_light_source ( const cgv::media::illum::light_source l,
float  intensity_scale,
float  light_scale 
)
virtual

draw a light source with an emissive material

Parameters
[in]lto be rendered light source
[in]intensity_scaleused to multiply with the light source values

Reimplemented in cgv::render::gl::gl_context.

Definition at line 2032 of file context.cxx.

◆ draw_strip_or_fan()

virtual void cgv::render::context::draw_strip_or_fan ( const float *  vertices,
const float *  normals,
const float *  tex_coords,
const int *  vertex_indices,
const int *  normal_indices,
const int *  tex_coord_indices,
int  nr_faces,
int  face_degree,
bool  is_fan,
bool  flip_normals = false 
) const
pure virtual

pass geometry of given strip or fan to current shader program and generate draw calls to render triangles

Implemented in cgv::render::gl::gl_context.

Referenced by tesselate_unit_cone(), tesselate_unit_cylinder(), tesselate_unit_prism(), tesselate_unit_sphere(), and tesselate_unit_torus().

◆ draw_text()

void cgv::render::context::draw_text ( const std::string &  text)
protectedvirtual

draw some text at cursor position and update cursor position

Definition at line 888 of file context.cxx.

References current_font_face, cursor_x, and cgv::data::ref_ptr< T, is_ref_counted >::empty().

Referenced by process_text().

◆ draw_textual_info()

void cgv::render::context::draw_textual_info ( )
virtual

Definition at line 245 of file context.cxx.

◆ enable_blending()

◆ enable_depth_test()

void cgv::render::context::enable_depth_test ( )
virtual

enable the depth test

Reimplemented in cgv::render::gl::gl_context.

Definition at line 1691 of file context.cxx.

References depth_test_state_stack.

Referenced by cgv::render::gl::gl_context::enable_depth_test().

◆ enable_font_face()

void cgv::render::context::enable_font_face ( media::font::font_face_ptr  font_face,
float  font_size 
)
virtual

enable the given font face with the given size in pixels

Definition at line 906 of file context.cxx.

References current_font_face, and current_font_size.

Referenced by vr_test::init_frame().

◆ enable_light()

void * cgv::render::context::enable_light ( const cgv::media::illum::light_source light)
inline

Definition at line 1127 of file context.h.

◆ enable_light_source()

bool cgv::render::context::enable_light_source ( void handle)

enable a given light source and return whether there existed a light source with given handle

Definition at line 685 of file context.cxx.

References enabled_light_source_handles, cgv::base::action::end(), light_sources, and on_lights_changed().

◆ enable_material() [1/3]

void cgv::render::context::enable_material ( const cgv::media::illum::phong_material mat = cgv::media::illum::default_material(),
MaterialSide  ms = MS_FRONT_AND_BACK,
float  alpha = 1 
)
virtual

Definition at line 420 of file context.cxx.

◆ enable_material() [2/3]

void cgv::render::context::enable_material ( const textured_material mat,
MaterialSide  ms = MS_FRONT_AND_BACK,
float  alpha = 1 
)
virtual

Definition at line 429 of file context.cxx.

◆ enable_material() [3/3]

virtual void cgv::render::context::enable_material ( textured_material mat)
pure virtual

enable a material with textures

Implemented in cgv::render::gl::gl_context.

◆ enable_phong_shading()

void cgv::render::context::enable_phong_shading ( )
virtual

enable phong shading with the help of a shader (enabled by default)

Definition at line 408 of file context.cxx.

References error(), and phong_shading.

◆ enable_shader_file_cache()

void cgv::render::context::enable_shader_file_cache ( )

enable the usage of the shader file caches

Definition at line 451 of file context.cxx.

References use_shader_file_cache.

◆ enable_sRGB_framebuffer()

void cgv::render::context::enable_sRGB_framebuffer ( bool  do_enable = true)
virtual

enable or disable sRGB framebuffer

Definition at line 434 of file context.cxx.

References sRGB_framebuffer.

◆ ensure_window_transformation_index()

bool cgv::render::context::ensure_window_transformation_index ( int array_index)
protected

Definition at line 1880 of file context.cxx.

◆ enumerate_program_attributes()

virtual void cgv::render::context::enumerate_program_attributes ( shader_program prog,
std::vector< std::string > &  names,
std::vector< int > *  locations_ptr = 0,
std::vector< int > *  sizes_ptr = 0,
std::vector< int > *  types_ptr = 0,
bool  show = false 
) const
pure virtual

get list of program attributes

Implemented in cgv::render::gl::gl_context.

◆ enumerate_program_uniforms()

virtual void cgv::render::context::enumerate_program_uniforms ( shader_program prog,
std::vector< std::string > &  names,
std::vector< int > *  locations_ptr = 0,
std::vector< int > *  sizes_ptr = 0,
std::vector< int > *  types_ptr = 0,
bool  show = false 
) const
pure virtual

get list of program uniforms

Implemented in cgv::render::gl::gl_context.

◆ error()

void cgv::render::context::error ( const std::string &  message,
const render_component rc = 0 
) const
virtual

error handling

Definition at line 219 of file context.cxx.

References cgv::render::get_render_config().

Referenced by cgv::render::gl::gl_context::announce_external_frame_buffer_change(), cgv::render::gl::gl_context::announce_external_viewport_change(), cgv::render::gl::gl_context::configure_gl(), configure_new_child(), cgv::render::mesh_render_info::configure_vbos(), cgv::render::gl::cover_screen(), cgv::render::shader_program::disable(), cgv::render::attribute_array_binding::enable(), cgv::render::shader_program::enable(), enable_phong_shading(), cgv::render::gl::gl_context::frame_buffer_disable(), cgv::render::gl::gl_context::frame_buffer_is_complete(), get_window_matrix(), cgv::render::renderer::manage_singleton(), cgv::render::gl::gl_context::read_frame_buffer(), cgv::render::gl::gl_context::ref_default_shader_program(), cgv::render::gl::gl_context::ref_surface_shader_program(), cgv::render::shader_program::set_attribute(), cgv::render::shader_program::set_attribute(), cgv::render::shader_program::set_uniform(), cgv::render::shader_program::set_uniform_array(), cgv::render::shader_program::set_uniform_array(), cgv::render::gl::gl_context::tesselate_arrow(), cgv::render::arrow_renderer::validate_attributes(), cgv::render::group_renderer::validate_attributes(), cgv::render::normal_renderer::validate_attributes(), cgv::render::point_renderer::validate_attributes(), cgv::render::rectangle_renderer::validate_attributes(), cgv::render::renderer::validate_attributes(), cgv::render::slab_renderer::validate_attributes(), cgv::render::sphere_renderer::validate_attributes(), and cgv::render::surfel_renderer::validate_attributes().

◆ finish_render_pass()

void cgv::render::context::finish_render_pass ( )
virtual

Definition at line 260 of file context.cxx.

◆ frame_buffer_attach() [1/2]

bool cgv::render::context::frame_buffer_attach ( frame_buffer_base fbb,
const render_buffer_base rb,
bool  is_depth,
int  i 
) const
protectedvirtual

Definition at line 2340 of file context.cxx.

◆ frame_buffer_attach() [2/2]

bool cgv::render::context::frame_buffer_attach ( frame_buffer_base fbb,
const texture_base t,
bool  is_depth,
int  level,
int  i,
int  z 
) const
protectedvirtual

Reimplemented in cgv::render::gl::gl_context.

Definition at line 2358 of file context.cxx.

◆ frame_buffer_create()

bool cgv::render::context::frame_buffer_create ( frame_buffer_base fbb) const
protectedvirtual

Definition at line 2331 of file context.cxx.

◆ frame_buffer_destruct()

bool cgv::render::context::frame_buffer_destruct ( frame_buffer_base fbb) const
protectedvirtual

Definition at line 2410 of file context.cxx.

◆ frame_buffer_disable()

bool cgv::render::context::frame_buffer_disable ( frame_buffer_base fbb)
protectedvirtual

Reimplemented in cgv::render::gl::gl_context.

Definition at line 2395 of file context.cxx.

◆ frame_buffer_enable()

bool cgv::render::context::frame_buffer_enable ( frame_buffer_base fbb)
protectedvirtual

Definition at line 2376 of file context.cxx.

◆ frame_buffer_is_complete()

virtual bool cgv::render::context::frame_buffer_is_complete ( const frame_buffer_base fbb) const
protectedpure virtual

Implemented in cgv::render::gl::gl_context.

◆ get_bg_accum_alpha()

float cgv::render::context::get_bg_accum_alpha ( ) const

return the current alpha value for clearing the accumulation buffer

Definition at line 403 of file context.cxx.

References bg_accum_color_stack.

◆ get_bg_accum_color()

vec4 cgv::render::context::get_bg_accum_color ( ) const

return the current color value for clearing the accumulation buffer

Definition at line 387 of file context.cxx.

References bg_accum_color_stack.

Referenced by cgv::render::gl::gl_context::gl_context(), pop_bg_accum_color(), and push_bg_accum_color().

◆ get_bg_alpha()

float cgv::render::context::get_bg_alpha ( ) const

return the current alpha value for clearing the background

Definition at line 319 of file context.cxx.

References bg_color_stack.

◆ get_bg_clr_idx()

unsigned int cgv::render::context::get_bg_clr_idx ( ) const

return the current index of the background color

Definition at line 332 of file context.cxx.

References current_background.

◆ get_bg_color()

vec4 cgv::render::context::get_bg_color ( ) const

return the current color value for clearing the background

Definition at line 302 of file context.cxx.

References bg_color_stack.

Referenced by cgv::render::gl::gl_context::gl_context(), pop_bg_color(), and push_bg_color().

◆ get_bg_depth()

float cgv::render::context::get_bg_depth ( ) const

return the current depth value for clearing the background

Definition at line 349 of file context.cxx.

References bg_depth_stack.

Referenced by cgv::render::gl::gl_context::gl_context(), pop_bg_depth(), and push_bg_depth().

◆ get_bg_stencil()

int cgv::render::context::get_bg_stencil ( ) const

return the current stencil value for clearing the background

Definition at line 366 of file context.cxx.

References bg_stencil_stack.

Referenced by cgv::render::gl::gl_context::gl_context(), pop_bg_stencil(), and push_bg_stencil().

◆ get_blend_state()

context::BlendState cgv::render::context::get_blend_state ( ) const

return the current blend state

Definition at line 1725 of file context.cxx.

References blend_state_stack.

Referenced by cgv::render::gl::gl_context::gl_context(), pop_blend_state(), and push_blend_state().

◆ get_buffer_list()

void cgv::render::context::get_buffer_list ( frame_buffer_base fbb,
bool depth_buffer,
std::vector< int > &  buffers,
int  offset = 0 
)
staticprotected

Definition at line 2316 of file context.cxx.

◆ get_buffer_mask()

context::BufferMask cgv::render::context::get_buffer_mask ( ) const

return the current buffer mask

Definition at line 1773 of file context.cxx.

References buffer_mask_stack.

Referenced by cgv::render::gl::gl_context::gl_context(), pop_buffer_mask(), and push_buffer_mask().

◆ get_color()

const rgba & cgv::render::context::get_color ( ) const

return current color

Definition at line 1611 of file context.cxx.

References current_color.

◆ get_color_mask()

bvec4 cgv::render::context::get_color_mask ( ) const

get the color buffer mask

Definition at line 1789 of file context.cxx.

References buffer_mask_stack.

◆ get_cull_state()

CullingMode cgv::render::context::get_cull_state ( ) const

return the current culling state

Definition at line 1708 of file context.cxx.

References cull_state_stack.

Referenced by cgv::render::gl::gl_context::gl_context(), pop_cull_state(), and push_cull_state().

◆ get_current_font_face()

cgv::media::font::font_face_ptr cgv::render::context::get_current_font_face ( ) const
virtual

return the currently enabled font face

Reimplemented in cgv::render::gl::gl_context.

Definition at line 922 of file context.cxx.

References current_font_face.

Referenced by set_cursor().

◆ get_current_font_size()

float cgv::render::context::get_current_font_size ( ) const
virtual

return the size in pixels of the currently enabled font face

Reimplemented in cgv::render::gl::gl_context.

Definition at line 916 of file context.cxx.

References current_font_size.

Referenced by set_cursor().

◆ get_current_material()

const cgv::media::illum::surface_material * cgv::render::context::get_current_material ( ) const

return pointer to current material or nullptr if no current material is available

Definition at line 1605 of file context.cxx.

References current_material_ptr.

Referenced by cgv::render::render_info::draw().

◆ get_current_program()

shader_program_base * cgv::render::context::get_current_program ( ) const

check for current program, prepare it for rendering and return pointer to it

Definition at line 440 of file context.cxx.

References shader_program_stack.

Referenced by cgv::render::render_info::draw(), cgv::render::gl::gl_context::prepare_attributes(), and cgv::render::gl::gl_context::release_attributes().

◆ get_cursor()

void cgv::render::context::get_cursor ( int x,
int y 
) const
virtual

return current cursor location in opengl coordinates with (0,0) in lower left corner

store the current cursor location in the passed references to x and y coordinate

Definition at line 2010 of file context.cxx.

References cursor_x.

◆ get_D()

dmatn cgv::render::context::get_D ( ) const
inline

Definition at line 1340 of file context.h.

◆ get_debug_render_passes()

bool cgv::render::context::get_debug_render_passes ( ) const
inline

check whether render passes are debugged

Definition at line 919 of file context.h.

◆ get_default_light_source()

const cgv::media::illum::light_source & cgv::render::context::get_default_light_source ( size_t  i) const

return i-th default light source

Definition at line 717 of file context.cxx.

References default_light_source.

◆ get_default_render_pass_flags()

RenderPassFlags cgv::render::context::get_default_render_pass_flags ( ) const
virtual

return the default render pass flags

Definition at line 766 of file context.cxx.

References default_render_flags.

◆ get_depth_mask()

bool cgv::render::context::get_depth_mask ( ) const

get the depth buffer mask

Definition at line 1781 of file context.cxx.

References buffer_mask_stack.

◆ get_depth_test_state()

context::DepthTestState cgv::render::context::get_depth_test_state ( ) const

return the current depth test state

Definition at line 1678 of file context.cxx.

References depth_test_state_stack.

Referenced by cgv::render::gl::gl_context::gl_context(), pop_depth_test_state(), and push_depth_test_state().

◆ get_device_matrix()

dmat4 cgv::render::context::get_device_matrix ( ) const
inline

return homogeneous 4x4 projection matrix, which transforms from clip to device space

Definition at line 1455 of file context.h.

◆ get_DPV()

dmatn cgv::render::context::get_DPV ( ) const
inline

Definition at line 1341 of file context.h.

◆ get_enabled_light_source_handle()

void * cgv::render::context::get_enabled_light_source_handle ( size_t  i) const

access to handle of i-th light source

Definition at line 671 of file context.cxx.

References enabled_light_source_handles.

Referenced by cgv::render::gl::gl_context::on_lights_changed(), and set_current_lights().

◆ get_gamma()

float cgv::render::context::get_gamma ( ) const
inline

query current gamma computed as average over gamma3 per channel values

Definition at line 1080 of file context.h.

References cgv::math::fvec< T, N >::x(), cgv::math::fvec< T, N >::y(), and cgv::math::fvec< T, N >::z().

Referenced by set_current_gamma().

◆ get_gamma3()

vec3 cgv::render::context::get_gamma3 ( ) const
inline

query current per color channel gamma

Definition at line 1082 of file context.h.

Referenced by set_current_gamma().

◆ get_gpu_vendor_id()

GPUVendorID cgv::render::context::get_gpu_vendor_id ( ) const
virtual

device information

Definition at line 230 of file context.cxx.

Referenced by cgv::render::shader_code::read_code().

◆ get_light_eye_position()

vec3 cgv::render::context::get_light_eye_position ( const cgv::media::illum::light_source light,
bool  place_now 
) const

helper function to place lights

Definition at line 475 of file context.cxx.

References get_modelview_matrix().

Referenced by add_light_source(), and place_light_source().

◆ get_light_eye_spot_direction()

vec3 cgv::render::context::get_light_eye_spot_direction ( const cgv::media::illum::light_source light,
bool  place_now 
) const

helper function to place spot lights

helper function to place lights

Definition at line 489 of file context.cxx.

References get_modelview_matrix().

Referenced by add_light_source(), and place_light_source().

◆ get_light_source()

const cgv::media::illum::light_source & cgv::render::context::get_light_source ( void handle) const

read access to light source

Definition at line 548 of file context.cxx.

References light_sources.

Referenced by cgv::render::gl::gl_context::on_lights_changed().

◆ get_light_source_status()

const context::light_source_status & cgv::render::context::get_light_source_status ( void handle) const

read access to light source status

Definition at line 555 of file context.cxx.

References light_sources.

◆ get_max_nr_enabled_light_sources()

unsigned cgv::render::context::get_max_nr_enabled_light_sources ( ) const
virtual

return maximum number of light sources, that can be enabled in parallel

Definition at line 659 of file context.cxx.

Referenced by cgv::render::gl::set_lighting_parameters().

◆ get_max_nr_lights()

unsigned cgv::render::context::get_max_nr_lights ( ) const
inline

Definition at line 1129 of file context.h.

◆ get_max_window_transformation_array_size()

virtual unsigned cgv::render::context::get_max_window_transformation_array_size ( ) const
pure virtual

query the maximum number of supported window transformations, which is at least 1

Implemented in cgv::render::gl::gl_context.

◆ get_model_point() [1/6]

vec3 cgv::render::context::get_model_point ( const dvec3 p_window,
const dmat4 modelview_projection_window_matrix 
)
static

compute model space 3D point from the given window space point and the given modelview_projection_window matrix

the function inversely transforms the window space point with the given modelview_projection_window matrix

Definition at line 1949 of file context.cxx.

◆ get_model_point() [2/6]

vec3 cgv::render::context::get_model_point ( const vec3 p_window) const
inline

compute model space 3D point from the given window space point

the function inversely transforms the window space 3D point with the current modelview_projection_window matrix

Definition at line 1447 of file context.h.

◆ get_model_point() [3/6]

vec3 cgv::render::context::get_model_point ( int  x_window,
int  y_window 
) const
inline

compute model space 3D point from the given opengl pixel location (window location)

the function queries the window z coordinate from the depth buffer and inversely transforms the window space 3D point with the current modelview_projection_window matrix

Definition at line 1423 of file context.h.

Referenced by cgv::render::drawable::get_world_location().

◆ get_model_point() [4/6]

vec3 cgv::render::context::get_model_point ( int  x_window,
int  y_window,
const dmat4 modelview_projection_window_matrix 
) const
inline

compute model space 3D point from the given opengl pixel location (window location) and modelview_projection_window matrix

the function queries the window z coordinate from the depth buffer and inversely transforms the window space 3D point with the given modelview_projection_window matrix

Definition at line 1435 of file context.h.

◆ get_model_point() [5/6]

vec3 cgv::render::context::get_model_point ( int  x_window,
int  y_window,
double  z_window 
) const
inline

compute model space 3D point from the given opengl pixel location (window location)

the function inversely transforms the window space 3D point with the current modelview_projection_window matrix

Definition at line 1429 of file context.h.

◆ get_model_point() [6/6]

static vec3 cgv::render::context::get_model_point ( int  x_window,
int  y_window,
double  z_window,
const dmat4 modelview_projection_window_matrix 
)
inlinestatic

compute model space 3D point from the given opengl pixel location (window location) with the given modelview_projection_window matrix

the function inversely transforms the window space 3D point with the given modelview_projection_window matrix

Definition at line 1441 of file context.h.

◆ get_modelview_matrix()

◆ get_modelview_projection_device_matrix()

dmat4 cgv::render::context::get_modelview_projection_device_matrix ( ) const

return matrix to transfrom from model to device coordinates, i.e. the product of modelview, projection and device matrix in reversed order (device_matrix*projection_matrix*modelview_matrix)

return homogeneous 4x4 matrix, which transforms from world to device space

Definition at line 2017 of file context.cxx.

References get_modelview_matrix(), get_projection_matrix(), and get_window_matrix().

◆ get_modelview_projection_window_matrix()

dmat4 cgv::render::context::get_modelview_projection_window_matrix ( unsigned  array_index = 0) const

return a homogeneous 4x4 matrix to transfrom from model to window coordinates, i.e. the product of modelview, projection and device matrix in reversed order (window_matrix*projection_matrix*modelview_matrix)

Definition at line 1943 of file context.cxx.

References get_modelview_matrix(), get_projection_matrix(), and get_window_matrix().

Referenced by put_cursor_coords().

◆ get_nr_default_light_sources()

size_t cgv::render::context::get_nr_default_light_sources ( ) const
inline

return number of default light sources

Definition at line 1158 of file context.h.

◆ get_nr_enabled_light_sources()

size_t cgv::render::context::get_nr_enabled_light_sources ( ) const

return the number of light sources

Definition at line 665 of file context.cxx.

References enabled_light_source_handles.

Referenced by cgv::render::gl::gl_context::on_lights_changed(), and set_current_lights().

◆ get_nr_light_sources()

size_t cgv::render::context::get_nr_light_sources ( ) const

return the number of light sources

Definition at line 469 of file context.cxx.

References light_sources.

◆ get_P()

dmatn cgv::render::context::get_P ( ) const
inline

Definition at line 1336 of file context.h.

◆ get_point_W() [1/6]

vec3 cgv::render::context::get_point_W ( const vec3 p_D) const
inline

compute a the location in world space of a device point.

Definition at line 1469 of file context.h.

◆ get_point_W() [2/6]

vec3 cgv::render::context::get_point_W ( const vec3 p_D,
const dmat4 MPD 
) const
inline

compute a the location in world space of a device point.

Definition at line 1471 of file context.h.

◆ get_point_W() [3/6]

vec3 cgv::render::context::get_point_W ( int  x_D,
int  y_D 
) const
inline

compute the location in world space of a device x/y-location. For this the device point is extended with the device z-coordinate currently stored in the displayed depth buffer.

Definition at line 1461 of file context.h.

◆ get_point_W() [4/6]

vec3 cgv::render::context::get_point_W ( int  x_D,
int  y_D,
const dmat4 MPD 
) const
inline

compute the location in world space of a device x/y-location by inversion of the given transformation from world to device space. For this the device point is extended with the device z-coordinate currently stored in the displayed depth buffer.

Definition at line 1463 of file context.h.

◆ get_point_W() [5/6]

vec3 cgv::render::context::get_point_W ( int  x_D,
int  y_D,
double  z_D 
) const
inline

compute the location in world space of a device point. For this the current world to device transformation is inverted.

Definition at line 1465 of file context.h.

◆ get_point_W() [6/6]

vec3 cgv::render::context::get_point_W ( int  x_D,
int  y_D,
double  z_D,
const dmat4 MPD 
) const
inline

compute the location in world space of a device point by inversion of the given world to device transformation.

Definition at line 1467 of file context.h.

◆ get_projection_matrix()

virtual dmat4 cgv::render::context::get_projection_matrix ( ) const
pure virtual

◆ get_render_api()

virtual RenderAPI cgv::render::context::get_render_api ( ) const
pure virtual

return the used rendering API

Implemented in cgv::render::gl::gl_context.

◆ get_render_pass()

RenderPass cgv::render::context::get_render_pass ( ) const
virtual

return the current render pass

Definition at line 751 of file context.cxx.

References render_pass_stack, and cgv::render::RP_NONE.

Referenced by vr_view_interactor::after_finish(), and vr_view_interactor::init_frame().

◆ get_render_pass_flags()

RenderPassFlags cgv::render::context::get_render_pass_flags ( ) const
virtual

return the current render pass flags

Definition at line 758 of file context.cxx.

References render_pass_stack, and cgv::render::RPF_NONE.

Referenced by cgv::render::multi_pass_drawable::perform_render_pass(), and render_pass().

◆ get_render_pass_recursion_depth()

unsigned cgv::render::context::get_render_pass_recursion_depth ( ) const

return current render pass recursion depth

return the current render pass

Definition at line 745 of file context.cxx.

References render_pass_stack.

Referenced by cgv::render::multi_pass_drawable::initiate_render_pass_recursion(), cgv::render::multi_pass_drawable::multi_pass_ignore_finish(), and cgv::render::multi_pass_drawable::multi_pass_terminate().

◆ get_render_pass_user_data()

void * cgv::render::context::get_render_pass_user_data ( ) const
virtual

return the current render pass user data

Definition at line 779 of file context.cxx.

References render_pass_stack.

Referenced by cgv::render::multi_pass_drawable::multi_pass_ignore_finish().

◆ get_V()

dmatn cgv::render::context::get_V ( ) const
inline

Definition at line 1332 of file context.h.

◆ get_window_matrix()

dmat4 cgv::render::context::get_window_matrix ( unsigned  array_index = 0) const

return a homogeneous 4x4 matrix to transform clip to window coordinates

return a homogeneous 4x4 matrix to transform clip to window coordinates, optionally specify for the case of multiple viewports/depth ranges

In window coordinates x- and y-coordinates correspond to opengl pixel coordinates with (0,0) in lower left corner and z corresponds to depth value stored in the depth buffer. This is the same convention as in gl_FragCoord and gl_FragDepth of GLSL. Optionally one can specify a window transformation index with the parameter array_index for the case when an array of window transformations is used.

Definition at line 1921 of file context.cxx.

References error(), cgv::utils::to_string(), and window_transformation_stack.

Referenced by get_modelview_projection_device_matrix(), and get_modelview_projection_window_matrix().

◆ get_window_transformation_array()

const std::vector< window_transformation > & cgv::render::context::get_window_transformation_array ( ) const

return the current window transformation array

Definition at line 1915 of file context.cxx.

References window_transformation_stack.

Referenced by cgv::app::gizmo::handle().

◆ get_window_z()

virtual double cgv::render::context::get_window_z ( int  x_window,
int  y_window 
) const
pure virtual

read the window z-coordinate from the depth buffer for the given opengl x- and y-coordinates

Implemented in cgv::render::gl::gl_context.

Referenced by cgv::render::drawable::get_world_location().

◆ get_z_D()

double cgv::render::context::get_z_D ( int  x_D,
int  y_D 
) const
inline

read the window z-coordinate from the z-buffer for the given device x- and y-coordinates

Definition at line 1459 of file context.h.

◆ init_render_pass()

void cgv::render::context::init_render_pass ( )
virtual

Definition at line 240 of file context.cxx.

◆ is_light_source_enabled()

bool cgv::render::context::is_light_source_enabled ( void handle)

check whether light source is enabled

Definition at line 676 of file context.cxx.

References cgv::base::action::end(), and light_sources.

◆ is_shader_file_cache_enabled()

bool cgv::render::context::is_shader_file_cache_enabled ( ) const

whether the shader file caches are enabled

Definition at line 463 of file context.cxx.

References use_shader_file_cache.

Referenced by cgv::render::shader_program::attach_files(), cgv::render::shader_program::attach_program(), and cgv::render::shader_code::read_code().

◆ mul_modelview_matrix()

◆ mul_projection_matrix()

void cgv::render::context::mul_projection_matrix ( const dmat4 P)
virtual

multiply given matrix from right to current projection matrix

Definition at line 1831 of file context.cxx.

References get_projection_matrix(), and set_projection_matrix().

◆ on_lights_changed()

void cgv::render::context::on_lights_changed ( )
protectedvirtual

◆ output_stream()

std::ostream & cgv::render::context::output_stream ( )
virtual

returns an output stream whose output is printed at the current cursor location, which is managed by the context.

returns an output stream whose output is printed at the current cursor location

The coordinate system of the cursor location corresponds to opengl coordinates with (0,0) in lower left corner. The cursor position is updated during text drawing also by special characters like tab or new line and can be read back with the get_cursor method. Use the flush method of the output_stream to ensure that text has been drawn to the context.

Definition at line 901 of file context.cxx.

References out_stream.

Referenced by vr_test::init_frame(), and set_cursor().

◆ perform_screen_shot()

void cgv::render::context::perform_screen_shot ( )
virtual

Definition at line 250 of file context.cxx.

◆ place_light_source()

void cgv::render::context::place_light_source ( void handle)

place the given light source relative to current model viel transformation

Definition at line 648 of file context.cxx.

References get_light_eye_position(), get_light_eye_spot_direction(), light_sources, and on_lights_changed().

Referenced by render_pass(), and set_light_source().

◆ pop_bg_accum_color()

void cgv::render::context::pop_bg_accum_color ( )

pop the top of the current background accumulation color from the stack

Definition at line 374 of file context.cxx.

References bg_accum_color_stack, get_bg_accum_color(), and set_bg_accum_color().

◆ pop_bg_color()

void cgv::render::context::pop_bg_color ( )

pop the top of the current background color from the stack

Definition at line 288 of file context.cxx.

References bg_color_stack, get_bg_color(), and set_bg_color().

Referenced by cgv::app::navigator::finish_draw().

◆ pop_bg_depth()

void cgv::render::context::pop_bg_depth ( )

pop the top of the current background depth value from the stack

Definition at line 340 of file context.cxx.

References bg_depth_stack, get_bg_depth(), and set_bg_depth().

◆ pop_bg_stencil()

void cgv::render::context::pop_bg_stencil ( )

pop the top of the current background stencil value from the stack

Definition at line 357 of file context.cxx.

References bg_stencil_stack, get_bg_stencil(), and set_bg_stencil().

◆ pop_blend_state()

void cgv::render::context::pop_blend_state ( )

◆ pop_buffer_mask()

void cgv::render::context::pop_buffer_mask ( )

pop the top of the current buffer mask from the stack

Definition at line 1768 of file context.cxx.

References buffer_mask_stack, get_buffer_mask(), and set_buffer_mask().

◆ pop_cull_state()

void cgv::render::context::pop_cull_state ( )

pop the top of the current culling state from the stack

Definition at line 1703 of file context.cxx.

References cull_state_stack, get_cull_state(), and set_cull_state().

Referenced by cgv::render::volume_renderer::disable(), and cgv::render::gl::gl_context::draw_light_source().

◆ pop_depth_test_state()

void cgv::render::context::pop_depth_test_state ( )

pop the top of the current depth test state from the stack

Definition at line 1673 of file context.cxx.

References depth_test_state_stack, get_depth_test_state(), and set_depth_test_state().

Referenced by cgv::render::volume_renderer::disable(), cgv::app::navigator::finish_draw(), and cgv::app::gizmo::finish_frame().

◆ pop_modelview_matrix()

◆ pop_P()

void cgv::render::context::pop_P ( )
inline

Definition at line 1339 of file context.h.

◆ pop_pixel_coords()

virtual void cgv::render::context::pop_pixel_coords ( )
pure virtual

pop previously pushed transformation matrices from modelview and projection stacks

Implemented in cgv::render::gl::gl_context.

Referenced by cgv::render::gl::gl_performance_monitor::draw(), vr_test::init_frame(), and process_text().

◆ pop_projection_matrix()

void cgv::render::context::pop_projection_matrix ( )

◆ pop_V()

void cgv::render::context::pop_V ( )
inline

Definition at line 1335 of file context.h.

◆ pop_window_transformation_array()

void cgv::render::context::pop_window_transformation_array ( )
virtual

restore previous viewport and depth range arrays defining the window transformations

recover the previous viewport and depth range settings; an error is emitted if the window_transformation stack becomes empty

An error is emitted when the method fails because the stack of window transformations would become empty, which is not allowed.

Reimplemented in cgv::render::gl::gl_context.

Definition at line 1875 of file context.cxx.

References window_transformation_stack.

Referenced by cgv::render::frame_buffer::pop_viewport(), cgv::render::gl::gl_context::pop_window_transformation_array(), and cgv::render::gl::render_to_texture3D().

◆ process_text()

void cgv::render::context::process_text ( const std::string &  text)
protectedvirtual

callback method for processing of text from the output stream

Definition at line 843 of file context.cxx.

References at_line_begin, current_font_size, cursor_x, draw_text(), nr_identations, pop_pixel_coords(), push_pixel_coords(), tab_size, and x_offset.

◆ push_bg_accum_color()

void cgv::render::context::push_bg_accum_color ( )

push a copy of the current background accumulation color onto the stack

Definition at line 370 of file context.cxx.

References bg_accum_color_stack, and get_bg_accum_color().

◆ push_bg_color()

void cgv::render::context::push_bg_color ( )

push a copy of the current background color onto the stack

Definition at line 284 of file context.cxx.

References bg_color_stack, and get_bg_color().

Referenced by cgv::app::navigator::finish_draw().

◆ push_bg_depth()

void cgv::render::context::push_bg_depth ( )

push a copy of the current background depth value onto the stack

Definition at line 336 of file context.cxx.

References bg_depth_stack, and get_bg_depth().

◆ push_bg_stencil()

void cgv::render::context::push_bg_stencil ( )

push a copy of the current background stencil value onto the stack

Definition at line 353 of file context.cxx.

References bg_stencil_stack, and get_bg_stencil().

◆ push_blend_state()

void cgv::render::context::push_blend_state ( )

push a copy of the current blend state onto the stack saved attributes: blend enablement, color and alpha source and destinatin functions

Definition at line 1716 of file context.cxx.

References blend_state_stack, and get_blend_state().

Referenced by cgv::render::rectangle_renderer::enable(), cgv::render::volume_renderer::enable(), cgv::app::navigator::finish_draw(), and cgv::app::gizmo::finish_frame().

◆ push_buffer_mask()

void cgv::render::context::push_buffer_mask ( )

push a copy of the current buffer mask onto the stack saved attributes: depth mask, color mask

Definition at line 1764 of file context.cxx.

References buffer_mask_stack, and get_buffer_mask().

◆ push_cull_state()

void cgv::render::context::push_cull_state ( )

push a copy of the current culling state onto the stack saved attributes: cull face enablement, cull face

Definition at line 1699 of file context.cxx.

References cull_state_stack, and get_cull_state().

Referenced by cgv::render::gl::gl_context::draw_light_source(), and cgv::render::volume_renderer::enable().

◆ push_depth_test_state()

void cgv::render::context::push_depth_test_state ( )

push a copy of the current depth test state onto the stack saved attributes: depth test enablement, depth test function

Definition at line 1669 of file context.cxx.

References depth_test_state_stack, and get_depth_test_state().

Referenced by cgv::render::volume_renderer::enable(), cgv::app::navigator::finish_draw(), and cgv::app::gizmo::finish_frame().

◆ push_modelview_matrix()

void cgv::render::context::push_modelview_matrix ( )

push the current viewing matrix onto a matrix stack for viewing matrices.

A software implementation is used for the matrix stack as some hardware stacks - i.e. in opengl - have strong limitations on their maximum size. The push_V method does not change the current viewing matrix similarly to the glPushMatrix function. Use pop_V() to restore the pushed viewing matrix into the current viewing matrix. Don't intermix these methods with the correspondong opengl or directx functions.

Definition at line 1802 of file context.cxx.

References get_modelview_matrix(), and modelview_matrix_stack.

Referenced by cgv::render::gl::cover_screen(), cgv::plot::plot2d::draw(), cgv::plot::plot3d::draw(), vr_test::draw(), cgv::render::gl::image_drawable::draw(), cgv::render::volume_renderer::draw(), cgv::render::gl::gl_context::draw_light_source(), vr_view_interactor::draw_vr_kits(), cgv::app::navigator::finish_draw(), vr_test::finish_draw(), cgv::app::gizmo::finish_frame(), cgv::render::gl::gl_context::push_pixel_coords(), cgv::render::gl::gl_context::tesselate_arrow(), and cgv::render::gl::gl_context::tesselate_arrow().

◆ push_P()

void cgv::render::context::push_P ( )
inline

Definition at line 1338 of file context.h.

◆ push_pixel_coords()

virtual void cgv::render::context::push_pixel_coords ( )
pure virtual

use this to push new modelview and new projection matrices onto the transformation stacks such that x and y coordinates correspond to opengl coordinates with (0,0) in lower left corner.

To transform mouse pointer coordinates to opengl coordinates use get_context()->get_height()-1-mouse_y.

Implemented in cgv::render::gl::gl_context.

Referenced by cgv::render::gl::gl_performance_monitor::draw(), vr_test::init_frame(), and process_text().

◆ push_projection_matrix()

void cgv::render::context::push_projection_matrix ( )

same as push_V but for the projection matrix - a different matrix stack is used.

Definition at line 1820 of file context.cxx.

References get_projection_matrix().

Referenced by cgv::render::gl::cover_screen(), cgv::app::navigator::finish_draw(), and cgv::render::gl::gl_context::push_pixel_coords().

◆ push_V()

void cgv::render::context::push_V ( )
inline

Definition at line 1334 of file context.h.

◆ push_window_transformation_array()

void cgv::render::context::push_window_transformation_array ( )

push a copy of the current viewport and depth range arrays defining the window transformations

Definition at line 1870 of file context.cxx.

References window_transformation_stack.

Referenced by cgv::render::frame_buffer::push_viewport(), and cgv::render::gl::render_to_texture3D().

◆ put_bg_accum_color()

void cgv::render::context::put_bg_accum_color ( float rgba) const

copy the current accumulation background rgba color into the given float array

Definition at line 391 of file context.cxx.

References bg_accum_color_stack.

◆ put_bg_color()

void cgv::render::context::put_bg_color ( float rgba) const

copy the current background rgba color into the given float array

Definition at line 306 of file context.cxx.

References bg_color_stack.

◆ put_cursor_coords()

void cgv::render::context::put_cursor_coords ( const vecn p,
int x,
int y 
) const
virtual

transform point p in current world coordinates into opengl coordinates with (0,0) in lower left corner and put x and y coordinates into the passed variables

transform point p into cursor coordinates and put x and y coordinates into the passed variables

Definition at line 1971 of file context.cxx.

References get_modelview_projection_window_matrix(), and cgv::math::vec< T >::size().

Referenced by set_cursor().

◆ read_frame_buffer()

virtual bool cgv::render::context::read_frame_buffer ( data::data_view dv,
unsigned int  x = 0,
unsigned int  y = 0,
FrameBufferType  buffer_type = FB_BACK,
cgv::type::info::TypeId  type = cgv::type::info::TI_UINT8,
data::ComponentFormat  cf = data::CF_RGB,
int  w = -1,
int  h = -1 
)
pure virtual

read the current frame buffer or a rectangular region of it into the given data view.

If no format is associated with the data view, a new format is created and assigned to the data view.

If width and height are not specified in the format associated with the data view or in the parameters, they are determined from the current viewport size.

x and y specify the pixel offset of the region measured from the left upper corner.

The parameter buffer_type is only used in case of reading color or alpha components and specifies from which color buffer to read the data.

Implemented in cgv::render::gl::gl_context.

Referenced by write_frame_buffer_to_image(), and cgv::render::texture::write_to_file().

◆ recover_from_external_frame_buffer_change()

virtual void cgv::render::context::recover_from_external_frame_buffer_change ( void *  cgv_fbo_storage)
pure virtual

restore cgv frame buffer to the state before the external change

Implemented in cgv::render::gl::gl_context.

Referenced by vr_view_interactor::after_finish().

◆ recover_from_external_viewport_change()

virtual void cgv::render::context::recover_from_external_viewport_change ( const ivec4 cgv_viewport_storage)
pure virtual

restore cgv viewport to the state before the external change

Implemented in cgv::render::gl::gl_context.

Referenced by vr_view_interactor::after_finish().

◆ recreate_context()

bool cgv::render::context::recreate_context ( )
virtual

recreate context based on current context config settings

Definition at line 59 of file context.cxx.

◆ ref_default_shader_program()

virtual shader_program & cgv::render::context::ref_default_shader_program ( bool  texture_support = false)
pure virtual

◆ ref_surface_shader_program()

virtual shader_program & cgv::render::context::ref_surface_shader_program ( bool  texture_support = false)
pure virtual

◆ remove_light_source()

bool cgv::render::context::remove_light_source ( void handle)

remove a light source by handle and whether it existed

Definition at line 528 of file context.cxx.

References enabled_light_source_handles, cgv::base::action::end(), light_sources, and on_lights_changed().

◆ render_pass()

◆ set_bg_accum_alpha()

void cgv::render::context::set_bg_accum_alpha ( float  a)

set a user defined background alpha value for the accumulation buffer

Definition at line 399 of file context.cxx.

References bg_accum_color_stack.

◆ set_bg_accum_color() [1/2]

void cgv::render::context::set_bg_accum_color ( float  r,
float  g,
float  b,
float  a 
)

set a user defined background color for the accumulation buffer

Definition at line 383 of file context.cxx.

References set_bg_accum_color().

◆ set_bg_accum_color() [2/2]

void cgv::render::context::set_bg_accum_color ( vec4  rgba)
virtual

set a user defined background color for the accumulation buffer

Reimplemented in cgv::render::gl::gl_context.

Definition at line 379 of file context.cxx.

References bg_accum_color_stack.

Referenced by pop_bg_accum_color(), set_bg_accum_color(), and cgv::render::gl::gl_context::set_bg_accum_color().

◆ set_bg_alpha()

void cgv::render::context::set_bg_alpha ( float  a)

set a user defined background alpha value

Definition at line 314 of file context.cxx.

References bg_color_stack.

◆ set_bg_clr_idx()

void cgv::render::context::set_bg_clr_idx ( unsigned int  idx)

set an indexed background color

Definition at line 323 of file context.cxx.

References current_background, and set_bg_color().

◆ set_bg_color() [1/2]

void cgv::render::context::set_bg_color ( float  r,
float  g,
float  b,
float  a 
)

set a user defined background color

Definition at line 297 of file context.cxx.

References set_bg_color().

◆ set_bg_color() [2/2]

void cgv::render::context::set_bg_color ( vec4  rgba)
virtual

set a user defined background color

Reimplemented in cgv::render::gl::gl_context.

Definition at line 293 of file context.cxx.

References bg_color_stack.

Referenced by cgv::app::navigator::finish_draw(), pop_bg_color(), set_bg_clr_idx(), set_bg_color(), and cgv::render::gl::gl_context::set_bg_color().

◆ set_bg_depth()

void cgv::render::context::set_bg_depth ( float  d)
virtual

set a user defined background depth value

Reimplemented in cgv::render::gl::gl_context.

Definition at line 345 of file context.cxx.

References bg_depth_stack.

Referenced by pop_bg_depth(), and cgv::render::gl::gl_context::set_bg_depth().

◆ set_bg_stencil()

void cgv::render::context::set_bg_stencil ( int  s)
virtual

set a user defined background stencil value

Reimplemented in cgv::render::gl::gl_context.

Definition at line 362 of file context.cxx.

References bg_stencil_stack.

Referenced by pop_bg_stencil(), and cgv::render::gl::gl_context::set_bg_stencil().

◆ set_blend_func()

◆ set_blend_func_back_to_front()

void cgv::render::context::set_blend_func_back_to_front ( )

set the default blend function for back to front blending

Definition at line 1752 of file context.cxx.

References set_blend_func().

Referenced by cgv::render::rectangle_renderer::enable(), cgv::render::volume_renderer::enable(), and cgv::app::gizmo::finish_frame().

◆ set_blend_func_front_to_back()

void cgv::render::context::set_blend_func_front_to_back ( )

set the default blend function for front to back blending

Definition at line 1749 of file context.cxx.

References set_blend_func().

◆ set_blend_func_separate()

void cgv::render::context::set_blend_func_separate ( BlendFunction  src_color_factor,
BlendFunction  dst_color_factor,
BlendFunction  src_alpha_factor,
BlendFunction  dst_alpha_factor 
)
virtual

◆ set_blend_state()

void cgv::render::context::set_blend_state ( BlendState  state)
virtual

set the complete blend state

Reimplemented in cgv::render::gl::gl_context.

Definition at line 1729 of file context.cxx.

References blend_state_stack.

Referenced by pop_blend_state(), and cgv::render::gl::gl_context::set_blend_state().

◆ set_buffer_mask()

void cgv::render::context::set_buffer_mask ( BufferMask  mask)
virtual

set the buffer mask for depth and color buffers

Reimplemented in cgv::render::gl::gl_context.

Definition at line 1777 of file context.cxx.

References buffer_mask_stack.

Referenced by pop_buffer_mask(), and cgv::render::gl::gl_context::set_buffer_mask().

◆ set_color() [1/2]

virtual void cgv::render::context::set_color ( const rgb clr,
float  opacity = 1.0f 
)
inlinevirtual

set the current color

Definition at line 1092 of file context.h.

References set_color().

Referenced by set_color().

◆ set_color() [2/2]

◆ set_color_mask()

void cgv::render::context::set_color_mask ( bvec4  flags)
virtual

set the color buffer mask

Reimplemented in cgv::render::gl::gl_context.

Definition at line 1794 of file context.cxx.

References buffer_mask_stack.

Referenced by cgv::render::gl::gl_context::set_color_mask().

◆ set_cull_state()

void cgv::render::context::set_cull_state ( CullingMode  culling_mode)
virtual

set the culling state

Reimplemented in cgv::render::gl::gl_context.

Definition at line 1712 of file context.cxx.

References cull_state_stack.

Referenced by cgv::render::volume_renderer::enable(), pop_cull_state(), and cgv::render::gl::gl_context::set_cull_state().

◆ set_current_gamma()

void cgv::render::context::set_current_gamma ( shader_program prog) const

set the shader program gamma values

Definition at line 1580 of file context.cxx.

References get_gamma(), get_gamma3(), cgv::render::shader_program::get_uniform_location(), and cgv::render::shader_program::set_uniform().

Referenced by set_gamma3().

◆ set_current_lights()

void cgv::render::context::set_current_lights ( shader_program prog) const

◆ set_current_material()

void cgv::render::context::set_current_material ( shader_program prog) const

set the shader program material to the currently enabled material

Definition at line 605 of file context.cxx.

References current_material_is_textured, current_material_ptr, and cgv::render::shader_program::set_material_uniform().

◆ set_current_view()

void cgv::render::context::set_current_view ( shader_program prog,
bool  modelview_deps = true,
bool  projection_deps = true 
) const

set the shader program view matrices to the currently enabled view matrices

Definition at line 576 of file context.cxx.

References modelview_matrix_stack, and cgv::render::shader_program::set_uniform().

Referenced by set_modelview_matrix(), and set_projection_matrix().

◆ set_cursor() [1/2]

void cgv::render::context::set_cursor ( const vecn pos,
const std::string &  text = "",
TextAlignment  ta = TA_BOTTOM_LEFT,
int  x_offset = 0,
int  y_offset = 0 
)
virtual

flush output_stream and set the current text position from a 3D or 4D location in current world coordinates.

sets the current text ouput position

These are transformed to opengl coordinates opengl coordinates with (0,0) in lower left corner using the put_cursor_coords method. If the optional parameters are given, update the cursor location such that the given text alignment is achieved. x_offset and y_offset are in pixel and y points upward.

Definition at line 1984 of file context.cxx.

References get_current_font_face(), get_current_font_size(), put_cursor_coords(), set_cursor(), and x_offset.

◆ set_cursor() [2/2]

void cgv::render::context::set_cursor ( int  x,
int  y 
)
virtual

flush the output_stream and set a new cursor position given in opengl coordinates with (0,0) in lower left corner

set a new cursor position, which is only valid between calls of push_pixel_coords and pop_pixel_coords

Definition at line 1959 of file context.cxx.

References at_line_begin, cursor_x, nr_identations, output_stream(), and x_offset.

Referenced by vr_test::init_frame(), and set_cursor().

◆ set_debug_render_passes()

void cgv::render::context::set_debug_render_passes ( bool  _debug)

set flag whether to debug render passes

Definition at line 785 of file context.cxx.

References debug_render_passes.

◆ set_default_light_source()

void cgv::render::context::set_default_light_source ( size_t  i,
const cgv::media::illum::light_source ls 
)

set i-th default light source

Definition at line 723 of file context.cxx.

References default_light_source.

◆ set_default_render_pass_flags()

void cgv::render::context::set_default_render_pass_flags ( RenderPassFlags  rpf)
virtual

return the default render pass flags

Definition at line 771 of file context.cxx.

References default_render_flags, in_render_process(), and post_redraw().

◆ set_depth_func()

void cgv::render::context::set_depth_func ( CompareFunction  func)
virtual

set the depth test function

Reimplemented in cgv::render::gl::gl_context.

Definition at line 1686 of file context.cxx.

References depth_test_state_stack.

Referenced by cgv::render::gl::gl_context::set_depth_func().

◆ set_depth_mask()

void cgv::render::context::set_depth_mask ( bool  flag)
virtual

set the depth buffer mask

Reimplemented in cgv::render::gl::gl_context.

Definition at line 1785 of file context.cxx.

References buffer_mask_stack.

Referenced by cgv::render::gl::gl_context::set_depth_mask().

◆ set_depth_range()

void cgv::render::context::set_depth_range ( const dvec2 depth_range = dvec2(0, 1),
int  array_index = -1 
)
virtual

set the current depth range or one of the depth ranges in the window transformation array

The behaviour with respect to parameters array_index is the same as in the set_viewport() method.

Reimplemented in cgv::render::gl::gl_context.

Definition at line 1908 of file context.cxx.

References window_transformation_stack.

Referenced by cgv::render::frame_buffer::push_viewport(), and cgv::render::gl::gl_context::set_depth_range().

◆ set_depth_test_state()

void cgv::render::context::set_depth_test_state ( DepthTestState  state)
virtual

set the depth test state

Reimplemented in cgv::render::gl::gl_context.

Definition at line 1682 of file context.cxx.

References depth_test_state_stack.

Referenced by pop_depth_test_state(), and cgv::render::gl::gl_context::set_depth_test_state().

◆ set_gamma()

void cgv::render::context::set_gamma ( float  _gamma)

set the current per channel gamma values to single value

Definition at line 1575 of file context.cxx.

References set_gamma3().

Referenced by vr_test::init().

◆ set_gamma3()

void cgv::render::context::set_gamma3 ( const vec3 _gamma3)
virtual

set the current per channel gamma values to single value

Definition at line 1590 of file context.cxx.

References auto_set_gamma_in_current_shader_program, gamma3, set_current_gamma(), and shader_program_stack.

Referenced by set_gamma().

◆ set_light_source()

void cgv::render::context::set_light_source ( void handle,
const cgv::media::illum::light_source light,
bool  place_now = true 
)

set light source newly

Definition at line 563 of file context.cxx.

References light_sources, on_lights_changed(), and place_light_source().

◆ set_material()

◆ set_modelview_matrix()

void cgv::render::context::set_modelview_matrix ( const dmat4 MV)
virtual

◆ set_P()

void cgv::render::context::set_P ( const dmatn P) const
inline

Definition at line 1337 of file context.h.

◆ set_projection_matrix()

void cgv::render::context::set_projection_matrix ( const dmat4 P)
virtual

◆ set_textured_material()

◆ set_V()

void cgv::render::context::set_V ( const dmatn V) const
inline

Definition at line 1333 of file context.h.

◆ set_viewport()

void cgv::render::context::set_viewport ( const ivec4 viewport,
int  array_index = -1 
)
virtual

set the current viewport or one of the viewports in the window transformation array

If the parameter array_index is -1 (for example by not specifying it), the current window transformation array is resized to a single viewport and the viewport is set to the integer vector of pixel values in the viewport parameter: [x0,y0,width,height]. If an array_index >= 0 is specified, the window transformation array is resized such that the specified array_index is valid and the corresponding viewport is set. If resizing generates new viewports or depth ranges, the default values are set, which are [0,0,widthOfContext, heightOfContext] for viewports and [0.0,1.0] for depth ranges. If resizing increases the number of viewport transformations over the allowed number, an error is issued.

Reimplemented in cgv::render::gl::gl_context.

Definition at line 1901 of file context.cxx.

References window_transformation_stack.

Referenced by cgv::render::frame_buffer::push_viewport(), cgv::render::gl::render_to_texture3D(), and cgv::render::gl::gl_context::set_viewport().

◆ shader_program_destruct()

bool cgv::render::context::shader_program_destruct ( shader_program_base spb) const
protectedvirtual

Definition at line 2200 of file context.cxx.

◆ shader_program_disable()

bool cgv::render::context::shader_program_disable ( shader_program_base spb)
protectedvirtual

Definition at line 2181 of file context.cxx.

◆ shader_program_enable()

bool cgv::render::context::shader_program_enable ( shader_program_base spb)
protectedvirtual

Definition at line 2166 of file context.cxx.

◆ shader_program_link()

bool cgv::render::context::shader_program_link ( shader_program_base spb) const
protectedvirtual

Definition at line 2139 of file context.cxx.

◆ sRGB_framebuffer_enabled()

bool cgv::render::context::sRGB_framebuffer_enabled ( )
inline

check whether sRGB framebuffer is enabled

Definition at line 1086 of file context.h.

◆ tesselate_arrow() [1/2]

void cgv::render::context::tesselate_arrow ( const dvec3 start,
const dvec3 end,
double  aspect = 0.1f,
double  rel_tip_radius = 2.0f,
double  tip_aspect = 0.3f,
int  res = 25,
bool  edges = false 
)
virtual

define length and direction from start and end point and draw an arrow

Reimplemented in cgv::render::gl::gl_context.

Definition at line 2027 of file context.cxx.

◆ tesselate_arrow() [2/2]

void cgv::render::context::tesselate_arrow ( double  length = 1,
double  aspect = 0.1,
double  rel_tip_radius = 2.0,
double  tip_aspect = 0.3,
int  res = 25,
bool  edges = false 
)
virtual

tesselate an arrow from the origin in z-direction

An arrow of length L is composed of a cylinder of radius R and a cone of radius r. The parameters are

Parameters
[in]lengththe total length of the radius
[in]aspectis defined as R/L
[in]rel_tip_radiusis defined as r/R
[in]tip_aspectis defined as r/l

Reimplemented in cgv::render::gl::gl_context.

Definition at line 2022 of file context.cxx.

◆ tesselate_box()

void cgv::render::context::tesselate_box ( const cgv::media::axis_aligned_box< double, 3 > &  B,
bool  flip_normals,
bool  edges = false 
) const
virtual

tesselate an axis aligned box

tessellate an axis aligned box in single precision

Definition at line 1107 of file context.cxx.

References draw_edges_of_faces(), draw_faces(), cgv::media::axis_aligned_box< T, N >::get_max_pnt(), and cgv::media::axis_aligned_box< T, N >::get_min_pnt().

◆ tesselate_unit_cone()

void cgv::render::context::tesselate_unit_cone ( int  resolution = 25,
bool  flip_normals = false,
bool  edges = false 
)

tesselate a cone of radius 1

tessellate a cone of radius 1

Definition at line 1208 of file context.cxx.

References draw_edges_of_strip_or_fan(), and draw_strip_or_fan().

Referenced by cgv::render::gl::gl_context::draw_light_source(), and cgv::render::gl::gl_context::tesselate_arrow().

◆ tesselate_unit_cube()

void cgv::render::context::tesselate_unit_cube ( bool  flip_normals = false,
bool  edges = false 
)

tesselate a unit cube with extent from [-1,-1,-1] to [1,1,1] with face normals that can be flipped

tessellate a unit cube with extent from [-1,-1,-1] to [1,1,1] with face normals that can be flipped

Definition at line 1054 of file context.cxx.

References draw_edges_of_faces(), and draw_faces().

◆ tesselate_unit_cylinder()

void cgv::render::context::tesselate_unit_cylinder ( int  resolution = 25,
bool  flip_normals = false,
bool  edges = false 
)

tesselate a cylinder of radius 1

tessellate a cylinder of radius 1

Definition at line 1252 of file context.cxx.

References draw_edges_of_strip_or_fan(), and draw_strip_or_fan().

Referenced by cgv::render::gl::gl_context::tesselate_arrow().

◆ tesselate_unit_disk()

void cgv::render::context::tesselate_unit_disk ( int  resolution = 25,
bool  flip_normals = false,
bool  edges = false 
)

tesselate a circular disk of radius 1

tessellate a circular disk of radius 1

Definition at line 1176 of file context.cxx.

References draw_edges_of_faces(), and draw_faces().

Referenced by cgv::render::gl::gl_context::tesselate_arrow().

◆ tesselate_unit_dodecahedron()

void cgv::render::context::tesselate_unit_dodecahedron ( bool  flip_normals = false,
bool  edges = false 
)

tesselate a dodecahedron

tessellate a dodecahedron

Definition at line 1565 of file context.cxx.

References cgv::render::tesselate_unit_dodecahedron_or_icosahedron().

◆ tesselate_unit_icosahedron()

void cgv::render::context::tesselate_unit_icosahedron ( bool  flip_normals = false,
bool  edges = false 
)

tesselate an icosahedron

tessellate an icosahedron

Definition at line 1570 of file context.cxx.

References cgv::render::tesselate_unit_dodecahedron_or_icosahedron().

◆ tesselate_unit_octahedron()

void cgv::render::context::tesselate_unit_octahedron ( bool  flip_normals = false,
bool  edges = false 
)

tesselate a octahedron

tessellate a octahedron

Definition at line 1450 of file context.cxx.

References draw_edges_of_faces(), and draw_faces().

◆ tesselate_unit_prism()

void cgv::render::context::tesselate_unit_prism ( bool  flip_normals = false,
bool  edges = false 
)

tesselate a prism

tessellate a prism

Definition at line 1141 of file context.cxx.

References draw_edges_of_faces(), draw_edges_of_strip_or_fan(), draw_faces(), and draw_strip_or_fan().

◆ tesselate_unit_sphere()

void cgv::render::context::tesselate_unit_sphere ( int  resolution = 25,
bool  flip_normals = false,
bool  edges = false 
)

tesselate a sphere of radius 1

tessellate a sphere of radius 1

Definition at line 1344 of file context.cxx.

References draw_edges_of_strip_or_fan(), and draw_strip_or_fan().

Referenced by cgv::render::gl::gl_context::draw_light_source().

◆ tesselate_unit_square()

void cgv::render::context::tesselate_unit_square ( bool  flip_normals = false,
bool  edges = false 
)

tesselate a unit square in the xy-plane with texture coordinates

tessellate a unit square

Definition at line 1423 of file context.cxx.

References draw_edges_of_faces(), and draw_faces().

Referenced by cgv::render::gl::image_drawable::draw(), and vr_test::finish_draw().

◆ tesselate_unit_tetrahedron()

void cgv::render::context::tesselate_unit_tetrahedron ( bool  flip_normals = false,
bool  edges = false 
)

tesselate a tetrahedron

tessellate a tetrahedron

Definition at line 1395 of file context.cxx.

References draw_edges_of_faces(), and draw_faces().

◆ tesselate_unit_torus()

void cgv::render::context::tesselate_unit_torus ( float  minor_radius = 0.2f,
int  resolution = 25,
bool  flip_normals = false,
bool  edges = false 
)

tesselate a torus with major radius of one and given minor radius

tessellate a torus with major radius of one and given minor radius

Definition at line 1294 of file context.cxx.

References draw_edges_of_strip_or_fan(), and draw_strip_or_fan().

◆ write_frame_buffer_to_image()

bool cgv::render::context::write_frame_buffer_to_image ( const std::string &  file_name,
data::ComponentFormat  cf = data::CF_RGB,
FrameBufferType  buffer_type = FB_BACK,
unsigned int  x = 0,
unsigned int  y = 0,
int  w = -1,
int  h = -1,
float  depth_offset = 0.9f,
float  depth_scale = 10.0f 
)

write the content of the frame buffer to an image file.

write the content of a buffer to an image file

In case of writing a depth buffer a the depth offset is subtracted from the value and scaled by the depth scale before conversion to an unsigned int of bit depth 8 is performed.

Definition at line 929 of file context.cxx.

References cgv::data::CF_D, cgv::data::CF_S, cgv::data::data_view_base::get_format(), cgv::data::data_format::get_height(), cgv::data::data_view_impl< D, P >::get_ptr(), cgv::data::data_format::get_width(), read_frame_buffer(), cgv::data::data_format::set_height(), cgv::data::data_format::set_width(), cgv::type::info::TI_FLT32, cgv::type::info::TI_UINT8, and cgv::media::image::image_writer::write_image().

Friends And Related Symbol Documentation

◆ attribute_array_binding

friend class CGV_API attribute_array_binding
friend

Definition at line 633 of file context.h.

◆ attribute_array_manager

friend class CGV_API attribute_array_manager
friend

Definition at line 626 of file context.h.

◆ frame_buffer

friend class CGV_API frame_buffer
friend

Definition at line 630 of file context.h.

◆ render_buffer

friend class CGV_API render_buffer
friend

Definition at line 629 of file context.h.

◆ render_component

friend class CGV_API render_component
friend

Definition at line 627 of file context.h.

◆ shader_code

friend class CGV_API shader_code
friend

Definition at line 631 of file context.h.

◆ shader_program

friend class CGV_API shader_program
friend

Definition at line 632 of file context.h.

◆ shader_program_base

friend class shader_program_base
friend

Definition at line 673 of file context.h.

◆ texture

friend class CGV_API texture
friend

Definition at line 628 of file context.h.

◆ vertex_buffer

friend class CGV_API vertex_buffer
friend

Definition at line 634 of file context.h.

Member Data Documentation

◆ at_line_begin

bool cgv::render::context::at_line_begin
protected

store whether we are at the beginning of the line

Definition at line 796 of file context.h.

Referenced by context(), process_text(), and set_cursor().

◆ attribute_array_binding_stack

std::stack<attribute_array_binding_base*> cgv::render::context::attribute_array_binding_stack
protected

stack of currently enabled attribute array binding

Definition at line 737 of file context.h.

◆ auto_set_gamma_in_current_shader_program

bool cgv::render::context::auto_set_gamma_in_current_shader_program
protected

whether to automatically set gamma in current shader program, defaults to true

Definition at line 684 of file context.h.

Referenced by context(), and set_gamma3().

◆ auto_set_lights_in_current_shader_program

bool cgv::render::context::auto_set_lights_in_current_shader_program
protected

whether to automatically set lights in current shader program, defaults to true

Definition at line 680 of file context.h.

Referenced by context(), and on_lights_changed().

◆ auto_set_material_in_current_shader_program

bool cgv::render::context::auto_set_material_in_current_shader_program
protected

whether to automatically set material in current shader program, defaults to true

Definition at line 682 of file context.h.

Referenced by context(), set_material(), and set_textured_material().

◆ auto_set_view_in_current_shader_program

bool cgv::render::context::auto_set_view_in_current_shader_program
protected

whether to automatically set viewing matrixes in current shader program, defaults to true

Definition at line 678 of file context.h.

Referenced by context(), set_modelview_matrix(), and set_projection_matrix().

◆ bg_accum_color_stack

std::stack<vec4> cgv::render::context::bg_accum_color_stack
protected

◆ bg_color_stack

std::stack<vec4> cgv::render::context::bg_color_stack
protected

stack of background colors

Definition at line 701 of file context.h.

Referenced by context(), get_bg_alpha(), get_bg_color(), pop_bg_color(), push_bg_color(), put_bg_color(), set_bg_alpha(), and set_bg_color().

◆ bg_depth_stack

std::stack<float> cgv::render::context::bg_depth_stack
protected

stack of background depth values

Definition at line 703 of file context.h.

Referenced by context(), get_bg_depth(), pop_bg_depth(), push_bg_depth(), and set_bg_depth().

◆ bg_stencil_stack

std::stack<int> cgv::render::context::bg_stencil_stack
protected

stack of background stencil values

Definition at line 705 of file context.h.

Referenced by context(), get_bg_stencil(), pop_bg_stencil(), push_bg_stencil(), and set_bg_stencil().

◆ blend_state_stack

std::stack<BlendState> cgv::render::context::blend_state_stack
protected

◆ buffer_mask_stack

std::stack<BufferMask> cgv::render::context::buffer_mask_stack
protected

◆ cull_state_stack

std::stack<CullingMode> cgv::render::context::cull_state_stack
protected

stack of culling mode states

Definition at line 712 of file context.h.

Referenced by context(), get_cull_state(), pop_cull_state(), push_cull_state(), and set_cull_state().

◆ current_background

int cgv::render::context::current_background
protected

current back ground color index

Definition at line 780 of file context.h.

Referenced by context(), get_bg_clr_idx(), and set_bg_clr_idx().

◆ current_color

rgba cgv::render::context::current_color
protected

current color value

Definition at line 694 of file context.h.

Referenced by context(), get_color(), set_color(), and cgv::render::gl::gl_context::set_color().

◆ current_font_face

cgv::media::font::font_face_ptr cgv::render::context::current_font_face
protected

◆ current_font_size

float cgv::render::context::current_font_size
protected

◆ current_material_is_textured

bool cgv::render::context::current_material_is_textured
protected

store flag to tell whether current material is textured

Definition at line 765 of file context.h.

Referenced by context(), cgv::render::gl::gl_context::disable_material(), set_current_material(), set_material(), and set_textured_material().

◆ current_material_ptr

const cgv::media::illum::surface_material* cgv::render::context::current_material_ptr
protected

◆ cursor_x

int cgv::render::context::cursor_x
protected

current cursor location for textual output

Definition at line 782 of file context.h.

Referenced by context(), draw_text(), get_cursor(), process_text(), and set_cursor().

◆ cursor_y

int cgv::render::context::cursor_y
protected

Definition at line 782 of file context.h.

◆ debug_render_passes

bool cgv::render::context::debug_render_passes
protected

whether to debug render passes

Definition at line 690 of file context.h.

Referenced by context(), render_pass(), and set_debug_render_passes().

◆ default_light_source

cgv::media::illum::light_source cgv::render::context::default_light_source[nr_default_light_sources]
protected

default light sources

Definition at line 757 of file context.h.

Referenced by context(), get_default_light_source(), render_pass(), and set_default_light_source().

◆ default_light_source_handles

void* cgv::render::context::default_light_source_handles[nr_default_light_sources]
protected

handles of default light sources

Definition at line 759 of file context.h.

Referenced by context(), and render_pass().

◆ default_material

cgv::media::illum::surface_material cgv::render::context::default_material
protected

store a default material

Definition at line 761 of file context.h.

◆ default_render_flags

RenderPassFlags cgv::render::context::default_render_flags
protected

default render flags with which the main render pass is initialized

Definition at line 776 of file context.h.

Referenced by context(), get_default_render_pass_flags(), and set_default_render_pass_flags().

◆ depth_test_state_stack

std::stack<DepthTestState> cgv::render::context::depth_test_state_stack
protected

◆ do_screen_shot

bool cgv::render::context::do_screen_shot
protected

Definition at line 798 of file context.h.

◆ draw_in_compatibility_mode

bool cgv::render::context::draw_in_compatibility_mode
protected

whether to do all drawing in compatibility mode, only possible if support_compatibility_mode is true, , defaults to false

Definition at line 688 of file context.h.

Referenced by context(), cgv::render::gl::gl_context::draw_edges_of_faces(), cgv::render::gl::gl_context::draw_edges_of_strip_or_fan(), cgv::render::gl::gl_context::draw_faces(), and cgv::render::gl::gl_context::draw_strip_or_fan().

◆ enable_vsync

bool cgv::render::context::enable_vsync
protected

whether vsync should be enabled

Definition at line 692 of file context.h.

Referenced by context().

◆ enabled_light_source_handles

std::vector<void*> cgv::render::context::enabled_light_source_handles
protected

◆ frame_buffer_stack

◆ gamma3

vec3 cgv::render::context::gamma3
protected

per color channel gamma value passed to shader programs that have gamma uniform

Definition at line 698 of file context.h.

Referenced by context(), and set_gamma3().

◆ gpu_vendor

GPUVendorID cgv::render::context::gpu_vendor
protected

Definition at line 624 of file context.h.

◆ light_source_handle

size_t cgv::render::context::light_source_handle
protected

counter to construct light source handles

Definition at line 749 of file context.h.

Referenced by add_light_source(), context(), and set_current_lights().

◆ light_sources

std::map<void*, std::pair<cgv::media::illum::light_source, light_source_status> > cgv::render::context::light_sources
protected

◆ modelview_matrix_stack

std::stack<dmat4> cgv::render::context::modelview_matrix_stack
protected

keep two matrix stacks for model view and projection matrices

Definition at line 719 of file context.h.

Referenced by context(), cgv::render::gl::gl_context::get_modelview_matrix(), pop_modelview_matrix(), push_modelview_matrix(), set_current_view(), and set_modelview_matrix().

◆ nr_default_light_sources

const unsigned cgv::render::context::nr_default_light_sources = 2
staticprotected

number of default light sources

Definition at line 755 of file context.h.

Referenced by render_pass().

◆ nr_identations

int cgv::render::context::nr_identations
protected

current number of indentations

Definition at line 794 of file context.h.

Referenced by context(), process_text(), and set_cursor().

◆ out_stream

cgv::signal::callback_stream cgv::render::context::out_stream
protected

use a callback stream to write text to the opengl context

Definition at line 784 of file context.h.

Referenced by output_stream().

◆ phong_shading

bool cgv::render::context::phong_shading
protected

whether to use phong shading

Definition at line 778 of file context.h.

Referenced by context(), and enable_phong_shading().

◆ projection_matrix_stack

std::stack<dmat4> cgv::render::context::projection_matrix_stack
protected

Definition at line 719 of file context.h.

◆ render_pass_stack

std::stack<render_info> cgv::render::context::render_pass_stack
protected

store the current render pass

Definition at line 774 of file context.h.

Referenced by get_render_pass(), get_render_pass_flags(), get_render_pass_recursion_depth(), get_render_pass_user_data(), and render_pass().

◆ shader_program_stack

std::stack<shader_program_base*> cgv::render::context::shader_program_stack
protected

◆ sRGB_framebuffer

bool cgv::render::context::sRGB_framebuffer
protected

whether to use opengl option to support sRGB framebuffer

Definition at line 696 of file context.h.

Referenced by context(), and enable_sRGB_framebuffer().

◆ support_compatibility_mode

◆ tab_size

int cgv::render::context::tab_size
protected

size a tabs

Definition at line 790 of file context.h.

Referenced by context(), and process_text().

◆ use_shader_file_cache

bool cgv::render::context::use_shader_file_cache
protected

whether to use the caching facilities of shader_program and shader_code to store loaded shader file contents as strings for faster loading

Definition at line 676 of file context.h.

Referenced by context(), disable_shader_file_cache(), enable_shader_file_cache(), and is_shader_file_cache_enabled().

◆ window_transformation_stack

◆ x_offset

int cgv::render::context::x_offset
protected

offset in x and y direction where text starts

Definition at line 792 of file context.h.

Referenced by context(), process_text(), set_cursor(), and set_cursor().

◆ y_offset

int cgv::render::context::y_offset
protected

Definition at line 792 of file context.h.


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