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);
47 GLuint texture_bind(
TextureType tt, GLuint tex_id)
const;
48 void texture_unbind(
TextureType tt, GLuint tmp_id)
const;
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 int get_uniform_location(
const shader_program_base& spb,
const std::string& name)
const override;
115 int get_attribute_location(
const shader_program_base& spb,
const std::string& name)
const override;
129 bool vertex_buffer_create(
vertex_buffer_base& vbb,
const void* array_ptr,
size_t size_in_bytes)
const override;
130 bool vertex_buffer_resize(
vertex_buffer_base& vbb,
const void* array_ptr,
size_t size_in_bytes)
const override;
131 bool vertex_buffer_replace(
vertex_buffer_base& vbb,
size_t offset,
size_t size_in_bytes,
const void* array_ptr)
const override;
133 bool vertex_buffer_copy_back(
vertex_buffer_base& vbb,
size_t offset,
size_t size_in_bytes,
void* array_ptr)
const override;
145 void draw_textual_info()
override;
150 void rotate_vector_to_target(
const dvec3& vector,
const dvec3& target);
159 void set_bg_color(
vec4 rgba)
override;
161 void set_bg_depth(
float d)
override;
163 void set_bg_stencil(
int s)
override;
165 void set_bg_accum_color(
vec4 rgba)
override;
167 void clear_background(
bool color_flag,
bool depth_flag,
bool stencil_flag =
false,
bool accum_flag =
false)
override;
170 float get_info_font_size()
const;
174 float get_current_font_size()
const override;
178 void perform_screen_shot()
override;
180 RenderAPI get_render_api()
const override;
182 void init_render_pass()
override;
184 void finish_render_pass()
override;
188 void set_color(
const rgba& clr)
override;
196 shader_program& ref_default_shader_program(
bool texture_support =
false)
override;
198 shader_program& ref_surface_shader_program(
bool texture_support =
false)
override;
200 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;
202 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;
204 void on_lights_changed()
override;
206 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;
208 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;
213 void announce_external_viewport_change(
ivec4& cgv_viewport_storage)
override;
215 void recover_from_external_viewport_change(
const ivec4& cgv_viewport_storage)
override;
217 void announce_external_frame_buffer_change(
void*& cgv_fbo_storage)
override;
219 void recover_from_external_frame_buffer_change(
void* cgv_fbo_storage)
override;
224 void push_pixel_coords()
override;
226 void pop_pixel_coords()
override;
228 virtual bool read_frame_buffer(
230 unsigned int x = 0,
unsigned int y = 0,
234 int w = -1,
int h = -1)
override;
240 bool prepare_attributes(std::vector<vec3>& P, std::vector<vec3>& N, std::vector<vec2>& T,
unsigned nr_vertices,
241 const float* vertices,
const float* normals,
const float* tex_coords,
242 const int* vertex_indices,
const int* normal_indices,
const int* tex_coord_indices,
bool flip_normals)
const;
244 bool release_attributes(
const float* normals,
const float* tex_coords,
const int* normal_indices,
const int* tex_coord_indices)
const;
246 void draw_edges_of_faces(
247 const float* vertices,
const float* normals,
const float* tex_coords,
248 const int* vertex_indices,
const int* normal_indices,
const int* tex_coord_indices,
249 int nr_faces,
int face_degree,
bool flip_normals =
false)
const override;
251 void draw_edges_of_strip_or_fan(
252 const float* vertices,
const float* normals,
const float* tex_coords,
253 const int* vertex_indices,
const int* normal_indices,
const int* tex_coord_indices,
254 int nr_faces,
int face_degree,
bool is_fan,
bool flip_normals =
false)
const override;
257 const float* vertices,
const float* normals,
const float* tex_coords,
258 const int* vertex_indices,
const int* normal_indices,
const int* tex_coord_indices,
259 int nr_faces,
int face_degree,
bool flip_normals)
const override;
261 void draw_strip_or_fan(
262 const float* vertices,
const float* normals,
const float* tex_coords,
263 const int* vertex_indices,
const int* normal_indices,
const int* tex_coord_indices,
264 int nr_faces,
int face_degree,
bool is_fan,
bool flip_normals)
const override;
275 void enable_depth_test()
override;
277 void disable_depth_test()
override;
280 void set_cull_state(
CullingMode culling_mode)
override;
283 void set_blend_state(
BlendState state)
override;
289 void enable_blending()
override;
291 void disable_blending()
override;
294 void set_buffer_mask(
BufferMask mask)
override;
296 void set_depth_mask(
bool flag)
override;
298 void set_color_mask(
bvec4 flags)
override;
305 dmat4 get_modelview_matrix()
const override;
307 void set_modelview_matrix(
const dmat4& V)
override;
309 dmat4 get_projection_matrix()
const override;
311 void set_projection_matrix(
const dmat4& P)
override;
314 void pop_window_transformation_array()
override;
316 unsigned get_max_window_transformation_array_size()
const override;
320 void update_window_transformation_array();
323 void set_viewport(
const ivec4& viewport,
int array_index = -1)
override;
325 void set_depth_range(
const dvec2& depth_range =
dvec2(0, 1),
int array_index = -1)
override;
330 double get_window_z(
int x_window,
int y_window)
const override;
338#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
ContextIntegerConstant
integer constants that can be queried from context
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