cgv
|
namespace for opengl specific GPU programming More...
Classes | |
struct | format_callback_handler |
class | gl_context |
implementation of the context API for the OpenGL API excluding methods for font selection, redraw and initiation of render passes. More... | |
class | gl_cursor |
windows only implementation of functionality to create and draw an RGBA texture representing standard mouse cursor icons. More... | |
class | gl_depth_peeler |
OpenGL helper class to simplify depth peeling. More... | |
class | gl_implicit_surface_drawable_base |
drawable that visualizes implicit surfaces by contouring them with marching cubes or dual contouring. More... | |
class | gl_performance_monitor |
class | gl_time_query |
OpenGL helper class to perform time measurements. More... | |
struct | gl_traits |
traits structure that maps a fundamental type to the Type enum. More... | |
struct | gl_traits< char > |
struct | gl_traits< double > |
struct | gl_traits< float > |
struct | gl_traits< int > |
struct | gl_traits< short > |
struct | gl_traits< unsigned char > |
struct | gl_traits< unsigned int > |
struct | gl_traits< unsigned short > |
class | gl_transparent_renderer |
OpenGL helper class to simplify transparent rendering. More... | |
class | image_drawable |
base class of drawables that show static or animated images More... | |
class | mesh_drawable |
simple implementation of a drawable for a polygonal mesh with support for materials More... | |
Enumerations | |
enum | ContouringType { MARCHING_CUBES , DUAL_CONTOURING } |
type of contouring method > More... | |
enum | NormalComputationType { GRADIENT_NORMALS , FACE_NORMALS , CORNER_NORMALS , CORNER_GRADIENTS } |
normal computation type > More... | |
enum | ProgramInterface { PI_UNIFORM , PI_UNIFORM_BLOCK , PI_PROGRAM_INPUT , PI_PROGRAM_OUTPUT , PI_VERTEX_SUBROUTINE , PI_TESS_CONTROL_SUBROUTINE , PI_TESS_EVALUATION_SUBROUTINE , PI_GEOMETRY_SUBROUTINE , PI_FRAGMENT_SUBROUTINE , PI_COMPUTE_SUBROUTINE , PI_VERTEX_SUBROUTINE_UNIFORM , PI_TESS_CONTROL_SUBROUTINE_UNIFORM , PI_TESS_EVALUATION_SUBROUTINE_UNIFORM , PI_GEOMETRY_SUBROUTINE_UNIFORM , PI_FRAGMENT_SUBROUTINE_UNIFORM , PI_COMPUTE_SUBROUTINE_UNIFORM , PI_TRANSFORM_FEEDBACK_VARYING , PI_BUFFER_VARIABLE , PI_SHADER_STORAGE_BLOCK } |
different program interfaces More... | |
Functions | |
bool & | ref_initialized () |
bool | is_glew_initialized () |
bool | ensure_glew_initialized () |
initialize glew in the first call to this function and always return whether this was successful | |
std::vector< int > | get_context_creation_attrib_list (cgv::render::context_config &cc) |
construct a 0 terminated list of context creation attribute definitions | |
GLenum | map_to_gl (PrimitiveType primitive_type) |
GLenum | map_to_gl (MaterialSide ms) |
return OpenGL material side constant | |
GLenum | map_to_gl (AccessType access_type) |
GLenum | map_to_gl (BlendFunction blend_function) |
GLenum | map_to_gl (CompareFunction compare_func) |
GLenum | get_tex_dim (TextureType texture_type) |
GLenum | get_tex_bind (TextureType texture_type) |
GLenum | map_to_gl (TextureWrap texture_wrap) |
GLenum | map_to_gl (TextureFilter filter_type) |
GLboolean | map_to_gl (bool flag) |
GLuint | get_gl_id (const void *handle) |
void * | get_handle (GLuint id) |
void | set_gl_format (texture &tex, GLuint gl_format, const std::string &component_format_description) |
set a very specific texture format. This should be called after the texture is constructed and before it is created. | |
GLuint | get_gl_format (const texture &tex) |
return the texture format used for a given texture. If called before texture has been created, the function returns, which format would be chosen by the automatic format selection process. | |
void | gl_set_material_color (GLenum side, const cgv::media::illum::phong_material::color_type &c, float alpha, GLenum type) |
void | gl_set_material (const cgv::media::illum::phong_material &mat, MaterialSide ms, float alpha) |
enable a material without textures | |
std::string | get_source_tag_name (GLenum tag) |
std::string | get_type_tag_name (GLenum tag) |
std::string | get_severity_tag_name (GLenum tag) |
void GLAPIENTRY | debug_callback (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *userParam) |
void | render_vertex (int k, const float *vertices, const float *normals, const float *tex_coords, const int *vertex_indices, const int *normal_indices, const int *tex_coord_indices, bool flip_normals) |
attribute_array_binding *& | get_aab_ptr () |
vertex_buffer *& | get_vbo_ptr () |
std::string | gl_error_to_string (GLenum eid) |
std::string | gl_error () |
void | complete_rect_from_vp (ivec4 &D, GLint vp[4]) |
std::string | value_type_index_to_string (type_descriptor td) |
GLenum | buffer_target (VertexBufferType vbt) |
GLenum | buffer_usage (VertexBufferUsage vbu) |
CGV_API void | set_material (const cgv::media::illum::phong_material &mat, MaterialSide ms, float alpha) |
set material in opengl state to given material | |
void | checkClientState () |
unsigned | map_to_gl (cgv::data::ComponentFormat cf, cgv::data::ComponentIntegerInterpretation cii=cgv::data::CII_DEFAULT) |
map a component format to a gl enum, return -1 of this was not possible | |
unsigned | map_to_gl (cgv::type::info::TypeId ti) |
map a type id to a gl enum | |
unsigned | get_gl_cube_map_target (unsigned side) |
return one of the six cube map sides gl enums | |
bool | generate_mipmaps (unsigned int dim, bool is_cubemap, bool is_array=false, std::string *last_error=0) |
generate mipmaps for the currently bound texture, which has the given texture dimension; optionally pass a string to get information on failure | |
unsigned | find_best_texture_format (const cgv::data::component_format &cf, cgv::data::component_format *best_cf=0, const std::vector< cgv::data::data_view > *palettes=0) |
map the given component format to the best matching available gl component format | |
unsigned | configure_src_format (const cgv::data::const_data_view &data, GLuint &src_type, GLuint &src_fmt, const std::vector< data_view > *palettes) |
bool | load_texture (const cgv::data::const_data_view &data, unsigned gl_tex_format, unsigned level=-1, unsigned cube_side=-1, int num_array_layers=0, const std::vector< cgv::data::data_view > *palettes=0) |
load data to a texture with the glTexImage commands and generate mipmaps if the level parameter is -1, return whether mipmaps were created | |
bool | replace_texture (const cgv::data::const_data_view &data, int level, int x, int y, int z, const std::vector< cgv::data::data_view > *palettes) |
replace part or complete data of currently bound texture with the data in the given data view | |
unsigned int | create_texture (const cgv::data::const_data_view &dv, bool mipmap=true, const std::vector< cgv::data::data_view > *palettes=0, unsigned tex_id=-1) |
create a texture from the given data view creating a mipmap pyramid | |
unsigned int | create_texture (const cgv::data::const_data_view &dv, unsigned level, unsigned cube_side, const std::vector< cgv::data::data_view > *palettes, unsigned tex_id) |
create a certain texture level from the given data view and optionally specify a cube side of a cube map | |
bool | cover_screen (context &ctx, shader_program *prog_ptr, bool flip_tex_v_coord, float xmin, float ymin, float xmax, float ymax, float umin, float vmin, float umax, float vmax) |
cover the current viewport with a textured quad using the textured default shader program or the one passed in the third parameter | |
void | gl_texture_to_screen (float xmin, float ymin, float xmax, float ymax, float umin, float vmin, float umax, float vmax) |
cover the current viewport with a textured quad | |
void | gl_1D_texture_to_screen (bool vary_along_x=true, float xmin=-1.0f, float ymin=-1.0f, float xmax=1.0f, float ymax=1.0f) |
cover the current viewport or a rectangle with it with a quad textured by a 1D texture | |
bool | complete_program_form_render_to_texture3D (cgv::render::context &ctx, cgv::render::shader_program &prog, std::string *error_message=0) |
complete the given shader program that is assumed to have a working fragment shader. | |
bool | render_to_texture3D (context &ctx, shader_program &prog, TextureSampling texture_sampling, texture &target_tex, texture *target_tex2=0, texture *target_tex3=0, texture *target_tex4=0) |
Render to the given target 3D texture with the given shader program that must be completed with the function complete_program_form_render_to_texture3D() . | |
unsigned | map_material_side (MaterialSide ms) |
unsigned int | read_image_to_texture (const std::string &file_name, bool mipmaps=true, double *aspect_ptr=0, bool *has_alpha_ptr=0) |
read the given image file into a texture and return the texture id or -1 in case of failure. | |
bool | read_image_to_textures (const std::string &file_name, std::vector< unsigned > &tex_ids, std::vector< float > &durations, bool mipmaps=true, double *aspect_ptr=0, bool *has_alpha_ptr=0) |
read several images from one image file that can contain an animation | |
void | set_lighting_parameters (context &ctx, shader_program &prog) |
set the program variables needed by the lighting.glsl shader | |
std::vector< shader_program * > & | ref_shader_prog_stack () |
void | push_textured_material_prog (shader_program &prog) |
push a shader program onto the textured material stack | |
void | pop_textured_material_prog () |
pop a shader program from the textured material stack | |
shader_program & | ref_textured_material_prog (context &ctx) |
return a reference to the singleton textured material shader program, which is constructed on demand only | |
void | print_program_ressources (shader_program &prog, const std::string &interface_name, ProgramInterface prog_intf) |
print program resources for given interface | |
CGV_API unsigned int | create_texture (const cgv::data::const_data_view &dv, unsigned level, unsigned cube_side=-1, const std::vector< cgv::data::data_view > *palettes=0, unsigned tex_id=-1) |
create a certain texture level from the given data view and optionally specify a cube side of a cube map | |
CGV_API bool | replace_texture (const cgv::data::const_data_view &data, int level=0, int x=0, int y=0, int z=-1, const std::vector< cgv::data::data_view > *palettes=0) |
replace part or complete data of currently bound texture with the data in the given data view | |
Variables | |
static const GLenum | gl_depth_format_ids [] |
static const GLenum | gl_color_buffer_format_ids [] |
static const char * | depth_formats [] |
static const char * | color_buffer_formats [] |
size_t | max_nr_indices |
size_t | max_nr_vertices |
GLuint | gl_shader_type [] |
float | black [4] = { 0, 0, 0, 1 } |
float | white [4] = { 1, 1, 1, 1 } |
float | gray [4] = { 0.25f, 0.25f, 0.25f, 1 } |
float | green [4] = { 0, 1, 0, 1 } |
float | brown [4] = { 0.3f, 0.1f, 0, 1 } |
float | dark_red [4] = { 0.4f, 0, 0, 1 } |
float | cyan [4] = { 0, 1, 1, 1 } |
float | yellow [4] = { 1, 1, 0, 1 } |
float | red [4] = { 1, 0, 0, 1 } |
float | blue [4] = { 0, 0, 1, 1 } |
GLuint | gl_tex_dim [] = { GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D, GL_TEXTURE_1D_ARRAY, GL_TEXTURE_2D_ARRAY, GL_TEXTURE_CUBE_MAP_EXT } |
static const GLenum | gl_std_texture_format_ids [] |
static const char * | std_texture_formats [] |
static const GLenum | gl_float_texture_format_ids [] |
static const char * | float_texture_formats [] |
static const GLenum | gl_snorm_texture_format_ids [] |
static const char * | snorm_texture_formats [] |
static const GLenum | gl_int_texture_format_ids [] |
static const char * | int_texture_formats [] |
static const GLenum | gl_depth_format_ids [] |
static const char * | depth_formats [] |
static const GLenum | gl_rg_texture_format_ids [] |
static const char * | rg_texture_formats [] |
static GLenum | interface_ids [] |
namespace for opengl specific GPU programming
type of contouring method >
Definition at line 22 of file gl_implicit_surface_drawable_base.h.
normal computation type >
Definition at line 24 of file gl_implicit_surface_drawable_base.h.
different program interfaces
Definition at line 111 of file gl_tools.h.
GLenum cgv::render::gl::buffer_target | ( | VertexBufferType | vbt | ) |
Definition at line 3526 of file gl_context.cxx.
GLenum cgv::render::gl::buffer_usage | ( | VertexBufferUsage | vbu | ) |
Definition at line 3541 of file gl_context.cxx.
void cgv::render::gl::checkClientState | ( | ) |
Definition at line 95 of file gl_performance_monitor.cxx.
CGV_API bool cgv::render::gl::complete_program_form_render_to_texture3D | ( | cgv::render::context & | ctx, |
cgv::render::shader_program & | prog, | ||
std::string * | error_message = 0 |
||
) |
complete the given shader program that is assumed to have a working fragment shader.
The function adds the rest of the pipeline and provides the input <in vec3 tex_coord> to the fragment shader. The output of the fragment shader is stored in the 3D texture passed to render_to_texture3D()
. After this call the shader program is managed by the caller and can be used once or several times in the function render_to_texture3D()
. In case of failure, false is returned and in case the error_message
string is provided an error message is assigned to error_message
.
Definition at line 873 of file gl_texture_tools.cxx.
References cgv::render::shader_program::attach_code(), and cgv::render::shader_program::link().
Definition at line 2572 of file gl_context.cxx.
unsigned cgv::render::gl::configure_src_format | ( | const cgv::data::const_data_view & | data, |
GLuint & | src_type, | ||
GLuint & | src_fmt, | ||
const std::vector< data_view > * | palettes | ||
) |
Definition at line 570 of file gl_texture_tools.cxx.
CGV_API bool cgv::render::gl::cover_screen | ( | context & | ctx, |
shader_program * | prog_ptr = 0 , |
||
bool | flip_tex_v_coord = false , |
||
float | xmin = -1.0f , |
||
float | ymin = -1.0f , |
||
float | xmax = 1.0f , |
||
float | ymax = 1.0f , |
||
float | umin = 0.0f , |
||
float | vmin = 0.0f , |
||
float | umax = 1.0f , |
||
float | vmax = 1.0f |
||
) |
cover the current viewport with a textured quad using the textured default shader program or the one passed in the third parameter
A shader program passed in the third parameter must have the vertex attributes in vec4 position; in vec2 texcoord
Definition at line 740 of file gl_texture_tools.cxx.
References cgv::render::shader_program::disable(), cgv::render::attribute_array_binding::disable_global_array(), cgv::render::shader_program::enable(), cgv::render::attribute_array_binding::enable_global_array(), cgv::render::context::error(), cgv::render::shader_program::is_enabled(), cgv::render::context::pop_modelview_matrix(), cgv::render::context::pop_projection_matrix(), cgv::render::context::push_modelview_matrix(), cgv::render::context::push_projection_matrix(), cgv::render::context::ref_default_shader_program(), cgv::render::context::set_color(), cgv::render::attribute_array_binding::set_global_attribute_array(), cgv::render::context::set_modelview_matrix(), and cgv::render::context::set_projection_matrix().
CGV_API unsigned int cgv::render::gl::create_texture | ( | const cgv::data::const_data_view & | dv, |
bool | mipmap, | ||
const std::vector< data_view > * | palettes, | ||
unsigned | tex_id | ||
) |
create a texture from the given data view creating a mipmap pyramid
Definition at line 711 of file gl_texture_tools.cxx.
References create_texture().
Referenced by create_texture(), read_image_to_texture(), and read_image_to_textures().
unsigned int cgv::render::gl::create_texture | ( | const cgv::data::const_data_view & | dv, |
unsigned | level, | ||
unsigned | cube_side, | ||
const std::vector< cgv::data::data_view > * | palettes, | ||
unsigned | tex_id | ||
) |
create a certain texture level from the given data view and optionally specify a cube side of a cube map
Definition at line 716 of file gl_texture_tools.cxx.
References find_best_texture_format(), cgv::data::data_view_base::get_format(), cgv::data::data_format::get_nr_dimensions(), and load_texture().
|
extern |
create a certain texture level from the given data view and optionally specify a cube side of a cube map
Definition at line 716 of file gl_texture_tools.cxx.
References find_best_texture_format(), cgv::data::data_view_base::get_format(), cgv::data::data_format::get_nr_dimensions(), and load_texture().
void GLAPIENTRY cgv::render::gl::debug_callback | ( | GLenum | source, |
GLenum | type, | ||
GLuint | id, | ||
GLenum | severity, | ||
GLsizei | length, | ||
const GLchar * | message, | ||
const void * | userParam | ||
) |
Definition at line 411 of file gl_context.cxx.
CGV_API bool cgv::render::gl::ensure_glew_initialized | ( | ) |
initialize glew in the first call to this function and always return whether this was successful
Definition at line 19 of file gl.cxx.
Referenced by cgv::render::gl::gl_depth_peeler::begin_layer(), cgv::render::gl::gl_context::configure_gl(), find_best_texture_format(), generate_mipmaps(), cgv::render::gl::gl_depth_peeler::init(), cgv::render::gl::gl_time_query::init(), and load_texture().
CGV_API unsigned cgv::render::gl::find_best_texture_format | ( | const cgv::data::component_format & | _cf, |
cgv::data::component_format * | best_cf, | ||
const std::vector< data_view > * | palettes | ||
) |
map the given component format to the best matching available gl component format
Definition at line 511 of file gl_texture_tools.cxx.
References ensure_glew_initialized(), cgv::data::find_best_match(), cgv::data::component_format::get_component_name(), cgv::data::component_format::get_nr_components(), and cgv::data::component_format::set_component_names().
Referenced by create_texture(), and get_gl_format().
CGV_API bool cgv::render::gl::generate_mipmaps | ( | unsigned int | dim, |
bool | is_cubemap, | ||
bool | is_array, | ||
std::string * | last_error | ||
) |
generate mipmaps for the currently bound texture, which has the given texture dimension; optionally pass a string to get information on failure
Definition at line 124 of file gl_texture_tools.cxx.
References ensure_glew_initialized().
Referenced by load_texture(), and replace_texture().
attribute_array_binding *& cgv::render::gl::get_aab_ptr | ( | ) |
Definition at line 1206 of file gl_context.cxx.
CGV_API std::vector< int > cgv::render::gl::get_context_creation_attrib_list | ( | cgv::render::context_config & | cc | ) |
construct a 0 terminated list of context creation attribute definitions
Definition at line 40 of file gl_context.cxx.
CGV_API unsigned cgv::render::gl::get_gl_cube_map_target | ( | unsigned | side | ) |
return one of the six cube map sides gl enums
Definition at line 109 of file gl_texture_tools.cxx.
Referenced by cgv::render::gl::gl_context::frame_buffer_attach(), load_texture(), and replace_texture().
return the texture format used for a given texture. If called before texture has been created, the function returns, which format would be chosen by the automatic format selection process.
Definition at line 296 of file gl_context.cxx.
References find_best_texture_format().
Definition at line 271 of file gl_context.cxx.
Definition at line 276 of file gl_context.cxx.
std::string cgv::render::gl::get_severity_tag_name | ( | GLenum | tag | ) |
Definition at line 400 of file gl_context.cxx.
std::string cgv::render::gl::get_source_tag_name | ( | GLenum | tag | ) |
Definition at line 371 of file gl_context.cxx.
GLenum cgv::render::gl::get_tex_bind | ( | TextureType | texture_type | ) |
Definition at line 221 of file gl_context.cxx.
GLenum cgv::render::gl::get_tex_dim | ( | TextureType | texture_type | ) |
Definition at line 205 of file gl_context.cxx.
std::string cgv::render::gl::get_type_tag_name | ( | GLenum | tag | ) |
Definition at line 384 of file gl_context.cxx.
vertex_buffer *& cgv::render::gl::get_vbo_ptr | ( | ) |
Definition at line 1212 of file gl_context.cxx.
CGV_API void cgv::render::gl::gl_1D_texture_to_screen | ( | bool | vary_along_x, |
float | xmin, | ||
float | ymin, | ||
float | xmax, | ||
float | ymax | ||
) |
cover the current viewport or a rectangle with it with a quad textured by a 1D texture
Definition at line 838 of file gl_texture_tools.cxx.
std::string cgv::render::gl::gl_error | ( | ) |
Definition at line 1808 of file gl_context.cxx.
std::string cgv::render::gl::gl_error_to_string | ( | GLenum | eid | ) |
Definition at line 1792 of file gl_context.cxx.
void cgv::render::gl::gl_set_material | ( | const cgv::media::illum::phong_material & | mat, |
MaterialSide | ms, | ||
float | alpha | ||
) |
enable a material without textures
Definition at line 313 of file gl_context.cxx.
void cgv::render::gl::gl_set_material_color | ( | GLenum | side, |
const cgv::media::illum::phong_material::color_type & | c, | ||
float | alpha, | ||
GLenum | type | ||
) |
Definition at line 306 of file gl_context.cxx.
CGV_API void cgv::render::gl::gl_texture_to_screen | ( | float | xmin, |
float | ymin, | ||
float | xmax, | ||
float | ymax, | ||
float | umin, | ||
float | vmin, | ||
float | umax, | ||
float | vmax | ||
) |
cover the current viewport with a textured quad
Definition at line 803 of file gl_texture_tools.cxx.
CGV_API bool cgv::render::gl::load_texture | ( | const cgv::data::const_data_view & | data, |
unsigned | gl_tex_format, | ||
unsigned | level, | ||
unsigned | cube_side, | ||
int | num_array_layers, | ||
const std::vector< data_view > * | palettes | ||
) |
load data to a texture with the glTexImage commands and generate mipmaps if the level parameter is -1, return whether mipmaps were created
Definition at line 612 of file gl_texture_tools.cxx.
References ensure_glew_initialized(), generate_mipmaps(), cgv::data::data_format::get_depth(), cgv::data::data_view_base::get_format(), get_gl_cube_map_target(), cgv::data::data_format::get_height(), cgv::data::data_format::get_nr_dimensions(), cgv::data::data_view_impl< D, P >::get_ptr(), and cgv::data::data_format::get_width().
Referenced by create_texture().
unsigned cgv::render::gl::map_material_side | ( | MaterialSide | ms | ) |
Definition at line 20 of file gl_tools.cxx.
GLenum cgv::render::gl::map_to_gl | ( | AccessType | access_type | ) |
Definition at line 124 of file gl_context.cxx.
CGV_API GLuint cgv::render::gl::map_to_gl | ( | BlendFunction | blend_function | ) |
Definition at line 134 of file gl_context.cxx.
Definition at line 267 of file gl_context.cxx.
CGV_API unsigned cgv::render::gl::map_to_gl | ( | cgv::data::ComponentFormat | cf, |
cgv::data::ComponentIntegerInterpretation | cii | ||
) |
map a component format to a gl enum, return -1 of this was not possible
undefinded format with no component
red channel of color format
green channel of color format
blue channel of color format
alpha format
color format with luminance component L
color format with intensity component I
color format with luminance and alpha components: L and A
color format with intensity and alpha components: I and A
color format with components R, G
color format with components R, G and B
color format with components R, G, B and A
color format with components B, G and R
color format with components B, G, R and A
depth component
stencil component
undefinded format with no component
red channel of color format
green channel of color format
blue channel of color format
alpha format
color format with luminance component L
color format with intensity component I
color format with luminance and alpha components: L and A
color format with intensity and alpha components: I and A
color format with components R, G
color format with components R, G and B
color format with components R, G, B and A
color format with components B, G and R
color format with components B, G, R and A
depth component
stencil component
Definition at line 33 of file gl_texture_tools.cxx.
References cgv::data::CF_S.
CGV_API unsigned cgv::render::gl::map_to_gl | ( | cgv::type::info::TypeId | ti | ) |
map a type id to a gl enum
used for undefined type
void
boolean
signed integer stored in 8 bits
signed integer stored in 16 bits
signed integer stored in 32 bits
signed integer stored in 64 bits
unsigned integer stored in 8 bits
unsigned integer stored in 16 bits
unsigned integer stored in 32 bits
unsigned integer stored in 64 bits
floating point type stored in 16 bits
floating point type stored in 32 bits
floating point type stored in 64 bits
wchar
string type
wstring type
always the index after the last type
Definition at line 79 of file gl_texture_tools.cxx.
GLenum cgv::render::gl::map_to_gl | ( | CompareFunction | compare_func | ) |
Definition at line 160 of file gl_context.cxx.
CGV_API unsigned cgv::render::gl::map_to_gl | ( | MaterialSide | material_side | ) |
return OpenGL material side constant
Definition at line 113 of file gl_context.cxx.
CGV_API GLuint cgv::render::gl::map_to_gl | ( | PrimitiveType | primitive_type | ) |
Definition at line 90 of file gl_context.cxx.
GLenum cgv::render::gl::map_to_gl | ( | TextureFilter | filter_type | ) |
Definition at line 253 of file gl_context.cxx.
GLenum cgv::render::gl::map_to_gl | ( | TextureWrap | texture_wrap | ) |
Definition at line 238 of file gl_context.cxx.
CGV_API void cgv::render::gl::pop_textured_material_prog | ( | ) |
pop a shader program from the textured material stack
Definition at line 122 of file gl_tools.cxx.
CGV_API void cgv::render::gl::print_program_ressources | ( | shader_program & | prog, |
const std::string & | interface_name, | ||
ProgramInterface | prog_intf | ||
) |
print program resources for given interface
Definition at line 148 of file gl_tools.cxx.
References cgv::render::render_component::put_id().
CGV_API void cgv::render::gl::push_textured_material_prog | ( | shader_program & | prog | ) |
push a shader program onto the textured material stack
Definition at line 116 of file gl_tools.cxx.
CGV_API unsigned int cgv::render::gl::read_image_to_texture | ( | const std::string & | file_name, |
bool | mipmaps = true , |
||
double * | aspect_ptr = 0 , |
||
bool * | has_alpha_ptr = 0 |
||
) |
read the given image file into a texture and return the texture id or -1 in case of failure.
The aspect ratio of the texture is written into the value pointed to by aspect_ptr. In case has_alpha_ptr is provided a boolean telling whether the texture contains alpha values is written to this field.
Definition at line 27 of file gl_tools.cxx.
References create_texture(), cgv::data::component_format::get_component_index(), cgv::data::component_format::get_component_name(), cgv::data::data_format::get_height(), cgv::media::image::image_reader::get_last_error(), cgv::data::component_format::get_nr_components(), cgv::data::data_format::get_width(), and cgv::media::image::image_reader::read_image().
Referenced by cgv::render::gl::image_drawable::read_images().
CGV_API bool cgv::render::gl::read_image_to_textures | ( | const std::string & | file_name, |
std::vector< unsigned > & | tex_ids, | ||
std::vector< float > & | durations, | ||
bool | mipmaps, | ||
double * | aspect_ptr, | ||
bool * | has_alpha_ptr | ||
) |
read several images from one image file that can contain an animation
Definition at line 49 of file gl_tools.cxx.
References create_texture(), cgv::data::component_format::get_component_index(), cgv::data::component_format::get_component_name(), cgv::data::data_format::get_height(), cgv::media::image::image_reader::get_image_duration(), cgv::media::image::image_reader::get_last_error(), cgv::data::component_format::get_nr_components(), cgv::media::image::image_reader::get_nr_images(), cgv::data::data_format::get_width(), cgv::media::image::image_reader::open(), cgv::media::image::image_reader::read_image(), and cgv::media::image::image_reader::read_palette().
Referenced by cgv::render::gl::image_drawable::read_image().
std::vector< shader_program * > & cgv::render::gl::ref_shader_prog_stack | ( | ) |
Definition at line 109 of file gl_tools.cxx.
CGV_API shader_program & cgv::render::gl::ref_textured_material_prog | ( | context & | ctx | ) |
return a reference to the singleton textured material shader program, which is constructed on demand only
Definition at line 127 of file gl_tools.cxx.
CGV_API bool cgv::render::gl::render_to_texture3D | ( | context & | ctx, |
shader_program & | prog, | ||
TextureSampling | texture_sampling, | ||
texture & | target_tex, | ||
texture * | target_tex2 = 0 , |
||
texture * | target_tex3 = 0 , |
||
texture * | target_tex4 = 0 |
||
) |
Render to the given target 3D texture with the given shader program that must be completed with the function complete_program_form_render_to_texture3D()
.
The program needs to be enabled before calling this function and all uniforms necessary to the fragment shader implementation of the caller should be set. The fragment shader is called once per texel with input tex_coord
of type vec3
and the result is stored in the given texture, which cannot be enabled and used as input to the fragment shader. The texture_sampling
parameter steers the computation of the tex_coord
input. If additional textures are provided, they are attached as additional targets during render to texture. Then the fragment shader should access the different targets through the gl_FragData
[] array. All target textures must have the same resolution.
Definition at line 905 of file gl_texture_tools.cxx.
References cgv::render::frame_buffer::attach(), cgv::render::frame_buffer::create(), cgv::render::frame_buffer::disable(), cgv::render::context::draw_faces(), cgv::render::frame_buffer::enable(), cgv::data::data_format::get_depth(), cgv::data::data_format::get_height(), cgv::render::shader_program::get_uniform_location(), cgv::data::data_format::get_width(), cgv::render::frame_buffer::is_complete(), cgv::render::context::pop_window_transformation_array(), cgv::render::context::push_window_transformation_array(), cgv::render::shader_program::set_uniform(), cgv::render::context::set_viewport(), cgv::render::TS_CELL, and cgv::render::TS_VERTEX.
void cgv::render::gl::render_vertex | ( | int | k, |
const float * | vertices, | ||
const float * | normals, | ||
const float * | tex_coords, | ||
const int * | vertex_indices, | ||
const int * | normal_indices, | ||
const int * | tex_coord_indices, | ||
bool | flip_normals | ||
) |
Definition at line 1190 of file gl_context.cxx.
bool cgv::render::gl::replace_texture | ( | const cgv::data::const_data_view & | data, |
int | level = 0 , |
||
int | x = 0 , |
||
int | y = 0 , |
||
int | z = -1 , |
||
const std::vector< cgv::data::data_view > * | palettes = 0 |
||
) |
replace part or complete data of currently bound texture with the data in the given data view
Texture dimension is derived from the dimension of data view. The level gives the mipmap level in which to replace. A level of -1 corresponds to level 0 with recomputation of the mipmaps after replacement. x,y and z are offsets for 1D, 2D and 3D textures. In case of a cube map, the z parameter must be between 0 and 5 and defines the cube side in which to replace. Return value tells whether mipmaps have been recomputed
Definition at line 675 of file gl_texture_tools.cxx.
References generate_mipmaps(), cgv::data::data_format::get_depth(), cgv::data::data_view_base::get_format(), get_gl_cube_map_target(), cgv::data::data_format::get_height(), cgv::data::data_format::get_nr_dimensions(), cgv::data::data_view_impl< D, P >::get_ptr(), and cgv::data::data_format::get_width().
|
extern |
replace part or complete data of currently bound texture with the data in the given data view
Texture dimension is derived from the dimension of data view. The level gives the mipmap level in which to replace. A level of -1 corresponds to level 0 with recomputation of the mipmaps after replacement. x,y and z are offsets for 1D, 2D and 3D textures. In case of a cube map, the z parameter must be between 0 and 5 and defines the cube side in which to replace. Return value tells whether mipmaps have been recomputed
Definition at line 675 of file gl_texture_tools.cxx.
References generate_mipmaps(), cgv::data::data_format::get_depth(), cgv::data::data_view_base::get_format(), get_gl_cube_map_target(), cgv::data::data_format::get_height(), cgv::data::data_format::get_nr_dimensions(), cgv::data::data_view_impl< D, P >::get_ptr(), and cgv::data::data_format::get_width().
CGV_API void cgv::render::gl::set_gl_format | ( | texture & | tex, |
GLuint | gl_format, | ||
const std::string & | component_format_description | ||
) |
set a very specific texture format. This should be called after the texture is constructed and before it is created.
set a very specific texture format from a gl-constant and a component_format description. This should be called after the texture is constructed and before it is created.
Definition at line 289 of file gl_context.cxx.
References cgv::render::texture::set_component_format().
CGV_API void cgv::render::gl::set_lighting_parameters | ( | context & | ctx, |
shader_program & | prog | ||
) |
set the program variables needed by the lighting.glsl shader
Definition at line 96 of file gl_tools.cxx.
References cgv::render::context::get_max_nr_enabled_light_sources(), cgv::render::shader_program::set_uniform(), and cgv::render::shader_program::set_uniform_array().
std::string cgv::render::gl::value_type_index_to_string | ( | type_descriptor | td | ) |
Definition at line 2904 of file gl_context.cxx.
CGV_API float cgv::render::gl::black = { 0, 0, 0, 1 } |
Definition at line 21 of file gl_texture_tools.cxx.
CGV_API float cgv::render::gl::blue = { 0, 0, 1, 1 } |
Definition at line 30 of file gl_texture_tools.cxx.
CGV_API float cgv::render::gl::brown = { 0.3f, 0.1f, 0, 1 } |
Definition at line 25 of file gl_texture_tools.cxx.
Definition at line 198 of file gl_context.cxx.
CGV_API float cgv::render::gl::cyan = { 0, 1, 1, 1 } |
Definition at line 27 of file gl_texture_tools.cxx.
CGV_API float cgv::render::gl::dark_red = { 0.4f, 0, 0, 1 } |
Definition at line 26 of file gl_texture_tools.cxx.
Definition at line 189 of file gl_context.cxx.
|
static |
Definition at line 436 of file gl_texture_tools.cxx.
|
static |
Definition at line 265 of file gl_texture_tools.cxx.
Definition at line 183 of file gl_context.cxx.
Definition at line 175 of file gl_context.cxx.
|
static |
Definition at line 428 of file gl_texture_tools.cxx.
|
static |
Definition at line 247 of file gl_texture_tools.cxx.
|
static |
Definition at line 338 of file gl_texture_tools.cxx.
|
static |
Definition at line 445 of file gl_texture_tools.cxx.
GLuint cgv::render::gl::gl_shader_type[] |
Definition at line 2737 of file gl_context.cxx.
|
static |
Definition at line 282 of file gl_texture_tools.cxx.
|
static |
Definition at line 154 of file gl_texture_tools.cxx.
GLuint cgv::render::gl::gl_tex_dim[] = { GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D, GL_TEXTURE_1D_ARRAY, GL_TEXTURE_2D_ARRAY, GL_TEXTURE_CUBE_MAP_EXT } |
Definition at line 122 of file gl_texture_tools.cxx.
CGV_API float cgv::render::gl::gray = { 0.25f, 0.25f, 0.25f, 1 } |
Definition at line 23 of file gl_texture_tools.cxx.
CGV_API float cgv::render::gl::green = { 0, 1, 0, 1 } |
Definition at line 24 of file gl_texture_tools.cxx.
|
static |
Definition at line 383 of file gl_texture_tools.cxx.
|
static |
Definition at line 136 of file gl_tools.cxx.
size_t cgv::render::gl::max_nr_indices |
Definition at line 1381 of file gl_context.cxx.
size_t cgv::render::gl::max_nr_vertices |
Definition at line 1381 of file gl_context.cxx.
CGV_API float cgv::render::gl::red = { 1, 0, 0, 1 } |
Definition at line 29 of file gl_texture_tools.cxx.
|
static |
Definition at line 478 of file gl_texture_tools.cxx.
|
static |
Definition at line 310 of file gl_texture_tools.cxx.
|
static |
Definition at line 201 of file gl_texture_tools.cxx.
CGV_API float cgv::render::gl::white = { 1, 1, 1, 1 } |
Definition at line 22 of file gl_texture_tools.cxx.
CGV_API float cgv::render::gl::yellow = { 1, 1, 0, 1 } |
Definition at line 28 of file gl_texture_tools.cxx.