4#include <cgv/data/data_view.h>
5#include <cgv/render/context.h>
19extern CGV_API
float black[4], white[4], gray[4], green[4], brown[4], dark_red[4], cyan[4], yellow[4], red[4], blue[4];
34extern CGV_API
bool generate_mipmaps(
unsigned int dim,
bool is_cubemap,
bool is_array =
false, std::string* last_error = 0);
40extern CGV_API
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);
46extern 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);
61extern CGV_API
unsigned int read_image_to_texture(
const std::string& file_name,
bool mipmaps =
true,
double* aspect_ptr = 0,
bool* has_alpha_ptr = 0);
64extern CGV_API
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);
68extern CGV_API
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);
75extern CGV_API
bool 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,
76 float umin = 0.0f,
float vmin = 0.0f,
float umax = 1.0f,
float vmax = 1.0f);
78DEPRECATED(
"deprecated, use cover_screen instead.") extern CGV_API
void gl_texture_to_screen(
float xmin = -1.0f,
float ymin = -1.0f,
float xmax = 1.0f,
float ymax = 1.0f,
79 float umin = 0.0f,
float vmin = 0.0f,
float umax = 1.0f,
float vmax = 1.0f);
82DEPRECATED("deprecated, use
cgv::render::context based light management.") extern CGV_API
void set_lighting_parameters(context& ctx, shader_program& prog);
85DEPRECATED("deprecated, use
cgv::render::context::ref_surface_shader_prog() instead.") extern CGV_API shader_program&
ref_textured_material_prog(context& ctx);
88DEPRECATED("deprecated, use automatic
cgv::render::context based shader_program stack.") extern CGV_API
void push_textured_material_prog(shader_program& prog);
108extern CGV_API
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);
116 PI_VERTEX_SUBROUTINE, PI_TESS_CONTROL_SUBROUTINE, PI_TESS_EVALUATION_SUBROUTINE, PI_GEOMETRY_SUBROUTINE, PI_FRAGMENT_SUBROUTINE, PI_COMPUTE_SUBROUTINE,
117 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,
118 PI_TRANSFORM_FEEDBACK_VARYING,
120 PI_SHADER_STORAGE_BLOCK
130#include <cgv/config/lib_end.h>
The const_data_view has the functionality of the data_view but uses a const pointer and therefore doe...
a shader program combines several shader code fragments to a complete definition of the shading pipel...
ComponentFormat
define standard formats, which should be used to avoid wrong assignment of component names
ComponentIntegerInterpretation
define different interpretations of integer components
void push_textured_material_prog(shader_program &prog)
push a shader program onto the textured material stack
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
bool 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...
unsigned int 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
void set_lighting_parameters(context &ctx, shader_program &prog)
set the program variables needed by the lighting.glsl shader
bool 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
bool complete_program_form_render_to_texture3D(cgv::render::context &ctx, cgv::render::shader_program &prog, std::string *error_message)
complete the given shader program that is assumed to have a working fragment shader.
void print_program_ressources(shader_program &prog, const std::string &interface_name, ProgramInterface prog_intf)
print program resources for given interface
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 read_image_to_texture(const std::string &file_name, bool mipmaps, double *aspect_ptr, bool *has_alpha_ptr)
read the given image file into a texture and return the texture id or -1 in case of failure.
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 ...
void 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
shader_program & ref_textured_material_prog(context &ctx)
return a reference to the singleton textured material shader program, which is constructed on demand ...
ProgramInterface
different program interfaces
void pop_textured_material_prog()
pop a shader program from the textured material stack
bool 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 p...
unsigned 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
unsigned get_gl_cube_map_target(unsigned side)
return one of the six cube map sides gl enums
bool render_to_texture3D(context &ctx, shader_program &prog, TextureSampling texture_sampling, texture &target_tex, texture *target_tex2, texture *target_tex3, texture *target_tex4)
Render to the given target 3D texture with the given shader program that must be completed with the f...
MaterialSide
different sides of a material
TextureSampling
different sampling strategies for rendering to textures that steer the computation of the tex_coord i...
TypeId
ids for the different types and type constructs