cgv
|
#include <context.h>
Classes | |
struct | light_source_status |
status information of light sources More... | |
struct | render_info |
information necessary for a rendering pass More... | |
Public Types | |
typedef cgv::math::vec< float > | vec_type |
dimension independent type of vectors | |
typedef cgv::math::mat< float > | mat_type |
dimension independent type of matrices | |
typedef cgv::math::vec< double > | dvec_type |
dimension independent type of vectors | |
typedef cgv::math::mat< double > | dmat_type |
dimension independent type of matrices | |
typedef cgv::media::color< float, cgv::media::RGB > | rgb |
declare rgb color type | |
typedef cgv::media::color< float, cgv::media::RGB, cgv::media::OPACITY > | rgba |
declare rgba color type | |
typedef cgv::media::color< cgv::type::uint8_type, cgv::media::RGB > | rgb8 |
declare rgb color type | |
typedef cgv::media::color< cgv::type::uint8_type, cgv::media::RGB, cgv::media::OPACITY > | rgba8 |
declare rgba color type | |
typedef cgv::math::fvec< float, 2 > | vec2 |
declare type of 2d vectors | |
typedef cgv::math::fvec< float, 3 > | vec3 |
declare type of 3d vectors | |
typedef cgv::math::fvec< float, 4 > | vec4 |
declare type of homogeneous vectors | |
typedef cgv::math::vec< float > | vecn |
declare type of vector with varying dimension | |
typedef cgv::math::fmat< float, 2, 2 > | mat2 |
declare type of 2x2 matrices | |
typedef cgv::math::fmat< float, 3, 3 > | mat3 |
declare type of 3x3 matrices | |
typedef cgv::math::fmat< float, 4, 4 > | mat4 |
declare type of 4x4 matrices | |
typedef cgv::math::fmat< float, 3, 4 > | mat34 |
declare type of 3x4 matrices which are often used to store a pose | |
typedef cgv::math::mat< float > | matn |
declare type of matrices of varying dimensions | |
typedef cgv::math::fvec< double, 2 > | dvec2 |
declare type of 2d vectors | |
typedef cgv::math::fvec< double, 3 > | dvec3 |
declare type of 3d vectors | |
typedef cgv::math::fvec< double, 4 > | dvec4 |
declare type of homogeneous vectors | |
typedef cgv::math::vec< double > | dvecn |
declare type of vector with varying dimension | |
typedef cgv::math::fmat< double, 2, 2 > | dmat2 |
declare type of 2x2 matrices | |
typedef cgv::math::fmat< double, 3, 3 > | dmat3 |
declare type of 3x3 matrices | |
typedef cgv::math::fmat< double, 4, 4 > | dmat4 |
declare type of 4x4 matrices | |
typedef cgv::math::fmat< double, 3, 4 > | dmat34 |
declare type of 3x4 matrices which are often used to store a pose | |
typedef cgv::math::mat< double > | dmatn |
declare type of matrices of varying dimensions | |
typedef cgv::media::axis_aligned_box< float, 2 > | box2 |
declare type of 2d boxes | |
typedef cgv::media::axis_aligned_box< float, 3 > | box3 |
declare type of 3d boxes | |
typedef cgv::media::axis_aligned_box< float, 4 > | box4 |
declare type of 4d boxes | |
typedef cgv::media::axis_aligned_box< double, 2 > | dbox2 |
declare type of 2d boxes | |
typedef cgv::media::axis_aligned_box< double, 3 > | dbox3 |
declare type of 3d boxes | |
typedef cgv::media::axis_aligned_box< double, 4 > | dbox4 |
declare type of 4d boxes | |
typedef cgv::math::quaternion< float > | quat |
declare type of quaternion | |
typedef cgv::math::quaternion< double > | dquat |
declare type of double quaternion | |
typedef cgv::math::fvec< int32_t, 2 > | ivec2 |
declare type of 2d integer vectors | |
typedef cgv::math::fvec< int32_t, 3 > | ivec3 |
declare type of 3d integer vectors | |
typedef cgv::math::fvec< int32_t, 4 > | ivec4 |
declare type of 4d integer vectors | |
typedef cgv::math::fvec< uint32_t, 2 > | uvec2 |
declare type of 2d unsigned integer vectors | |
typedef cgv::math::fvec< uint32_t, 3 > | uvec3 |
declare type of 3d unsigned integer vectors | |
typedef cgv::math::fvec< uint32_t, 4 > | uvec4 |
declare type of 4d unsigned integer vectors | |
Public Member Functions | |
shader_program_base * | get_current_program () const |
check for current program, prepare it for rendering and return pointer to it | |
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 | |
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 () |
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 | |
Protected Attributes | |
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_vsynch |
whether vsynch should be enabled | |
rgba | current_color |
current color value | |
bool | sRGB_framebuffer |
whether to use opengl option to support sRGB framebuffer | |
float | gamma |
gamma value passed to shader programs that have gamma uniform | |
std::stack< dmat4 > | modelview_matrix_stack |
keep two matrix stacks for model view and projection matrices | |
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_material * | current_material_ptr |
store pointer to current material | |
bool | current_material_is_textured |
store flag to tell whether current material is textured | |
std::stack< render_info > | render_pass_stack |
store the current render pass | |
RenderPassFlags | default_render_flags |
default render flags with which the main render pass is initialized | |
float | bg_r |
current background color, depth, stencil and accum color | |
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 | |
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 | nr_identations |
current number of indentations | |
bool | at_line_begin |
store whether we are at the beginning of the line | |
Static Protected Attributes | |
static const unsigned | nr_default_light_sources = 2 |
number of default light sources | |
context creation parameters | |
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: false | |
bool | self_reflect (cgv::reflect::reflection_handler &srh) |
reflect the shader_path member | |
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 More... | |
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 void * | get_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, TypeId type=type::info::TI_UINT8, data::ComponentFormat cf=data::CF_RGB, int w=-1, int h=-1)=0 |
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 a buffer to an image file More... | |
virtual void | set_bg_color (float r, float g, float b, float a) |
set a user defined background color | |
virtual void | set_bg_alpha (float a) |
set a user defined background alpha value | |
virtual void | set_bg_depth (float d) |
set a user defined background depth value More... | |
virtual void | set_bg_stencil (int s) |
set a user defined background stencil value More... | |
virtual void | set_bg_accum_color (float r, float g, float b, float a) |
set a user defined background color for the accumulation buffer More... | |
virtual void | set_bg_accum_alpha (float a) |
set a user defined background alpha value for the accumulation buffer More... | |
virtual void | set_bg_clr_idx (unsigned int idx) |
set an indexed background color More... | |
unsigned int | get_bg_clr_idx () const |
return the current index of the background color | |
void | put_bg_color (float *rgba) const |
copy the current back ground rgba color into the given float array | |
float | get_bg_alpha () const |
return the current alpha value for clearing the background | |
void | put_bg_accum_color (float *rgba) const |
copy the current back ground rgba color of the accumulation buffer into the given float array | |
float | get_bg_accum_alpha () const |
return the current alpha value for clearing the accumulation buffer | |
float | get_bg_depth () const |
return the current depth value for clearing the background | |
int | get_bg_stencil () const |
return the current stencil value for clearing the background | |
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 | |
DEPRECATED("deprecated, use set_material instead.") virtual void enable_material(const cgv DEPRECATED("deprecated and ignored.") virtual void disable_material(const cgv MaterialSide | ms = MS_FRONT_AND_BACK |
DEPRECATED("deprecated, use set_material instead.") virtual void enable_material(const cgv DEPRECATED("deprecated and ignored.") virtual void disable_material(const cgv MaterialSide float | alpha = 1) |
DEPRECATED ("deprecated and ignored.") virtual void enable_phong_shading() | |
DEPRECATED ("deprecated and ignored.") virtual void disable_phong_shading() | |
virtual void | set_gamma (float _gamma) |
set the current gamma values | |
float | get_gamma () const |
query current 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 rgba & | get_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_material * | get_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_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 More... | |
virtual shader_program & | ref_default_shader_program (bool texture_support=false)=0 |
return a reference to a shader program used to render without illumination | |
virtual shader_program & | ref_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 | |
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 More... | |
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 More... | |
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 More... | |
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 More... | |
transformations | |
int y_D | const { return get_window_z(x_D, y_D) |
int | y_D |
int const dmat4 &MPD | const { return get_model_point(x_D, y_D, MPD) |
int double z_D | const { return get_model_point(x_D, y_D, z_D) |
int double | z_D |
int double const dmat4 &MPD | const { return get_model_point(x_D, y_D, z_D, MPD) |
const dmat4 &MPD | const { return get_model_point(p_D, MPD) |
DEPRECATED ("deprecated: use get_modelview_matrix() instead.") dmat_type get_V() const | |
DEPRECATED ("deprecated: use set_modelview_matrix() instead.") void set_V(const dmat_type &V) const | |
DEPRECATED ("deprecated: use push_modelview_matrix() instead.") void push_V() | |
DEPRECATED ("deprecated: use pop_modelview_matrix() instead.") void pop_V() | |
DEPRECATED ("deprecated: use get_projection_matrix() instead.") dmat_type get_P() const | |
DEPRECATED ("deprecated: use set_projection_matrix() instead.") void set_P(const dmat_type &P) const | |
DEPRECATED ("deprecated: use push_projection_matrix() instead.") void push_P() | |
DEPRECATED ("deprecated: use pop_projection_matrix() instead.") void pop_P() | |
DEPRECATED ("deprecated: use get_device_matrix() instead.") dmat_type get_D() const | |
DEPRECATED ("deprecated: use get_modelview_projection_device_matrix() instead.") mat_type get_DPV() const | |
virtual void | push_pixel_coords ()=0 |
virtual void | pop_pixel_coords ()=0 |
pop previously changed transformation matrices | |
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. More... | |
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 More... | |
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 More... | |
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 More... | |
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 More... | |
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 window x- and y-coordinates | |
vec3 | get_model_point (int x_window, int y_window) const |
compute model space 3D point from the given window location More... | |
vec3 | get_model_point (int x_window, int y_window, double z_window) const |
compute model space 3D point from the given window coordinates More... | |
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 window location and modelview_projection_window matrix More... | |
vec3 | get_model_point (int x_window, int y_window, double z_window, const dmat4 &modelview_projection_window_matrix) const |
compute model space 3D point from the given window coordinates with the given modelview_projection_window matrix More... | |
vec3 | get_model_point (const vec3 &p_window) const |
compute model space 3D point from the given window space point More... | |
vec3 | get_model_point (const dvec3 &p_window, const dmat4 &modelview_projection_window_matrix) const |
compute model space 3D point from the given window space point and the given modelview_projection_window matrix More... | |
DEPRECATED ("use get_window_matrix() instead.") dmat4 get_device_matrix() const | |
return homogeneous 4x4 projection matrix, which transforms from clip to device space | |
DEPRECATED ("use get_modelview_projection_window_matrix() instead.") 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) | |
DEPRECATED ("use get_window_z()") double get_z_D(int x_D | |
read the window z-coordinate from the z-buffer for the given device x- and y-coordinates | |
DEPRECATED ("use get_model_point()") vec3 get_point_W(int x_D | |
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. | |
DEPRECATED ("use get_model_point()") vec3 get_point_W(int x_D | |
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. | |
DEPRECATED ("use get_model_point()") vec3 get_point_W(int x_D | |
compute the location in world space of a device point. For this the current world to device transformation is inverted. | |
DEPRECATED ("use get_model_point()") vec3 get_point_W(int x_D | |
compute the location in world space of a device point by inversion of the given world to device transformation. | |
DEPRECATED ("use get_model_point()") vec3 get_point_W(const vec3 &p_D) const | |
compute a the location in world space of a device point. | |
DEPRECATED ("use get_model_point()") vec3 get_point_W(const vec3 &p_D | |
compute a the location in world space of a device point. | |
bool | ensure_window_transformation_index (int &array_index) |
base class for all drawables, which is independent of the used rendering API.
|
virtual |
draw a light source with an emissive material
[in] | l | to be rendered light source |
[in] | intensity_scale | used to multiply with the light source values |
Reimplemented in cgv::render::gl::gl_context.
|
virtual |
return current cursor location in mouse coordinates
store the current cursor location in the passed references to x and y coordinate
context::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
context::vec3 cgv::render::context::get_model_point | ( | const dvec3 & | p_window, |
const dmat4 & | modelview_projection_window_matrix | ||
) | const |
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
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
|
inline |
compute model space 3D point from the given 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
|
inline |
compute model space 3D point from the given 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
|
inline |
compute model space 3D point from the given window coordinates
the function inversely transforms the window space 3D point with the current modelview_projection_window matrix
|
inline |
compute model space 3D point from the given window coordinates with the given modelview_projection_window matrix
the function inversely transforms the window space 3D point with the given modelview_projection_window matrix
unsigned cgv::render::context::get_render_pass_recursion_depth | ( | ) | const |
return current render pass recursion depth
return the current render pass
context::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 mouse pixel coordinates and z to depth value stored in the depth buffer. This is a different convention as in OpenGL where the y-coordinates point from bottom to top instead from top to bottom. Optionally one can specify a window transformation index with the parameter array_index
for the case when an array of window transformations is used.
|
virtual |
returns an output stream whose output is printed at the current cursor location
returns an output stream whose output is printed at the current cursor location, which is managed by the context. The coordinate system of the cursor location corresponds to window / mouse coordinates. 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.
|
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.
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.
|
pure virtual |
use this to push transformation matrices on the stack such that x and y coordinates correspond to window coordinates, i.e. the coordinates of the mouse pointer and the cursor for text output.
Implemented in cgv::render::gl::gl_context.
|
virtual |
transform point p into cursor coordinates and put x and y coordinates into the passed variables
transform point p in current world coordinates into cursor coordinates and put x and y coordinates into the passed variables
|
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.
|
virtual |
set a user defined background alpha value for the accumulation buffer
set a user defined background alpha value
|
virtual |
set a user defined background color for the accumulation buffer
set a user defined background color
|
virtual |
set an indexed background color
set a user defined background color
|
virtual |
set a user defined background depth value
set a user defined background depth
|
virtual |
set a user defined background stencil value
set a user defined background color
|
virtual |
sets the current text ouput position
flush output_stream and set the current text position from a 3D or 4D location in current world coordinates. These are transformed to mouse coordinates with the put_cursor_coords method. If the optional parameters are given, update the cursor location such that the given text alignment is achieved.
|
virtual |
set a new cursor position, which is only valid between calls of push_pixel_coords and pop_pixel_coords
flush the output_stream and set a new cursor position given in window/mouse coordinates
|
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.
|
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 depth range 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.
|
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
[in] | length | the total length of the radius |
[in] | aspect | is defined as R/L |
[in] | rel_tip_radius | is defined as r/R |
[in] | tip_aspect | is defined as r/l |
Reimplemented in cgv::render::gl::gl_context.
|
virtual |
tesselate an axis aligned box
tesselate an axis aligned box in single precision
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
tesselate a unit square
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 a buffer to an image file
write the content of the frame 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.