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;
78 bool texture_generate_mipmaps(
texture_base& tb,
unsigned int dim)
const override;
80 bool texture_set_state(
const texture_base& tb)
const override;
81 bool texture_enable(
texture_base& tb,
int tex_unit,
unsigned int nr_dims)
const override;
82 bool texture_disable(
texture_base& tb,
int tex_unit,
unsigned int nr_dims)
const override;
83 bool texture_bind_as_image(
texture_base& tb,
int tex_unit,
int level,
bool bind_array,
int layer,
AccessType access)
const override;
96 int frame_buffer_get_max_nr_color_attachments()
const override;
97 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;
113 int get_uniform_location(
const shader_program_base& spb,
const std::string& name)
const override;
116 int get_attribute_location(
const shader_program_base& spb,
const std::string& name)
const override;
130 bool vertex_buffer_create(
vertex_buffer_base& vbb,
const void* array_ptr,
size_t size_in_bytes)
const override;
131 bool vertex_buffer_resize(
vertex_buffer_base& vbb,
const void* array_ptr,
size_t size_in_bytes)
const override;
132 bool vertex_buffer_clear(
vertex_buffer_base& vbb,
size_t offset,
size_t size_in_bytes)
const override;
133 bool vertex_buffer_replace(
vertex_buffer_base& vbb,
size_t offset,
size_t size_in_bytes,
const void* array_ptr)
const override;
135 bool vertex_buffer_copy_back(
const vertex_buffer_base& vbb,
size_t offset,
size_t size_in_bytes,
void* array_ptr)
const override;
147 void draw_textual_info()
override;
152 void rotate_vector_to_target(
const dvec3& vector,
const dvec3& target);
161 void set_bg_color(
vec4 rgba)
override;
163 void set_bg_depth(
float d)
override;
165 void set_bg_stencil(
int s)
override;
167 void set_bg_accum_color(
vec4 rgba)
override;
169 void clear_background(
bool color_flag,
bool depth_flag,
bool stencil_flag =
false,
bool accum_flag =
false)
override;
172 float get_info_font_size()
const;
176 float get_current_font_size()
const override;
180 void perform_screen_shot()
override;
182 RenderAPI get_render_api()
const override;
184 void init_render_pass()
override;
186 void finish_render_pass()
override;
190 void set_color(
const rgba& clr)
override;
198 shader_program& ref_default_shader_program(
bool texture_support =
false)
override;
200 shader_program& ref_surface_shader_program(
bool texture_support =
false)
override;
202 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;
204 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;
206 void on_lights_changed()
override;
208 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;
210 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;
215 void announce_external_viewport_change(
ivec4& cgv_viewport_storage)
override;
217 void recover_from_external_viewport_change(
const ivec4& cgv_viewport_storage)
override;
219 void announce_external_frame_buffer_change(
void*& cgv_fbo_storage)
override;
221 void recover_from_external_frame_buffer_change(
void* cgv_fbo_storage)
override;
226 void push_pixel_coords()
override;
228 void pop_pixel_coords()
override;
230 virtual bool read_frame_buffer(
232 unsigned int x = 0,
unsigned int y = 0,
236 int w = -1,
int h = -1)
override;
242 bool prepare_attributes(std::vector<vec3>& P, std::vector<vec3>& N, std::vector<vec2>& T,
unsigned nr_vertices,
243 const float* vertices,
const float* normals,
const float* tex_coords,
244 const int* vertex_indices,
const int* normal_indices,
const int* tex_coord_indices,
bool flip_normals)
const;
246 bool release_attributes(
const float* normals,
const float* tex_coords,
const int* normal_indices,
const int* tex_coord_indices)
const;
248 void draw_edges_of_faces(
249 const float* vertices,
const float* normals,
const float* tex_coords,
250 const int* vertex_indices,
const int* normal_indices,
const int* tex_coord_indices,
251 int nr_faces,
int face_degree,
bool flip_normals =
false)
const override;
253 void draw_edges_of_strip_or_fan(
254 const float* vertices,
const float* normals,
const float* tex_coords,
255 const int* vertex_indices,
const int* normal_indices,
const int* tex_coord_indices,
256 int nr_faces,
int face_degree,
bool is_fan,
bool flip_normals =
false)
const override;
259 const float* vertices,
const float* normals,
const float* tex_coords,
260 const int* vertex_indices,
const int* normal_indices,
const int* tex_coord_indices,
261 int nr_faces,
int face_degree,
bool flip_normals)
const override;
263 void draw_strip_or_fan(
264 const float* vertices,
const float* normals,
const float* tex_coords,
265 const int* vertex_indices,
const int* normal_indices,
const int* tex_coord_indices,
266 int nr_faces,
int face_degree,
bool is_fan,
bool flip_normals)
const override;
277 void enable_depth_test()
override;
279 void disable_depth_test()
override;
282 void set_cull_state(
CullingMode culling_mode)
override;
285 void set_blend_state(
BlendState state)
override;
291 void enable_blending()
override;
293 void disable_blending()
override;
296 void set_buffer_mask(
BufferMask mask)
override;
298 void set_depth_mask(
bool flag)
override;
300 void set_color_mask(
bvec4 flags)
override;
307 dmat4 get_modelview_matrix()
const override;
309 void set_modelview_matrix(
const dmat4& V)
override;
311 dmat4 get_projection_matrix()
const override;
313 void set_projection_matrix(
const dmat4& P)
override;
316 void pop_window_transformation_array()
override;
318 unsigned get_max_window_transformation_array_size()
const override;
322 void update_window_transformation_array();
325 void set_viewport(
const ivec4& viewport,
int array_index = -1)
override;
327 void set_depth_range(
const dvec2& depth_range =
dvec2(0, 1),
int array_index = -1)
override;
332 double get_window_z(
int x_window,
int y_window)
const override;
340#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
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