4#include <cgv/render/context.h>
5#include <cgv/render/shader_program.h>
6#include <cgv_gl/gl/gl.h>
20extern CGV_API
void set_gl_format(texture& tex, GLuint gl_format,
const std::string& component_format_description);
31extern CGV_API GLboolean map_to_gl(
bool flag);
33extern CGV_API GLuint get_gl_id(
const void* handle);
35extern CGV_API
void* get_handle(GLuint
id);
46 GLuint texture_bind(
TextureType tt, GLuint tex_id)
const;
47 void texture_unbind(
TextureType tt, GLuint tmp_id)
const;
58 bool debug_texture_format_matching =
false;
59 void ensure_configured()
const;
60 void destruct_render_objects()
override;
61 void put_id(
void* handle,
void* ptr)
const override;
62 void draw_elements_void(GLenum mode,
size_t count, GLenum type,
size_t type_size,
const void* indices)
const;
64 void draw_elements(GLenum mode,
size_t count,
const T* indices)
const {
66 error(
"called draw_elements with invalid index type");
75 bool texture_replace(
texture_base& tb,
int x,
int y,
int z_or_cube_side,
const cgv::data::const_data_view& data,
int level,
const std::vector<cgv::data::data_view>* palettes = 0)
const override;
76 bool texture_replace_from_buffer(
texture_base& tb,
int x,
int y,
int z_or_cube_side,
int x_buffer,
int y_buffer,
unsigned int width,
unsigned int height,
int level)
const override;
79 bool texture_generate_mipmaps(
texture_base& tb,
unsigned int dim)
const override;
81 bool texture_set_state(
const texture_base& tb)
const override;
82 bool texture_enable(
texture_base& tb,
int tex_unit,
unsigned int nr_dims)
const override;
83 bool texture_disable(
texture_base& tb,
int tex_unit,
unsigned int nr_dims)
const override;
84 bool texture_bind_as_image(
texture_base& tb,
int tex_unit,
int level,
bool bind_array,
int layer,
AccessType access)
const override;
97 int frame_buffer_get_max_nr_color_attachments()
const override;
98 int frame_buffer_get_max_nr_draw_buffers()
const override;
112 bool shader_program_get_active_uniforms(
shader_program_base& spb, std::vector<std::string>& names)
const override;
115 int get_uniform_location(
const shader_program_base& spb,
const std::string& name)
const override;
118 int get_attribute_location(
const shader_program_base& spb,
const std::string& name)
const override;
132 bool vertex_buffer_create(
vertex_buffer_base& vbb,
const void* array_ptr,
size_t size_in_bytes)
const override;
133 bool vertex_buffer_resize(
vertex_buffer_base& vbb,
const void* array_ptr,
size_t size_in_bytes)
const override;
134 bool vertex_buffer_clear(
vertex_buffer_base& vbb,
size_t offset,
size_t size_in_bytes)
const override;
135 bool vertex_buffer_replace(
vertex_buffer_base& vbb,
size_t offset,
size_t size_in_bytes,
const void* array_ptr)
const override;
137 bool vertex_buffer_copy_back(
const vertex_buffer_base& vbb,
size_t offset,
size_t size_in_bytes,
void* array_ptr)
const override;
149 void draw_textual_info()
override;
154 void rotate_vector_to_target(
const dvec3& vector,
const dvec3& target);
163 void set_bg_color(
vec4 rgba)
override;
165 void set_bg_depth(
float d)
override;
167 void set_bg_stencil(
int s)
override;
169 void set_bg_accum_color(
vec4 rgba)
override;
171 void clear_background(
bool color_flag,
bool depth_flag,
bool stencil_flag =
false,
bool accum_flag =
false)
override;
174 float get_info_font_size()
const;
178 float get_current_font_size()
const override;
182 void perform_screen_shot()
override;
184 RenderAPI get_render_api()
const override;
186 void init_render_pass()
override;
188 void finish_render_pass()
override;
192 void set_color(
const rgba& clr)
override;
200 shader_program& ref_default_shader_program(
bool texture_support =
false)
override;
202 shader_program& ref_surface_shader_program(
bool texture_support =
false)
override;
204 void enumerate_program_uniforms(
shader_program& prog, std::vector<std::string>& names, std::vector<int>* locations_ptr = 0, std::vector<int>* sizes_ptr = 0, std::vector<int>* types_ptr = 0,
bool show =
false)
const override;
206 void enumerate_program_attributes(
shader_program& prog, std::vector<std::string>& names, std::vector<int>* locations_ptr = 0, std::vector<int>* sizes_ptr = 0, std::vector<int>* types_ptr = 0,
bool show =
false)
const override;
208 void on_lights_changed()
override;
210 void tesselate_arrow(
double length = 1,
double aspect = 0.1,
double rel_tip_radius = 2.0,
double tip_aspect = 0.3,
int res = 25,
bool edges =
false)
override;
212 void tesselate_arrow(
const dvec3& start,
const dvec3& end,
double aspect = 0.1f,
double rel_tip_radius = 2.0f,
double tip_aspect = 0.3f,
int res = 25,
bool edges =
false)
override;
217 void announce_external_viewport_change(
ivec4& cgv_viewport_storage)
override;
219 void recover_from_external_viewport_change(
const ivec4& cgv_viewport_storage)
override;
221 void announce_external_frame_buffer_change(
void*& cgv_fbo_storage)
override;
223 void recover_from_external_frame_buffer_change(
void* cgv_fbo_storage)
override;
228 void push_pixel_coords()
override;
230 void pop_pixel_coords()
override;
232 virtual bool read_frame_buffer(
234 unsigned int x = 0,
unsigned int y = 0,
238 int w = -1,
int h = -1)
override;
244 bool prepare_attributes(std::vector<vec3>& P, std::vector<vec3>& N, std::vector<vec2>& T,
unsigned nr_vertices,
245 const float* vertices,
const float* normals,
const float* tex_coords,
246 const int* vertex_indices,
const int* normal_indices,
const int* tex_coord_indices,
bool flip_normals)
const;
248 bool release_attributes(
const float* normals,
const float* tex_coords,
const int* normal_indices,
const int* tex_coord_indices)
const;
250 void draw_edges_of_faces(
251 const float* vertices,
const float* normals,
const float* tex_coords,
252 const int* vertex_indices,
const int* normal_indices,
const int* tex_coord_indices,
253 int nr_faces,
int face_degree,
bool flip_normals =
false)
const override;
255 void draw_edges_of_strip_or_fan(
256 const float* vertices,
const float* normals,
const float* tex_coords,
257 const int* vertex_indices,
const int* normal_indices,
const int* tex_coord_indices,
258 int nr_faces,
int face_degree,
bool is_fan,
bool flip_normals =
false)
const override;
261 const float* vertices,
const float* normals,
const float* tex_coords,
262 const int* vertex_indices,
const int* normal_indices,
const int* tex_coord_indices,
263 int nr_faces,
int face_degree,
bool flip_normals)
const override;
265 void draw_strip_or_fan(
266 const float* vertices,
const float* normals,
const float* tex_coords,
267 const int* vertex_indices,
const int* normal_indices,
const int* tex_coord_indices,
268 int nr_faces,
int face_degree,
bool is_fan,
bool flip_normals)
const override;
279 void enable_depth_test()
override;
281 void disable_depth_test()
override;
284 void set_cull_state(
CullingMode culling_mode)
override;
287 void set_blend_state(
BlendState state)
override;
293 void enable_blending()
override;
295 void disable_blending()
override;
298 void set_buffer_mask(
BufferMask mask)
override;
300 void set_depth_mask(
bool flag)
override;
302 void set_color_mask(
bvec4 flags)
override;
309 dmat4 get_modelview_matrix()
const override;
311 void set_modelview_matrix(
const dmat4& V)
override;
313 dmat4 get_projection_matrix()
const override;
315 void set_projection_matrix(
const dmat4& P)
override;
318 void pop_window_transformation_array()
override;
320 unsigned get_max_window_transformation_array_size()
const override;
324 void update_window_transformation_array();
327 void set_viewport(
const ivec4& viewport,
int array_index = -1)
override;
329 void set_depth_range(
const dvec2& depth_range =
dvec2(0, 1),
int array_index = -1)
override;
334 double get_window_z(
int x_window,
int y_window)
const override;
342#include <cgv/config/lib_end.h>
complete implementation of method actions that only call one method when entering a node
The const_data_view has the functionality of the data_view but uses a const pointer and therefore doe...
the data view gives access to a data array of one, two, three or four dimensions.
matrix of fixed size dimensions
base class for attribute_array_bindings
base class for all drawables, which is independent of the used rendering API.
base interface for framebuffer
implementation of the context API for the OpenGL API excluding methods for font selection,...
float info_font_size
font size to draw textual info
cgv::media::font::font_face_ptr info_font_face
font used to draw textual info
base interface for a render_buffer
base interface for all render components
base interface for shader programs
a shader program combines several shader code fragments to a complete definition of the shading pipel...
base interface for a texture
class that extends obj_material with the management of textures
base interface for a vertex buffer
ComponentFormat
define standard formats, which should be used to avoid wrong assignment of component names
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 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...
std::vector< int > get_context_creation_attrib_list(cgv::render::context_config &cc)
construct a 0 terminated list of context creation attribute definitions
GLuint get_gl_format(const texture &tex)
return the texture format used for a given texture. If called before texture has been created,...
RenderAPI
enumeration of rendering APIs which can be queried from the context
CullingMode
different culling modes
BlendFunction
different blend functions
AccessType
different access types
FrameBufferType
different frame buffer types which can be combined together with or
MaterialSide
different sides of a material
ProgramVariableKind
enumerates different kinds of shader program variables
ShaderType
different shader types
PrimitiveType
different primitive types
VertexBufferType
Provides vertex buffer types to allow implicit binding.
BufferTypeBits
Bits for the selection of different buffer types.
TextureType
different texture types
CompareFunction
different comparison functions used for depth testing or texture comparisons
TypeId
ids for the different types and type constructs
Represents a blend state used to configure fragment blending.
Represents a buffer mask used to mask depth and color buffer outputs.
Represents a depth test state used to configure depth testing.
configuration object used to define context parameters that need to be set already at creation time
traits structure that maps a fundamental type to the Type enum.
compact type description of data that can be sent to the context; convertible to int