4 #include <cgv/render/context.h>
5 #include <cgv/render/shader_program.h>
6 #include <cgv_gl/gl/gl.h>
17 extern CGV_API
void set_gl_format(texture& tex, GLuint gl_format,
const std::string& component_format_description);
36 GLuint texture_bind(
TextureType tt, GLuint tex_id)
const;
37 void texture_unbind(
TextureType tt, GLuint tmp_id)
const;
48 void ensure_configured()
const;
49 void destruct_render_objects();
50 void put_id(
void* handle,
void* ptr)
const;
51 void draw_elements_void(GLenum mode,
size_t count, GLenum type,
size_t type_size,
const void* indices)
const;
53 void draw_elements(GLenum mode,
size_t count,
const T* indices)
const {
55 error(
"called draw_elements with invalid index type");
65 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;
66 bool texture_generate_mipmaps(
texture_base& tb,
unsigned int dim)
const;
69 bool texture_enable(
texture_base& tb,
int tex_unit,
unsigned int nr_dims)
const;
70 bool texture_disable(
texture_base& tb,
int tex_unit,
unsigned int nr_dims)
const;
82 int frame_buffer_get_max_nr_color_attachments()
const;
83 int frame_buffer_get_max_nr_draw_buffers()
const;
114 bool vertex_buffer_create(
vertex_buffer_base& vbb,
const void* array_ptr,
size_t size_in_bytes)
const;
115 bool vertex_buffer_replace(
vertex_buffer_base& vbb,
size_t offset,
size_t size_in_bytes,
const void* array_ptr)
const;
117 bool vertex_buffer_copy_back(
vertex_buffer_base& vbb,
size_t offset,
size_t size_in_bytes,
void* array_ptr)
const;
129 void draw_textual_info();
134 void rotate_vector_to_target(
const dvec3& vector,
const dvec3& target);
142 float get_current_font_size()
const;
146 void perform_screen_shot();
150 void init_render_pass();
152 void finish_render_pass();
155 void set_color(
const rgba& clr);
164 shader_program& ref_default_shader_program(
bool texture_support =
false);
166 shader_program& ref_surface_shader_program(
bool texture_support =
false);
168 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;
170 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;
172 void on_lights_changed();
174 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);
176 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);
180 void announce_external_viewport_change(
ivec4& cgv_viewport_storage);
183 void recover_from_external_viewport_change(
const ivec4& cgv_viewport_storage);
185 void announce_external_frame_buffer_change(
void*& cgv_fbo_storage);
187 void recover_from_external_frame_buffer_change(
void* cgv_fbo_storage);
191 void push_pixel_coords();
194 void pop_pixel_coords();
196 virtual bool read_frame_buffer(
198 unsigned int x = 0,
unsigned int y = 0,
202 int w = -1,
int h = -1);
207 bool prepare_attributes(std::vector<vec3>& P, std::vector<vec3>& N, std::vector<vec2>& T,
unsigned nr_vertices,
209 const float* vertices,
const float* normals,
const float* tex_coords,
210 const int* vertex_indices,
const int* normal_indices,
const int* tex_coord_indices,
bool flip_normals)
const;
212 bool release_attributes(
const float* normals,
const float* tex_coords,
const int* normal_indices,
const int* tex_coord_indices)
const;
214 void draw_edges_of_faces(
215 const float* vertices,
const float* normals,
const float* tex_coords,
216 const int* vertex_indices,
const int* normal_indices,
const int* tex_coord_indices,
217 int nr_faces,
int face_degree,
bool flip_normals =
false)
const;
219 void draw_edges_of_strip_or_fan(
220 const float* vertices,
const float* normals,
const float* tex_coords,
221 const int* vertex_indices,
const int* normal_indices,
const int* tex_coord_indices,
222 int nr_faces,
int face_degree,
bool is_fan,
bool flip_normals =
false)
const;
225 const float* vertices,
const float* normals,
const float* tex_coords,
226 const int* vertex_indices,
const int* normal_indices,
const int* tex_coord_indices,
227 int nr_faces,
int face_degree,
bool flip_normals)
const;
229 void draw_strip_or_fan(
230 const float* vertices,
const float* normals,
const float* tex_coords,
231 const int* vertex_indices,
const int* normal_indices,
const int* tex_coord_indices,
232 int nr_faces,
int face_degree,
bool is_fan,
bool flip_normals)
const;
237 dmat4 get_modelview_matrix()
const;
240 void set_modelview_matrix(
const dmat4& V);
242 dmat4 get_projection_matrix()
const;
244 void set_projection_matrix(
const dmat4& P);
247 void pop_window_transformation_array();
249 unsigned get_max_window_transformation_array_size()
const;
251 void update_window_transformation_array();
254 void set_viewport(
const ivec4& viewport,
int array_index = -1);
256 void set_depth_range(
const dvec2& depth_range =
dvec2(0, 1),
int array_index = -1);
261 double get_window_z(
int x_window,
int y_window)
const;
269 #include <cgv/config/lib_end.h>
GLuint get_gl_format(const texture &tex)
return the texture format used for a given texture. If called before texture has been created,...
Definition: gl_context.cxx:98
base interface for all render components
Definition: context.h:246
float info_font_size
font size to draw textual info
Definition: gl_context.h:127
matrix of fixed size dimensions
Definition: fmat.h:23
@ CF_RGB
color format with two components R and G
Definition: component_format.h:29
compact type description of data that can be sent to the context; convertible to int
Definition: context.h:36
base class for attribute_array_bindings
Definition: context.h:338
ContextIntegerConstant
integer constants that can be queried from context
Definition: context.h:414
MaterialSide
different sides of a material
Definition: context.h:113
ShaderType
different shader types
Definition: context.h:391
VertexBufferType
different vertex buffer types
Definition: context.h:349
TypeId
ids for the different types and type constructs
Definition: type_id.h:12
Definition: gl_context.h:33
Definition: data_view.h:211
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...
Definition: gl_context.cxx:91
base interface for a texture
Definition: context.h:269
base interface for a vertex buffer
Definition: context.h:365
class that extends obj_material with the management of textures
Definition: textured_material.h:13
Definition: shader_program.h:25
FrameBufferType
different frame buffer types which can be combined together with or
Definition: context.h:394
Definition: data_view.h:155
base interface for framebuffer
Definition: context.h:378
cgv::media::font::font_face_ptr info_font_face
font used to draw textual info
Definition: gl_context.h:125
@ TI_UINT8
signed integer stored in 64 bits
Definition: type_id.h:23
base interface for shader programs
Definition: context.h:290
ComponentFormat
Definition: component_format.h:18
TextureType
different texture types
Definition: context.h:155
RenderAPI
enumeration of rendering APIs which can be queried from the context
Definition: context.h:59
the cgv namespace
Definition: vr_calib.cxx:9
Definition: context.h:525
PrimitiveType
different primitive types
Definition: context.h:177
CGV_API void set_material(const cgv::media::illum::phong_material &mat, MaterialSide ms, float alpha)
set material in opengl state to given material
unsigned long long uint64_type
this type provides an 64 bit unsigned integer type
Definition: standard_types.h:22