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;
113 bool shader_program_get_active_uniforms(
shader_program_base& spb, std::vector<std::string>& names)
const override;
114 int get_uniform_location(
const shader_program_base& spb,
const std::string& name)
const override;
117 int get_attribute_location(
const shader_program_base& spb,
const std::string& name)
const override;
131 bool vertex_buffer_create(
vertex_buffer_base& vbb,
const void* array_ptr,
size_t size_in_bytes)
const override;
132 bool vertex_buffer_resize(
vertex_buffer_base& vbb,
const void* array_ptr,
size_t size_in_bytes)
const override;
133 bool vertex_buffer_clear(
vertex_buffer_base& vbb,
size_t offset,
size_t size_in_bytes)
const override;
134 bool vertex_buffer_replace(
vertex_buffer_base& vbb,
size_t offset,
size_t size_in_bytes,
const void* array_ptr)
const override;
136 bool vertex_buffer_copy_back(
const vertex_buffer_base& vbb,
size_t offset,
size_t size_in_bytes,
void* array_ptr)
const override;
148 void draw_textual_info()
override;
153 void rotate_vector_to_target(
const dvec3& vector,
const dvec3& target);
162 void set_bg_color(
vec4 rgba)
override;
164 void set_bg_depth(
float d)
override;
166 void set_bg_stencil(
int s)
override;
168 void set_bg_accum_color(
vec4 rgba)
override;
170 void clear_background(
bool color_flag,
bool depth_flag,
bool stencil_flag =
false,
bool accum_flag =
false)
override;
173 float get_info_font_size()
const;
177 float get_current_font_size()
const override;
181 void perform_screen_shot()
override;
183 RenderAPI get_render_api()
const override;
185 void init_render_pass()
override;
187 void finish_render_pass()
override;
191 void set_color(
const rgba& clr)
override;
199 shader_program& ref_default_shader_program(
bool texture_support =
false)
override;
201 shader_program& ref_surface_shader_program(
bool texture_support =
false)
override;
203 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;
205 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;
207 void on_lights_changed()
override;
209 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;
211 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;
216 void announce_external_viewport_change(
ivec4& cgv_viewport_storage)
override;
218 void recover_from_external_viewport_change(
const ivec4& cgv_viewport_storage)
override;
220 void announce_external_frame_buffer_change(
void*& cgv_fbo_storage)
override;
222 void recover_from_external_frame_buffer_change(
void* cgv_fbo_storage)
override;
227 void push_pixel_coords()
override;
229 void pop_pixel_coords()
override;
231 virtual bool read_frame_buffer(
233 unsigned int x = 0,
unsigned int y = 0,
237 int w = -1,
int h = -1)
override;
243 bool prepare_attributes(std::vector<vec3>& P, std::vector<vec3>& N, std::vector<vec2>& T,
unsigned nr_vertices,
244 const float* vertices,
const float* normals,
const float* tex_coords,
245 const int* vertex_indices,
const int* normal_indices,
const int* tex_coord_indices,
bool flip_normals)
const;
247 bool release_attributes(
const float* normals,
const float* tex_coords,
const int* normal_indices,
const int* tex_coord_indices)
const;
249 void draw_edges_of_faces(
250 const float* vertices,
const float* normals,
const float* tex_coords,
251 const int* vertex_indices,
const int* normal_indices,
const int* tex_coord_indices,
252 int nr_faces,
int face_degree,
bool flip_normals =
false)
const override;
254 void draw_edges_of_strip_or_fan(
255 const float* vertices,
const float* normals,
const float* tex_coords,
256 const int* vertex_indices,
const int* normal_indices,
const int* tex_coord_indices,
257 int nr_faces,
int face_degree,
bool is_fan,
bool flip_normals =
false)
const override;
260 const float* vertices,
const float* normals,
const float* tex_coords,
261 const int* vertex_indices,
const int* normal_indices,
const int* tex_coord_indices,
262 int nr_faces,
int face_degree,
bool flip_normals)
const override;
264 void draw_strip_or_fan(
265 const float* vertices,
const float* normals,
const float* tex_coords,
266 const int* vertex_indices,
const int* normal_indices,
const int* tex_coord_indices,
267 int nr_faces,
int face_degree,
bool is_fan,
bool flip_normals)
const override;
278 void enable_depth_test()
override;
280 void disable_depth_test()
override;
283 void set_cull_state(
CullingMode culling_mode)
override;
286 void set_blend_state(
BlendState state)
override;
292 void enable_blending()
override;
294 void disable_blending()
override;
297 void set_buffer_mask(
BufferMask mask)
override;
299 void set_depth_mask(
bool flag)
override;
301 void set_color_mask(
bvec4 flags)
override;
308 dmat4 get_modelview_matrix()
const override;
310 void set_modelview_matrix(
const dmat4& V)
override;
312 dmat4 get_projection_matrix()
const override;
314 void set_projection_matrix(
const dmat4& P)
override;
317 void pop_window_transformation_array()
override;
319 unsigned get_max_window_transformation_array_size()
const override;
323 void update_window_transformation_array();
326 void set_viewport(
const ivec4& viewport,
int array_index = -1)
override;
328 void set_depth_range(
const dvec2& depth_range =
dvec2(0, 1),
int array_index = -1)
override;
333 double get_window_z(
int x_window,
int y_window)
const override;
341#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