17 mutable bool state_out_of_date;
19 bool complete_create(
const context& ctx,
bool created);
21 using render_component::last_error;
29 texture(
const std::string& description =
"uint8[R,G,B,A]",
40 bool set_data_format(
const std::string& description);
42 void set_component_format(
const component_format& cf);
44 void set_component_format(
const std::string& description);
60 void set_border_color(
float r,
float g,
float b,
float a = 1.0f);
63 void set_min_filter(
TextureFilter _min_filter,
float _anisotropy = 2.0f);
67 float get_anisotropy()
const;
73 void set_priority(
float _priority);
75 float get_priority()
const;
77 void set_compare_mode(
bool use_compare_function);
79 bool get_compare_mode()
const;
85 bool mipmaps_created()
const;
87 void set_nr_multi_samples(
unsigned _nr_samples);
93 void set_fixed_sample_locations(
bool use);
95 void ensure_state(
const context& ctx)
const;
97 bool is_enabled()
const;
99 int get_tex_unit()
const;
105 void find_best_format(
const context& ctx,
const std::vector<cgv::data::data_view>* palettes = 0);
110 bool create(
const context& ctx,
TextureType _tt = TT_UNDEF,
unsigned width=-1,
unsigned height=-1,
unsigned depth=-1);
120 bool create_from_image(
const context& ctx,
const std::string& file_name =
"",
121 int* image_width_ptr = 0,
int* image_height_ptr = 0,
122 unsigned char* clear_color_ptr = 0,
int level = -1,
int cube_side = -1);
127 unsigned char* clear_color_ptr = 0,
int level = -1,
int cube_side = -1);
131 static bool deduce_file_names(
const std::string& file_names, std::vector<std::string>& deduced_names);
150 bool create_from_images(
const context& ctx,
const std::string& file_names,
int level = -1);
152 bool write_to_file(
context& ctx,
const std::string& file_name,
unsigned int z_or_cube_side = -1,
float depth_map_gamma = 1.0f,
const std::string& options =
"")
const;
154 bool create_mipmaps(
const context& ctx);
157 bool generate_mipmaps(
const context& ctx);
163 bool create_from_buffer(
const context& ctx,
int x,
int y,
int width,
int height,
int level = -1);
176 bool create(
const context& ctx,
const cgv::data::const_data_view& data,
int level = -1,
int cube_side = -1,
int num_array_layers = 0,
const std::vector<cgv::data::data_view>* palettes = 0);
189 bool replace(
const context& ctx,
int x,
int y,
int z_or_cube_side,
const cgv::data::const_data_view& data,
int level = -1,
const std::vector<cgv::data::data_view>* palettes = 0);
191 bool replace_from_buffer(
const context& ctx,
int x,
int y,
int x_buffer,
192 int y_buffer,
int width,
int height,
int level = -1);
194 bool replace_from_buffer(
const context& ctx,
int x,
int y,
int z_or_cube_side,
int x_buffer,
195 int y_buffer,
int width,
int height,
int level);
197 bool replace_from_image(
const context& ctx,
const std::string& file_name,
int x,
int y,
int z_or_cube_side,
int level);
201 const std::string& file_name,
int x,
int y,
int z_or_cube_side,
int level);
203 bool destruct(
const context& ctx);
210 bool enable(
const context& ctx,
int tex_unit = -1);
212 bool disable(
const context& ctx);
222 bool bind_as_image(
const context& ctx,
int tex_unit,
int level = 0,
bool bind_array =
false,
int layer = 0,
AccessType access = AT_WRITE_ONLY);
base class for all drawables, which is independent of the used rendering API.
base interface for a texture
the texture class encapsulates all functionality independent of the rendering api.
bool use_fixed_sample_locations() const
whether multi sampling uses fixed sample locations
void set_border_color(const float *rgba)
set the border color
unsigned get_nr_multi_samples() const
return number of multi samples for textures of type TT_MULTISAMPLE_2D and TT_MULTISAMPLE_2D_ARRAY