cgv
Loading...
Searching...
No Matches
cgv::render::gl Namespace Reference

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< intget_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)
 
voidget_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_programref_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 chardepth_formats []
 
static const charcolor_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 []
 

Detailed Description

namespace for opengl specific GPU programming

Enumeration Type Documentation

◆ ContouringType

type of contouring method >

Definition at line 22 of file gl_implicit_surface_drawable_base.h.

◆ NormalComputationType

normal computation type >

Definition at line 24 of file gl_implicit_surface_drawable_base.h.

◆ ProgramInterface

different program interfaces

Definition at line 111 of file gl_tools.h.

Function Documentation

◆ buffer_target()

GLenum cgv::render::gl::buffer_target ( VertexBufferType  vbt)

Definition at line 3526 of file gl_context.cxx.

◆ buffer_usage()

GLenum cgv::render::gl::buffer_usage ( VertexBufferUsage  vbu)

Definition at line 3541 of file gl_context.cxx.

◆ checkClientState()

void cgv::render::gl::checkClientState ( )

Definition at line 95 of file gl_performance_monitor.cxx.

◆ complete_program_form_render_to_texture3D()

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().

◆ complete_rect_from_vp()

void cgv::render::gl::complete_rect_from_vp ( ivec4 D,
GLint  vp[4] 
)

Definition at line 2572 of file gl_context.cxx.

◆ configure_src_format()

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.

◆ cover_screen()

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 
)

◆ create_texture() [1/3]

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().

◆ create_texture() [2/3]

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().

◆ create_texture() [3/3]

CGV_API unsigned int cgv::render::gl::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 
)
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().

◆ debug_callback()

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.

◆ ensure_glew_initialized()

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().

◆ find_best_texture_format()

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 
)

◆ generate_mipmaps()

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().

◆ get_aab_ptr()

attribute_array_binding *& cgv::render::gl::get_aab_ptr ( )

Definition at line 1206 of file gl_context.cxx.

◆ get_context_creation_attrib_list()

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.

◆ get_gl_cube_map_target()

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().

◆ get_gl_format()

CGV_API GLuint cgv::render::gl::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.

Definition at line 296 of file gl_context.cxx.

References find_best_texture_format().

◆ get_gl_id()

CGV_API GLuint cgv::render::gl::get_gl_id ( const void handle)

Definition at line 271 of file gl_context.cxx.

◆ get_handle()

CGV_API void * cgv::render::gl::get_handle ( GLuint  id)

Definition at line 276 of file gl_context.cxx.

◆ get_severity_tag_name()

std::string cgv::render::gl::get_severity_tag_name ( GLenum  tag)

Definition at line 400 of file gl_context.cxx.

◆ get_source_tag_name()

std::string cgv::render::gl::get_source_tag_name ( GLenum  tag)

Definition at line 371 of file gl_context.cxx.

◆ get_tex_bind()

GLenum cgv::render::gl::get_tex_bind ( TextureType  texture_type)

Definition at line 221 of file gl_context.cxx.

◆ get_tex_dim()

GLenum cgv::render::gl::get_tex_dim ( TextureType  texture_type)

Definition at line 205 of file gl_context.cxx.

◆ get_type_tag_name()

std::string cgv::render::gl::get_type_tag_name ( GLenum  tag)

Definition at line 384 of file gl_context.cxx.

◆ get_vbo_ptr()

vertex_buffer *& cgv::render::gl::get_vbo_ptr ( )

Definition at line 1212 of file gl_context.cxx.

◆ gl_1D_texture_to_screen()

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.

◆ gl_error()

std::string cgv::render::gl::gl_error ( )

Definition at line 1808 of file gl_context.cxx.

◆ gl_error_to_string()

std::string cgv::render::gl::gl_error_to_string ( GLenum  eid)

Definition at line 1792 of file gl_context.cxx.

◆ gl_set_material()

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.

◆ gl_set_material_color()

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.

◆ gl_texture_to_screen()

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.

◆ is_glew_initialized()

CGV_API bool cgv::render::gl::is_glew_initialized ( )

Definition at line 14 of file gl.cxx.

◆ load_texture()

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 
)

◆ map_material_side()

unsigned cgv::render::gl::map_material_side ( MaterialSide  ms)

Definition at line 20 of file gl_tools.cxx.

◆ map_to_gl() [1/10]

GLenum cgv::render::gl::map_to_gl ( AccessType  access_type)

Definition at line 124 of file gl_context.cxx.

◆ map_to_gl() [2/10]

CGV_API GLuint cgv::render::gl::map_to_gl ( BlendFunction  blend_function)

Definition at line 134 of file gl_context.cxx.

◆ map_to_gl() [3/10]

CGV_API GLboolean cgv::render::gl::map_to_gl ( bool  flag)

Definition at line 267 of file gl_context.cxx.

◆ map_to_gl() [4/10]

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.

◆ map_to_gl() [5/10]

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.

◆ map_to_gl() [6/10]

GLenum cgv::render::gl::map_to_gl ( CompareFunction  compare_func)

Definition at line 160 of file gl_context.cxx.

◆ map_to_gl() [7/10]

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.

◆ map_to_gl() [8/10]

CGV_API GLuint cgv::render::gl::map_to_gl ( PrimitiveType  primitive_type)

Definition at line 90 of file gl_context.cxx.

◆ map_to_gl() [9/10]

GLenum cgv::render::gl::map_to_gl ( TextureFilter  filter_type)

Definition at line 253 of file gl_context.cxx.

◆ map_to_gl() [10/10]

GLenum cgv::render::gl::map_to_gl ( TextureWrap  texture_wrap)

Definition at line 238 of file gl_context.cxx.

◆ pop_textured_material_prog()

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.

◆ print_program_ressources()

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().

◆ push_textured_material_prog()

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.

◆ read_image_to_texture()

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().

◆ read_image_to_textures()

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 
)

◆ ref_initialized()

bool & cgv::render::gl::ref_initialized ( )

Definition at line 8 of file gl.cxx.

◆ ref_shader_prog_stack()

std::vector< shader_program * > & cgv::render::gl::ref_shader_prog_stack ( )

Definition at line 109 of file gl_tools.cxx.

◆ ref_textured_material_prog()

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.

◆ render_to_texture3D()

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.

◆ render_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.

◆ replace_texture() [1/2]

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().

◆ replace_texture() [2/2]

CGV_API 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 
)
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().

◆ set_gl_format()

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().

◆ set_lighting_parameters()

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().

◆ value_type_index_to_string()

std::string cgv::render::gl::value_type_index_to_string ( type_descriptor  td)

Definition at line 2904 of file gl_context.cxx.

Variable Documentation

◆ black

CGV_API float cgv::render::gl::black = { 0, 0, 0, 1 }

Definition at line 21 of file gl_texture_tools.cxx.

◆ blue

CGV_API float cgv::render::gl::blue = { 0, 0, 1, 1 }

Definition at line 30 of file gl_texture_tools.cxx.

◆ brown

CGV_API float cgv::render::gl::brown = { 0.3f, 0.1f, 0, 1 }

Definition at line 25 of file gl_texture_tools.cxx.

◆ color_buffer_formats

const char* cgv::render::gl::color_buffer_formats[]
static
Initial value:
=
{
"[R,G,B]",
"[R,G,B,A]",
0
}

Definition at line 198 of file gl_context.cxx.

◆ cyan

CGV_API float cgv::render::gl::cyan = { 0, 1, 1, 1 }

Definition at line 27 of file gl_texture_tools.cxx.

◆ dark_red

CGV_API float cgv::render::gl::dark_red = { 0.4f, 0, 0, 1 }

Definition at line 26 of file gl_texture_tools.cxx.

◆ depth_formats [1/2]

const char* cgv::render::gl::depth_formats[]
static
Initial value:
=
{
"[D]",
"uint16[D]",
"uint32[D:24]",
"uint32[D]",
0
}

Definition at line 189 of file gl_context.cxx.

◆ depth_formats [2/2]

const char* cgv::render::gl::depth_formats[]
static
Initial value:
=
{
"[D]",
"uint16[D]",
"uint32[D:24]",
"uint32[D]",
0
}

Definition at line 436 of file gl_texture_tools.cxx.

◆ float_texture_formats

const char* cgv::render::gl::float_texture_formats[]
static
Initial value:
= {
"flt32[R,G,B,A]",
"flt32[R,G,B]",
"flt32[A]",
"flt32[I]",
"flt32[L]",
"flt32[L,A]",
"flt16[R,G,B,A]",
"flt16[R,G,B]",
"flt16[A]",
"flt16[I]",
"flt16[L]",
"flt16[L,A]",
0
}

Definition at line 265 of file gl_texture_tools.cxx.

◆ gl_color_buffer_format_ids

const GLenum cgv::render::gl::gl_color_buffer_format_ids[]
static
Initial value:
=
{
}
complete implementation of method actions that only call one method when entering a node
Definition action.h:113

Definition at line 183 of file gl_context.cxx.

◆ gl_depth_format_ids [1/2]

const GLenum cgv::render::gl::gl_depth_format_ids[]
static

◆ gl_depth_format_ids [2/2]

const GLenum cgv::render::gl::gl_depth_format_ids[]
static
Initial value:
=
{
GL_DEPTH_COMPONENT,
GL_DEPTH_COMPONENT16_ARB,
GL_DEPTH_COMPONENT24_ARB,
GL_DEPTH_COMPONENT32_ARB
}

Definition at line 428 of file gl_texture_tools.cxx.

◆ gl_float_texture_format_ids

const GLenum cgv::render::gl::gl_float_texture_format_ids[]
static
Initial value:
=
{
GL_RGBA32F_ARB,
GL_RGB32F_ARB,
GL_ALPHA32F_ARB,
GL_INTENSITY32F_ARB,
GL_LUMINANCE32F_ARB,
GL_LUMINANCE_ALPHA32F_ARB,
GL_RGBA16F_ARB,
GL_RGB16F_ARB,
GL_ALPHA16F_ARB,
GL_INTENSITY16F_ARB,
GL_LUMINANCE16F_ARB,
GL_LUMINANCE_ALPHA16F_ARB,
}

Definition at line 247 of file gl_texture_tools.cxx.

◆ gl_int_texture_format_ids

const GLenum cgv::render::gl::gl_int_texture_format_ids[]
static

Definition at line 338 of file gl_texture_tools.cxx.

◆ gl_rg_texture_format_ids

const GLenum cgv::render::gl::gl_rg_texture_format_ids[]
static

Definition at line 445 of file gl_texture_tools.cxx.

◆ gl_shader_type

GLuint cgv::render::gl::gl_shader_type[]

◆ gl_snorm_texture_format_ids

const GLenum cgv::render::gl::gl_snorm_texture_format_ids[]
static
Initial value:
=
{
GL_RED_SNORM,
GL_RG_SNORM,
GL_RGB_SNORM,
GL_RGBA_SNORM,
GL_ALPHA_SNORM,
GL_LUMINANCE_SNORM,
GL_LUMINANCE_ALPHA_SNORM,
GL_INTENSITY_SNORM,
GL_R8_SNORM,
GL_RG8_SNORM,
GL_RGB8_SNORM,
GL_RGBA8_SNORM,
GL_ALPHA8_SNORM,
GL_LUMINANCE8_SNORM,
GL_LUMINANCE8_ALPHA8_SNORM,
GL_INTENSITY8_SNORM,
GL_R16_SNORM,
GL_RG16_SNORM,
GL_RGB16_SNORM,
GL_RGBA16_SNORM,
GL_ALPHA16_SNORM,
GL_LUMINANCE16_SNORM,
GL_LUMINANCE16_ALPHA16_SNORM,
GL_INTENSITY16_SNORM
}

Definition at line 282 of file gl_texture_tools.cxx.

◆ gl_std_texture_format_ids

const GLenum cgv::render::gl::gl_std_texture_format_ids[]
static

Definition at line 154 of file gl_texture_tools.cxx.

◆ gl_tex_dim

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.

◆ gray

CGV_API float cgv::render::gl::gray = { 0.25f, 0.25f, 0.25f, 1 }

Definition at line 23 of file gl_texture_tools.cxx.

◆ green

CGV_API float cgv::render::gl::green = { 0, 1, 0, 1 }

Definition at line 24 of file gl_texture_tools.cxx.

◆ int_texture_formats

const char* cgv::render::gl::int_texture_formats[]
static

Definition at line 383 of file gl_texture_tools.cxx.

◆ interface_ids

GLenum cgv::render::gl::interface_ids[]
static
Initial value:
= {
GL_UNIFORM,
GL_UNIFORM_BLOCK,
GL_PROGRAM_INPUT,
GL_PROGRAM_OUTPUT,
GL_VERTEX_SUBROUTINE, GL_TESS_CONTROL_SUBROUTINE, GL_TESS_EVALUATION_SUBROUTINE, GL_GEOMETRY_SUBROUTINE, GL_FRAGMENT_SUBROUTINE, GL_COMPUTE_SUBROUTINE,
GL_VERTEX_SUBROUTINE_UNIFORM, GL_TESS_CONTROL_SUBROUTINE_UNIFORM, GL_TESS_EVALUATION_SUBROUTINE_UNIFORM, GL_GEOMETRY_SUBROUTINE_UNIFORM, GL_FRAGMENT_SUBROUTINE_UNIFORM, GL_COMPUTE_SUBROUTINE_UNIFORM,
GL_TRANSFORM_FEEDBACK_VARYING,
GL_BUFFER_VARIABLE,
GL_SHADER_STORAGE_BLOCK
}

Definition at line 136 of file gl_tools.cxx.

◆ max_nr_indices

size_t cgv::render::gl::max_nr_indices

Definition at line 1381 of file gl_context.cxx.

◆ max_nr_vertices

size_t cgv::render::gl::max_nr_vertices

Definition at line 1381 of file gl_context.cxx.

◆ red

CGV_API float cgv::render::gl::red = { 1, 0, 0, 1 }

Definition at line 29 of file gl_texture_tools.cxx.

◆ rg_texture_formats

const char* cgv::render::gl::rg_texture_formats[]
static

Definition at line 478 of file gl_texture_tools.cxx.

◆ snorm_texture_formats

const char* cgv::render::gl::snorm_texture_formats[]
static
Initial value:
= {
"s[R]",
"s[R,G]",
"s[R,G,B]",
"s[R,G,B,A]",
"s[A]",
"s[L]",
"s[L,A]",
"s[I]",
"sint8[R]",
"sint8[R,G]",
"sint8[R,G,B]",
"sint8[R,G,B,A]",
"sint8[A]",
"sint8[L]",
"sint8[L,A]",
"sint8[I]",
"sint16[R]",
"sint16[R,G]",
"sint16[R,G,B]",
"sint16[R,G,B,A]",
"sint16[A]",
"sint16[L]",
"sint16[L,A]",
"sint16[I]",
0
}

Definition at line 310 of file gl_texture_tools.cxx.

◆ std_texture_formats

const char* cgv::render::gl::std_texture_formats[]
static

Definition at line 201 of file gl_texture_tools.cxx.

◆ white

CGV_API float cgv::render::gl::white = { 1, 1, 1, 1 }

Definition at line 22 of file gl_texture_tools.cxx.

◆ yellow

CGV_API float cgv::render::gl::yellow = { 1, 1, 0, 1 }

Definition at line 28 of file gl_texture_tools.cxx.