4#include <cgv/data/data_view.h>
5#include <cgv/render/context.h>
30extern CGV_API
bool generate_mipmaps(
unsigned int dim,
bool is_cubemap,
bool is_array =
false, std::string* last_error = 0);
33extern CGV_API
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,
bool show_debug_info =
false);
36extern 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);
39extern CGV_API
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);
42extern 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);
51extern 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);
54extern CGV_API
void read_texture(cgv::data::data_view& data,
unsigned level = -1);
60extern 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);
63extern 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);
67extern 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);
74extern 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,
75 float umin = 0.0f,
float vmin = 0.0f,
float umax = 1.0f,
float vmax = 1.0f);
77DEPRECATED(
"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,
78 float umin = 0.0f,
float vmin = 0.0f,
float umax = 1.0f,
float vmax = 1.0f);
81DEPRECATED(
"deprecated, use cgv::render::context based light management.") extern CGV_API
void set_lighting_parameters(context& ctx, shader_program& prog);
84DEPRECATED(
"deprecated, use cgv::render::context::ref_surface_shader_prog() instead.") extern CGV_API shader_program&
ref_textured_material_prog(context& ctx);
87DEPRECATED(
"deprecated, use automatic cgv::render::context based shader_program stack.") extern CGV_API
void push_textured_material_prog(shader_program& prog);
90DEPRECATED(
"deprecated, use automatic cgv::render::context based shader_program stack.") extern CGV_API
void pop_textured_material_prog();
107extern 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);
115 PI_VERTEX_SUBROUTINE, PI_TESS_CONTROL_SUBROUTINE, PI_TESS_EVALUATION_SUBROUTINE, PI_GEOMETRY_SUBROUTINE, PI_FRAGMENT_SUBROUTINE, PI_COMPUTE_SUBROUTINE,
116 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,
117 PI_TRANSFORM_FEEDBACK_VARYING,
119 PI_SHADER_STORAGE_BLOCK
129#include <cgv/config/lib_end.h>
base class for all drawables, which is independent of the used rendering API.
a shader program combines several shader code fragments to a complete definition of the shading pipel...
the texture class encapsulates all functionality independent of the rendering api.
ComponentFormat
define standard formats, which should be used to avoid wrong assignment of component names
ComponentIntegerInterpretation
define different interpretations of integer components
namespace for opengl specific GPU programming
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
void read_texture(cgv::data::data_view &data, unsigned level)
read back a texture into a data view with the glGetTexImage command
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
unsigned find_best_texture_format(const cgv::data::component_format &_cf, cgv::data::component_format *best_cf, const std::vector< data_view > *palettes, bool show_debug_info)
map the given component format to the best matching available gl component format
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 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...
namespace for api independent GPU programming
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
this header is dependency free