2#include <cgv/base/group.h>
3#include <cgv/media/image/image_writer.h>
4#include <cgv/math/ftransform.h>
5#include <cgv/base/traverser.h>
6#include <cgv/render/drawable.h>
7#include <cgv/render/shader_program.h>
8#include <cgv/render/attribute_array_binding.h>
13#define SAFE_STACK_POP(STACK, WHERE) \
14if(STACK.size() == 1) error("context::" WHERE "() ... attempt to completely empty stack avoided."); \
21const int nr_backgrounds = 5;
22float background_colors[] = {
33 switch (
td.coordinate_type) {
40 switch (
td.element_type) {
41 case cgv::render::ElementType::ET_VALUE:
44 case cgv::render::ElementType::ET_VECTOR:
49 case cgv::render::ElementType::ET_MATRIX: type =
"mat";
break;
53 if (
td.nr_columns !=
td.nr_rows) {
65 if (
type_descr.element_type == cgv::render::ET_VECTOR)
67 if (
type_descr.element_type == cgv::render::ET_MATRIX)
79 os <<
V.type_descr <<
" " <<
V.name;
81 os <<
"[" <<
V.array_size <<
"]";
82 if (
V.program_location != -1)
83 os <<
" @" <<
V.program_location;
84 if (
V.current_value.empty())
89 V.compute_sizes(cnt, s, S);
92 for (
size_t j = 0;
j <
V.array_size; ++
j) {
97 for (
size_t k = 0; k < cnt; ++k) {
100 const void* value_ptr =
V.current_value.data() +
j * s;
101 switch (
V.type_descr.coordinate_type) {
112 if (
V.array_size > 1)
159 srh.reflect_member(
"debug",
debug) &&
193 return "render_config";
220 gpu_vendor = GPU_VENDOR_UNKNOWN;
254 projection_matrix_stack.push(cgv::math::identity4<double>());
257 wt.viewport =
ivec4(0, 0, 640, 480);
279 do_screen_shot =
false;
310 rc->last_error = message;
312 std::cerr << message << std::endl;
324 return gpu_capabilities;
331 attribute_array_binding_destruct(*
dummy_aab);
337void context::init_render_pass()
342void context::draw_textual_info()
347void context::perform_screen_shot()
351void context::destruct_render_objects()
357void context::finish_render_pass()
375 error(
child->get_type_name()+
"::init(context&) failed");
508 error(
"context::enable_phong_shading() deprecated");
511void context::disable_phong_shading()
514 error(
"context::disable_phong_shading() deprecated");
519 error(
"context::enable_material(phong_material) deprecated");
524 error(
"context::disable_material(phong_material) deprecated");
526void context::enable_material(
const textured_material& mat,
MaterialSide ms,
float alpha)
528 error(
"context::enable_material(textured_material) deprecated");
585 dvec4 hL(
Le,
light.get_type() == cgv::media::illum::LT_DIRECTIONAL ? 0.0f : 1.0f);
588 if (
light.get_type() != cgv::media::illum::LT_DIRECTIONAL)
625 light_sources[handle] = std::pair<cgv::media::illum::light_source, light_source_status>(
641 if (iter->second.second.enabled) {
657 return iter->second.first;
664 return iter->second.second;
672 iter->second.first =
light;
676 if (iter->second.second.enabled)
687 prog.
set_uniform(*
this,
"inverse_modelview_matrix", cgv::math::inverse(
V));
700 NM = cgv::math::inverse(
NM);
706 prog.
set_uniform(*
this,
"inverse_projection_matrix", cgv::math::inverse(
P));
732 prog.
set_uniform(*
this,
prefix +
".spot_direction", iter->second.second.eye_spot_direction);
747 if (!prog.does_use_lights())
760 if (iter->second.second.enabled)
787 return iter->second.second.enabled;
796 if (iter->second.second.enabled)
798 iter->second.second.enabled =
true;
811 if (!iter->second.second.enabled)
813 iter->second.second.enabled =
false;
817 iter->second.second.light_source_index = -1;
842 "RP_OPAQUE_SURFACES",
843 "RP_TRANSPARENT_SURFACES",
914 if (
ri.pass_index != -1)
915 std::cout <<
":" <<
ri.pass_index;
916 std::cout <<
"> " << info << std::endl;
930 ri.user_data = user_data;
965 perform_screen_shot();
966 do_screen_shot =
false;
969 finish_render_pass();
977 unsigned int i,
j = 0;
978 for (
i = 0;
i<text.size(); ++
i) {
1024 float y = (
float)cursor_y;
1027 cursor_y =
int(y + 0.5f);
1040 font_face->enable(
this, font_size);
1073 unsigned char*
dst =
dv1.get_ptr<
unsigned char>();
1074 for (
size_t i=0;
i<n; ++
i, ++
dst, ++
src)
1086 unsigned char*
dst = dv.
get_ptr<
unsigned char>();
1088 for (
size_t i=0;
i<n; ++
i, ++
dst)
1102 "repeat",
"clamp",
"clamp_to_edge",
"clamp_to_border",
"mirror_clamp",
1103 "mirror_clamp_to_edge",
"mirror_clamp_to_border"
1113 "undefined",
"Texture1D",
"Texture2D",
"Texture3D",
"CubeTexture"
1122 "x+",
"x-",
"y+",
"y-",
"z+",
"z-"
1131 "undef",
"points",
"lines",
"lines_adjacency",
"line_strip",
"line_strip_adjacency",
"line_loop",
1132 "triangles",
"triangles_adjacency",
"triangle_strip",
"triangle_strip_adjacency",
"triangle_fan",
1133 "quads",
"quad_strip",
"polygon",
"patches"
1144 "nearest_mipmap_nearest",
1145 "linear_mipmap_nearest",
1146 "nearest_mipmap_linear",
1147 "linear_mipmap_linear",
1153void compute_face_normals(
const float* vertices,
float* normals,
const int* vertex_indices,
int* normal_indices,
int nr_faces,
int face_degree)
1155 for (
int i = 0;
i < nr_faces; ++
i) {
1156 vec3& normal =
reinterpret_cast<vec3&
>(normals[3 *
i]);
1158 vec3 reference_pnt = *
reinterpret_cast<const vec3*
>(vertices + 3 * vertex_indices[face_degree*
i + face_degree - 1]);
1161 for (
int j = 0;
j < face_degree; ++
j) {
1167 for (
int j = 0;
j<face_degree; ++
j)
1168 normal_indices[face_degree*
i+
j] =
i;
1175 static float V[8*3] = {
1185 static float N[6*3] = {
1190 static const float ot =
float(1.0 / 3);
1191 static const float tt =
float(2.0 / 3);
1192 static float T[14*2] = {
1194 0.25f,0 , 0.25f,ot ,
1195 0.25f,tt , 0.25f,1 ,
1198 0.75f,ot , 0.75f,tt ,
1201 static int F[6*4] = {
1209 static int FN[6*4] = {
1214 static int FT[6*4] = {
1215 3,4,1,0 ,7,10,11,8 ,
1217 12,13,11,10 ,3,7,8,4
1228 static float N[6 * 3] = {
1233 static int F[6 * 4] = {
1241 static int FN[6 * 4] = {
1242 0, 0, 0, 0, 1, 1, 1, 1,
1243 2, 2, 2, 2, 3, 3, 3, 3,
1244 4, 4, 4, 4, 5, 5, 5, 5
1248 for (
unsigned i = 0;
i < 8; ++
i) {
1262 static const float V[6*3] = {
1270 static float a = 1.0f/
sqrt(5.0f);
1271 static float b = 2*a;
1272 static const float N[5*3] = {
1279 static const int FT[2*3] = { 0,1,2, 5,4,3 };
1280 static const int FQ[8] = { 4,1, 3,0, 5,2, 4,1};
1281 static const int FTN[2*3] = { 0,0,0, 1,1,1 };
1282 static const int FQN[8] = { 2,2, 2,2, 3,3, 4,4, };
1297 std::vector<float>
V;
V.reserve(3*(resolution+1));
1298 std::vector<float> N; N.reserve(3*(resolution+1));
1299 std::vector<float>
T;
T.reserve(2*(resolution+1));
1301 std::vector<int> F; F.resize(resolution+1);
1303 for (
i = 0;
i <= resolution; ++
i)
1306 float step =
float(2*M_PI/resolution);
1308 for (
i = 0;
i <= resolution; ++
i, phi += step) {
1309 float cp =
cos(phi);
1310 float sp =
sin(phi);
1314 T.push_back((
float)
i/resolution);
1329 std::vector<float>
V;
V.reserve(6*(resolution+1));
1330 std::vector<float> N; N.reserve(6*(resolution+1));
1331 std::vector<float>
T;
T.reserve(4*(resolution+1));
1333 std::vector<int> F; F.resize(2*resolution+2);
1335 for (
i = 0;
i <= 2*resolution+1; ++
i)
1338 static float a = 1.0f/
sqrt(5.0f);
1339 static float b = 2*a;
1340 float step =
float(2*M_PI/resolution);
1344 for (
int i = 0;
i <= resolution; ++
i, u +=
duv, phi += step) {
1345 float cp =
cos(phi);
1346 float sp =
sin(phi);
1373 std::vector<float>
V;
V.reserve(6*(resolution+1));
1374 std::vector<float> N; N.reserve(6*(resolution+1));
1375 std::vector<float>
T;
T.reserve(4*(resolution+1));
1377 std::vector<int> F; F.resize(2*(resolution+1));
1379 for (
i = 0;
i <= 2*resolution+1; ++
i)
1382 float step =
float(2*M_PI/resolution);
1386 for (
int i = 0;
i <= resolution; ++
i, u +=
duv, phi += step) {
1387 float cp =
cos(phi);
1388 float sp =
sin(phi);
1415 std::vector<float>
V;
V.resize(6*(resolution+1));
1416 std::vector<float> N; N.resize(6*(resolution+1));
1417 std::vector<float>
T;
T.resize(4*(resolution+1));
1418 std::vector<int> F; F.resize(2*(resolution+1));
1420 for (
int i = 0;
i <= resolution; ++
i) {
1424 float step =
float(2*M_PI/resolution);
1429 for (
i = 0;
i < resolution; ++
i, u +=
duv) {
1437 for (
int j = 0;
j <= resolution; ++
j,
theta += step, v +=
duv) {
1465 std::vector<float>
V;
V.resize(6*(resolution+1));
1466 std::vector<float> N; N.resize(6*(resolution+1));
1467 std::vector<float>
T;
T.resize(4*(resolution+1));
1468 std::vector<int> F; F.resize(2*(resolution+1));
1470 for (
int i = 0;
i <= resolution; ++
i) {
1474 float step =
float(M_PI/resolution);
1479 for (
i = 0;
i < resolution; ++
i, u +=
duv) {
1487 for (
int j = 0;
j <= resolution; ++
j,
theta += step, v +=
duv) {
1516 static const float a =
float(1.0/(2*
sqrt(3.0)));
1517 static const float b =
float(1.0/(3*
sqrt(3.0/2)));
1518 static const float V[4*3] = {
1524 static const int F[4*3] = {
1525 0,2,1,3,2,0,3,0,1,3,1,2
1528 static float N[4*3];
1531 compute_face_normals(
V, N, F,
FN, 4, 3);
1544 static float N[1*3] = {
1547 static float V[4*3] = {
1551 static float T[4*2] = {
1555 static int FN[1*4] = {
1558 static int F[1*4] = {
1571 static float N[8*3] = {
1572 -1,-1,+1, +1,-1,+1, -1,+1,+1, +1,+1,+1,
1573 -1,-1,-1, +1,-1,-1, -1,+1,-1, +1,+1,-1
1575 static float V[6*3] = {
1580 static int FN[8*3] = {
1590 static int F[8*3] = {
1609 static const float h = 0.4472135956f;
1610 static const float r = 0.8944271912f;
1611 static const float s =
float(M_PI/2.5);
1612 static const float o =
float(M_PI/5);
1613 static const float V[13*3] = {
1628 static int F[20*3] = {
1629 0,1,2, 0,2,3, 0,3,4, 0,4,5, 0,5,1,
1630 6,2,1, 2,6,7, 7,3,2, 3,7,8, 8,4,3, 4,8,9, 9,5,4, 5,9,10, 10,1,5, 6,1,10,
1631 11,6,10, 11,10,9, 11,9,8, 11,8,7, 11,7,6
1633 static int DF[12*5] = {
1647 static float N[20*3];
1648 static int FN[20*3];
1649 static int DFN[12*5] = {
1666 compute_face_normals(
V, N, F,
FN, 20, 3);
1719 if (prog.does_use_gamma())
1735 attribute_array_binding_create(*
dummy_aab);
1737 attribute_array_binding_enable(*
dummy_aab);
1745 error(
"call to end_attribute_less_rendering() without call to begin_attribute_less_rendering()");
1747 error(
"call to end_attribute_less_rendering() with empty attribute array binding stack");
1749 error(
"call to end_attribute_less_rendering() after another attribute array was bound");
1751 attribute_array_binding_disable(*
dummy_aab);
1767 if (!prog.does_context_set_color())
1769 int clr_loc = prog.get_color_index();
1788 if (!prog.does_use_material())
1807 if (!prog.does_use_material())
1940 mask.red_flag = flags[0];
1941 mask.green_flag = flags[1];
1942 mask.blue_flag = flags[2];
1943 mask.alpha_flag = flags[3];
1971 SAFE_STACK_POP(projection_matrix_stack,
"pop_projection_matrix");
1992 if (!prog.does_use_view())
2000 projection_matrix_stack.top() =
P;
2009 if (!prog.does_use_view())
2024bool context::ensure_window_transformation_index(
int&
array_index)
2034 std::string message(
"context::ensure_window_transformation_index() ... attempt to resize window transformation array larger than maximum allowed size of ");
2047 if (!ensure_window_transformation_index(
array_index))
2054 if (!ensure_window_transformation_index(
array_index))
2068 std::string message(
"context::get_window_matrix() ... attempt to query window matrix with array index ");
2070 message +=
" out of range [0,";
2074 return cgv::math::identity4<double>();
2077 dmat4 M = cgv::math::identity4<double>();
2078 M(0, 0) = 0.5*
wt.viewport[2];
2079 M(0, 3) =
M(0, 0) +
wt.viewport[0];
2080 M(1, 1) = 0.5*
wt.viewport[3];
2081 M(1, 3) =
M(1, 1) +
wt.viewport[1];
2082 M(2, 2) = 0.5*(
wt.depth_range[1] -
wt.depth_range[0]);
2083 M(2, 3) =
M(2, 2) +
wt.depth_range[0];
2117 for (
unsigned int c = 0; c < p.
size(); ++c)
2124 error(
"context::put_cursor_coords() deprecated");
2134 static_cast<int>(
p4.x() /
p4.w()),
2135 static_cast<int>(
p4.y() /
p4.w())
2142 int x_offset,
int y_offset)
2150 case 0 : x -= (
int)(floor(w)*0.5f);
break;
2151 case 2 : x -= (
int)floor(w);
break;
2155 case 0 : y -= (
int)(floor(h)*0.3f);
break;
2156 case 4 : y -= (
int)(floor(h)*0.6f);
break;
2175 case 0:
cursor.x() -=
static_cast<int>(std::floor(w) * 0.5f);
break;
2176 case 2:
cursor.x() -=
static_cast<int>(std::floor(w));
break;
2180 case 0:
cursor.y() -=
static_cast<int>(std::floor(h) * 0.3f);
break;
2181 case 4:
cursor.y() -=
static_cast<int>(std::floor(h) * 0.6f);
break;
2204 std::cout <<
"tesselate_arrow not implemented in cgv::render::context" << std::endl;
2209 std::cout <<
"tesselate_arrow not implemented in cgv::render::context" << std::endl;
2214 std::cout <<
"draw_light_source not implemented in cgv::render::context" << std::endl;
2220 internal_format = 0;
2235 std::cerr <<
"no context set when render_component::put_id_void was called" << std::endl;
2241render_buffer_base::render_buffer_base()
2248 mag_filter = TF_LINEAR;
2249 min_filter = TF_LINEAR_MIPMAP_LINEAR;
2250 wrap_s = TW_CLAMP_TO_EDGE;
2251 wrap_t = TW_CLAMP_TO_EDGE;
2252 wrap_r = TW_CLAMP_TO_EDGE;
2255 border_color[0] = 1;
2256 border_color[1] = 1;
2257 border_color[2] = 1;
2258 border_color[3] = 1;
2260 compare_function = CF_LEQUAL;
2261 use_compare_function =
false;
2262 have_mipmaps =
false;
2265void shader_program_base::allow_context_to_set_color(
bool allow)
2267 context_sets_color =
allow;
2273 geometry_shader_input_type = PT_POINTS;
2274 geometry_shader_output_type = PT_POINTS;
2275 geometry_shader_output_count = 1;
2277 auto_detect_uniforms =
true;
2278 auto_detect_vertex_attributes =
true;
2281 uses_material =
false;
2282 uses_lights =
false;
2285 position_index = -1;
2288 context_sets_color =
true;
2289 texcoord_index = -1;
2293void shader_program_base::specify_standard_uniforms(
bool view,
bool material,
bool lights,
bool gamma)
2295 auto_detect_uniforms =
false;
2297 uses_material = material;
2302void shader_program_base::specify_standard_vertex_attribute_names(context& ctx,
bool color,
bool normal,
bool texcoord)
2304 auto_detect_vertex_attributes =
false;
2305 position_index = ctx.get_attribute_location(*
this,
"position");
2306 color_index =
color ? ctx.get_attribute_location(*
this,
"color") : -1;
2307 normal_index = normal ? ctx.get_attribute_location(*
this,
"normal") : -1;
2308 texcoord_index = texcoord ? ctx.get_attribute_location(*
this,
"texcoord") : -1;
2311void shader_program_base::specify_vertex_attribute_names(context& ctx,
const std::string& position,
const std::string&
color,
const std::string& normal,
const std::string& texcoord)
2313 auto_detect_vertex_attributes =
false;
2314 position_index = position.empty() ? -1 : ctx.get_attribute_location(*
this, position);
2315 color_index =
color.empty() ? -1 : ctx.get_attribute_location(*
this,
color);
2316 normal_index = normal.empty() ? -1 : ctx.get_attribute_location(*
this, normal);
2317 texcoord_index = texcoord.empty() ? -1 : ctx.get_attribute_location(*
this, texcoord);
2319bool context::shader_program_link(shader_program_base&
spb)
const
2321 if (
spb.handle == 0)
2323 if (
spb.auto_detect_vertex_attributes) {
2324 spb.position_index = get_attribute_location(
spb,
"position");
2325 spb.color_index = get_attribute_location(
spb,
"color");
2326 spb.normal_index = get_attribute_location(
spb,
"normal");
2327 spb.texcoord_index = get_attribute_location(
spb,
"texcoord");
2328 spb.auto_detect_vertex_attributes =
false;
2330 if (
spb.auto_detect_uniforms) {
2331 spb.uses_lights = get_uniform_location(
spb,
"light_sources[0].light_source_type") != -1;
2332 spb.uses_material = get_uniform_location(
spb,
"material.brdf_type") != -1;
2334 get_uniform_location(
spb,
"modelview_matrix") != -1 ||
2335 get_uniform_location(
spb,
"projection_matrix") != -1 ||
2336 get_uniform_location(
spb,
"inverse_projection_matrix") != -1 ||
2337 get_uniform_location(
spb,
"normal_matrix") != -1 ||
2338 get_uniform_location(
spb,
"inverse_modelview_matrix") != -1 ||
2339 get_uniform_location(
spb,
"inverse_normal_matrix") != -1;
2340 spb.uses_gamma = get_uniform_location(
spb,
"gamma3") != -1 || get_uniform_location(
spb,
"gamma") != -1;
2341 spb.auto_detect_uniforms =
false;
2346bool context::shader_program_enable(shader_program_base&
spb)
2348 if (
spb.is_enabled) {
2350 error(
"context::shader_program_enable() called with program that is currently active", &
spb);
2353 error(
"context::shader_program_enable() called with program that is recursively reactivated", &
spb);
2357 spb.is_enabled =
true;
2361bool context::shader_program_disable(shader_program_base&
spb)
2364 error(
"context::shader_program_disable() called with empty stack", &
spb);
2367 if (!
spb.is_enabled) {
2368 error(
"context::shader_program_disable() called with disabled program", &
spb);
2372 error(
"context::shader_program_disable() called with program that was not on top of shader program stack", &
spb);
2376 spb.is_enabled =
false;
2380bool context::shader_program_destruct(shader_program_base&
spb)
const
2382 if (
spb.is_enabled) {
2383 error(
"context::shader_program_destruct() on shader program that was still enabled", &
spb);
2407void context::shader_program_set_uniform_locations(shader_program_base&
spb)
const
2409 spb.uniform_locations.clear();
2428 if (aab.is_enabled) {
2429 error(
"context::attribute_array_binding_destruct() on array binding that was still enabled", &aab);
2454bool context::attribute_array_binding_enable(attribute_array_binding_base& aab)
2457 error(
"context::attribute_array_binding_enable() called in not created attribute array binding.", &aab);
2460 if (aab.is_enabled) {
2462 error(
"context::attribute_array_binding_enable() called with array binding that is currently active", &aab);
2465 error(
"context::attribute_array_binding_enable() called with array binding that is recursively reactivated", &aab);
2469 aab.is_enabled =
true;
2473bool context::attribute_array_binding_disable(attribute_array_binding_base& aab)
2476 error(
"context::attribute_array_binding_disable() called with empty stack", &aab);
2479 if (!aab.is_enabled) {
2480 error(
"context::attribute_array_binding_disable() called with disabled array binding", &aab);
2484 error(
"context::attribute_array_binding_disable() called with array binding that was not on top of array binding stack", &aab);
2488 aab.is_enabled =
false;
2498 depth_attached =
false;
2499 std::fill(attached, attached+16,
false);
2502void context::get_buffer_list(
frame_buffer_base&
fbb,
bool& depth_buffer, std::vector<int>& buffers,
int offset)
2504 if (
fbb.enabled_color_attachments.size() == 0) {
2505 for (
int i = 0;
i < 16; ++
i)
2506 if (
fbb.attached[
i])
2507 buffers.push_back(
i + offset);
2510 for (
int i = 0;
i < (
int)
fbb.enabled_color_attachments.size(); ++
i)
2511 if (
fbb.attached[
fbb.enabled_color_attachments[
i]])
2512 buffers.push_back(
fbb.enabled_color_attachments[
i]+offset);
2517bool context::frame_buffer_create(frame_buffer_base&
fbb)
const
2519 if (
fbb.width == -1)
2521 if (
fbb.height == -1)
2526bool context::frame_buffer_attach(frame_buffer_base&
fbb,
const render_buffer_base&
rb,
bool is_depth,
int i)
const
2528 if (
fbb.handle == 0) {
2529 error(
"gl_context::frame_buffer_attach: attempt to attach to frame buffer that is not created", &
fbb);
2532 if (
rb.handle == 0) {
2533 error(
"gl_context::frame_buffer_attach: attempt to attach empty render buffer", &
fbb);
2537 fbb.depth_attached =
true;
2539 fbb.attached[
i] =
true;
2544bool context::frame_buffer_attach(frame_buffer_base&
fbb,
const texture_base& t,
bool is_depth,
int level,
int i,
int z_or_cube_side)
const
2546 if (
fbb.handle == 0) {
2547 error(
"context::frame_buffer_attach: attempt to attach to frame buffer that is not created", &
fbb);
2550 if (t.handle == 0) {
2551 error(
"context::frame_buffer_attach: attempt to attach texture that is not created", &
fbb);
2555 fbb.depth_attached =
true;
2557 fbb.attached[
i] =
true;
2562bool context::frame_buffer_enable(frame_buffer_base&
fbb)
2564 if (
fbb.handle == 0) {
2565 error(
"context::frame_buffer_enable: attempt to enable not created frame buffer", &
fbb);
2568 if (
fbb.is_enabled) {
2570 error(
"context::frame_buffer_enable() called with frame buffer that is currently active", &
fbb);
2573 error(
"context::frame_buffer_enable() called with frame buffer that is recursively reactivated", &
fbb);
2577 fbb.is_enabled =
true;
2581bool context::frame_buffer_disable(frame_buffer_base&
fbb)
2584 error(
"gl_context::frame_buffer_disable called with empty stack", &
fbb);
2588 error(
"gl_context::frame_buffer_disable called with different frame buffer enabled", &
fbb);
2592 fbb.is_enabled =
false;
2596bool context::frame_buffer_destruct(frame_buffer_base&
fbb)
const
2598 if (
fbb.handle == 0) {
2599 error(
"context::frame_buffer_destruct: attempt to destruct not created frame buffer", &
fbb);
2602 if (
fbb.is_enabled) {
2603 error(
"context::frame_buffer_destruct() on frame buffer that was still enabled", &
fbb);
2609std::vector<context_creation_function_type>& ref_context_creation_functions()
2611 static std::vector<context_creation_function_type>
ccfs;
2618 ref_context_creation_functions().push_back(fp);
2621context_factory_registration::context_factory_registration(context_creation_function_type fp)
2630 unsigned int w,
unsigned int h,
2631 const std::string& title,
bool show)
2633 std::vector<context_creation_function_type>&
ccfs = ref_context_creation_functions();
2634 for (
unsigned i=0;
i<
ccfs.size(); ++
i) {
2641 std::cerr <<
"could not create context for given parameters" << std::endl;
2649#include <cgv/base/register.h>
2661#undef SAFE_STACK_POP
The group class is a node with children.
complete implementation of method actions that only call one method when entering a node
class used to traverse a tree structure
bool traverse(base_ptr start, traverse_callback_handler *tch=0)
traverse a tree starting at given node according to set strategy, order and dest and previously comin...
const data_format * get_format() const
return the component format
cgv::type::func::transfer_const< P, S * >::type get_ptr() const
return a data pointer to type S
the data view gives access to a data array of one, two, three or four dimensions.
reference counted pointer, which can work together with types that are derived from ref_counted,...
bool empty() const
check if pointer is not yet set
matrix of fixed size dimensions
T normalize()
normalize the vector using the L2-Norm and return the length
T & w()
return fourth component
unsigned size() const
number of elements
the self reflection handler is passed to the virtual self_reflect() method of cgv::base::base.
base class for attribute_array_bindings
attribute_array_binding_base()
nothing to be done heremembers
the attribute_array_binding allows to define vertex attributes (i.e.
base class for all drawables, which is independent of the used rendering API.
void push_window_transformation_array()
push a copy of the current viewport and depth range arrays defining the window transformations
void tesselate_unit_prism(bool flip_normals=false, bool edges=false)
tesselate a prism
void * add_light_source(const cgv::media::illum::light_source &light, bool enabled=true, bool place_now=false)
add a new light source, enable it if enable is true and place it relative to current model view trans...
virtual void set_blend_func(BlendFunction src_factor, BlendFunction dst_factor)
set the blend function
void enable_shader_file_cache()
enable the usage of the shader file caches
virtual std::ostream & output_stream()
returns an output stream whose output is printed at the current cursor location, which is managed by ...
virtual bool read_frame_buffer(data::data_view &dv, unsigned int x=0, unsigned int y=0, FrameBufferType buffer_type=FB_BACK, cgv::type::info::TypeId type=cgv::type::info::TI_UINT8, data::ComponentFormat cf=data::CF_RGB, int w=-1, int h=-1)=0
read the current frame buffer or a rectangular region of it into the given data view.
void set_blend_func_back_to_front()
set the default blend function for back to front blending (source = BF_SRC_ALPHA, destination = BF_ON...
virtual void mul_modelview_matrix(const dmat4 &MV)
multiply given matrix from right to current modelview matrix
void pop_bg_color()
pop the top of the current background color from the stack
virtual void set_depth_range(const dvec2 &depth_range=dvec2(0, 1), int array_index=-1)
set the current depth range or one of the depth ranges in the window transformation array
vec3 gamma3
per color channel gamma value passed to shader programs that have gamma uniform
virtual bool in_render_process() const =0
return whether the context is currently in process of rendering
virtual void process_text(const std::string &text)
callback method for processing of text from the output stream
virtual void set_color(const rgba &clr)
set the current color
virtual void draw_light_source(const cgv::media::illum::light_source &l, float intensity_scale, float light_scale)
draw a light source with an emissive material
virtual bool is_created() const =0
return whether the context is created
virtual void set_gamma3(const vec3 &_gamma3)
set the current per channel gamma values to single value
virtual void enable_sRGB_framebuffer(bool do_enable=true)
enable or disable sRGB framebuffer
virtual void draw_edges_of_faces(const float *vertices, const float *normals, const float *tex_coords, const int *vertex_indices, const int *normal_indices, const int *tex_coord_indices, int nr_faces, int face_degree, bool flip_normals=false) const =0
pass geometry of given faces to current shader program and generate draw calls to render lines for th...
RenderPassFlags default_render_flags
default render flags with which the main render pass is initialized
void pop_buffer_mask()
pop the top of the current buffer mask from the stack
shader_program_base * get_current_program() const
check for current program, prepare it for rendering and return pointer to it
virtual void error(const std::string &message, const render_component *rc=0) const
error handling
std::stack< render_info > render_pass_stack
store the current render pass
virtual void draw_edges_of_strip_or_fan(const float *vertices, const float *normals, const float *tex_coords, const int *vertex_indices, const int *normal_indices, const int *tex_coord_indices, int nr_faces, int face_degree, bool is_fan, bool flip_normals=false) const =0
pass geometry of given strip or fan to current shader program and generate draw calls to render lines...
virtual GPUVendorID get_gpu_vendor_id() const
device information
void set_current_view(shader_program &prog, bool modelview_deps=true, bool projection_deps=true) const
set the shader program view matrices to the currently enabled view matrices
float current_font_size
store current font size
bool enable_vsync
whether vsync should be enabled
const light_source_status & get_light_source_status(void *handle) const
read access to light source status
void place_light_source(void *handle)
place the given light source relative to current model viel transformation
void tesselate_unit_cube(bool flip_normals=false, bool edges=false)
tesselate a unit cube with extent from [-1,-1,-1] to [1,1,1] with face normals that can be flipped
virtual void get_cursor(int &x, int &y) const
return current cursor location in opengl coordinates with (0,0) in lower left corner
std::stack< BufferMask > buffer_mask_stack
stack of buffer masks
void set_bg_clr_idx(unsigned int idx)
set an indexed background color
virtual void set_buffer_mask(BufferMask mask)
set the buffer mask for depth and color buffers
virtual void draw_strip_or_fan(const float *vertices, const float *normals, const float *tex_coords, const int *vertex_indices, const int *normal_indices, const int *tex_coord_indices, int nr_faces, int face_degree, bool is_fan, bool flip_normals=false) const =0
pass geometry of given strip or fan to current shader program and generate draw calls to render trian...
bool auto_set_lights_in_current_shader_program
whether to automatically set lights in current shader program, defaults to true
float get_bg_accum_alpha() const
return the current alpha value for clearing the accumulation buffer
void set_bg_alpha(float a)
set a user defined background alpha value
virtual void set_blend_func_separate(BlendFunction src_color_factor, BlendFunction dst_color_factor, BlendFunction src_alpha_factor, BlendFunction dst_alpha_factor)
set the blend function separately for color and alpha
size_t light_source_handle
counter to construct light source handles
virtual void on_lights_changed()
helper function to send light update events
context()
init the cursor position to (0,0)
void push_depth_test_state()
push a copy of the current depth test state onto the stack saved attributes: depth test enablement,...
virtual 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)
tesselate an arrow from the origin in z-direction
void put_bg_color(float *rgba) const
copy the current background rgba color into the given float array
std::stack< shader_program_base * > shader_program_stack
stack of currently enabled shader programs
virtual ivec2 get_cursor_coords(const vec3 &p) const
transform point p in current world coordinates into opengl coordinates with (0,0) in lower left corne...
void push_blend_state()
push a copy of the current blend state onto the stack saved attributes: blend enablement,...
bool is_light_source_enabled(void *handle)
check whether light source is enabled
virtual void disable_depth_test()
disable the depth test
void pop_bg_depth()
pop the top of the current background depth value from the stack
int get_bg_stencil() const
return the current stencil value for clearing the background
virtual float get_current_font_size() const
return the size in pixels of the currently enabled font face
void pop_blend_state()
pop the top of the current culling state from the stack
virtual unsigned int get_width() const =0
return the width of the window
const cgv::media::illum::surface_material * get_current_material() const
return pointer to current material or nullptr if no current material is available
void set_bg_accum_alpha(float a)
set a user defined background alpha value for the accumulation buffer
float get_gamma() const
query current gamma computed as average over gamma3 per channel values
bool disable_light_source(void *handle)
disable a given light source and return whether there existed a light source with given handle
int current_background
current back ground color index
void set_blend_func_front_to_back()
set the default blend function for front to back blending (source = BF_ONE_MINUS_DST_ALPHA,...
virtual RenderPass get_render_pass() const
return the current render pass
void pop_depth_test_state()
pop the top of the current depth test state from the stack
void tesselate_unit_sphere(int resolution=25, bool flip_normals=false, bool edges=false)
tesselate a sphere of radius 1
virtual RenderPassFlags get_render_pass_flags() const
return the current render pass flags
void tesselate_unit_cylinder(int resolution=25, bool flip_normals=false, bool edges=false)
tesselate a cylinder of radius 1
float get_bg_alpha() const
return the current alpha value for clearing the background
bool write_frame_buffer_to_image(const std::string &file_name, data::ComponentFormat cf=data::CF_RGB, FrameBufferType buffer_type=FB_BACK, unsigned int x=0, unsigned int y=0, int w=-1, int h=-1, float depth_offset=0.9f, float depth_scale=10.0f)
write the content of the frame buffer to an image file.
unsigned int get_bg_clr_idx() const
return the current index of the background color
void tesselate_unit_tetrahedron(bool flip_normals=false, bool edges=false)
tesselate a tetrahedron
virtual bool recreate_context()
recreate context based on current context config settings
virtual void configure_new_child(cgv::base::base_ptr child)
helper method to integrate a new child
virtual void set_bg_color(vec4 rgba)
set a user defined background color
virtual void set_depth_test_state(DepthTestState state)
set the depth test state
void render_pass_debug_output(const render_info &ri, const std::string &info="")
write out render pass debug info, if activated
void tesselate_unit_octahedron(bool flip_normals=false, bool edges=false)
tesselate a octahedron
size_t get_nr_enabled_light_sources() const
return the number of light sources
const frame_buffer_base * get_current_frame_buffer() const
check for current framebuffer, and return pointer to it
virtual unsigned int get_height() const =0
return the height of the window
vec3 get_gamma3() const
query current per color channel gamma
void set_default_light_source(size_t i, const cgv::media::illum::light_source &ls)
set i-th default light source
virtual void disable_blending()
disable blending
BufferMask get_buffer_mask() const
return the current buffer mask
void push_cull_state()
push a copy of the current culling state onto the stack saved attributes: cull face enablement,...
virtual void enable_font_face(media::font::font_face_ptr font_face, float font_size)
enable the given font face with the given size in pixels
dmat4 get_modelview_projection_window_matrix(unsigned array_index=0) const
return a homogeneous 4x4 matrix to transfrom from model to window coordinates, i.e....
dmat4 get_window_matrix(unsigned array_index=0) const
return a homogeneous 4x4 matrix to transform clip to window coordinates
bool update_render_pass_flags(int exclude_flags, int include_flags=0)
update the current render pass flags, return whether this was possible (fails outside of render passe...
void pop_bg_stencil()
pop the top of the current background stencil value from the stack
virtual void draw_faces(const float *vertices, const float *normals, const float *tex_coords, const int *vertex_indices, const int *normal_indices, const int *tex_coord_indices, int nr_faces, int face_degree, bool flip_normals=false) const =0
pass geometry of given faces to current shader program and generate draw calls to render triangles
std::stack< dmat4 > modelview_matrix_stack
keep two matrix stacks for model view and projection matrices
vec3 get_light_eye_position(const cgv::media::illum::light_source &light, bool place_now) const
helper function to place lights
void push_bg_stencil()
push a copy of the current background stencil value onto the stack
virtual unsigned get_max_nr_enabled_light_sources() const
return maximum number of light sources, that can be enabled in parallel
virtual void pop_window_transformation_array()
restore previous viewport and depth range arrays defining the window transformations
const cgv::media::illum::light_source & get_default_light_source(size_t i) const
return i-th default light source
bool use_shader_file_cache
whether to use the caching facilities of shader_program and shader_code to store loaded shader file c...
virtual void set_color_mask(bvec4 flags)
set the color buffer mask
virtual void set_material(const cgv::media::illum::surface_material &mat)
set the current material
DepthTestState get_depth_test_state() const
return the current depth test state
int nr_identations
current number of indentations
void tesselate_unit_dodecahedron(bool flip_normals=false, bool edges=false)
tesselate a dodecahedron
bool auto_set_material_in_current_shader_program
whether to automatically set material in current shader program, defaults to true
void set_current_lights(shader_program &prog) const
set the shader program lights to the currently enabled lights
virtual void tesselate_box(const cgv::media::axis_aligned_box< double, 3 > &B, bool flip_normals, bool edges=false) const
tesselate an axis aligned box
bool enable_light_source(void *handle)
enable a given light source and return whether there existed a light source with given handle
virtual void * get_render_pass_user_data() const
return the current render pass user data
void tesselate_unit_disk(int resolution=25, bool flip_normals=false, bool edges=false)
tesselate a circular disk of radius 1
std::stack< float > bg_depth_stack
stack of background depth values
virtual void enable_depth_test()
enable the depth test
bool support_compatibility_mode
whether to support view and lighting management of compatibility mode, defaults to true
void set_current_gamma(shader_program &prog) const
set the shader program gamma values
void tesselate_unit_torus(float minor_radius=0.2f, int resolution=25, bool flip_normals=false, bool edges=false)
tesselate a torus with major radius of one and given minor radius
vec4 get_bg_color() const
return the current color value for clearing the background
void pop_projection_matrix()
see push_P for an explanation
attribute_array_binding_base * dummy_aab
allocate a dummy attribute array binding used to support attribute-less rendering
std::stack< attribute_array_binding_base * > attribute_array_binding_stack
stack of currently enabled attribute array binding
BlendState get_blend_state() const
return the current blend state
virtual void set_cull_state(CullingMode culling_mode)
set the culling state
void tesselate_unit_icosahedron(bool flip_normals=false, bool edges=false)
tesselate an icosahedron
virtual void set_depth_func(CompareFunction func)
set the depth test function
void set_light_source(void *handle, const cgv::media::illum::light_source &light, bool place_now=true)
set light source newly
std::stack< DepthTestState > depth_test_state_stack
stack of depth test states
std::stack< CullingMode > cull_state_stack
stack of culling mode states
void push_bg_depth()
push a copy of the current background depth value onto the stack
bool get_depth_mask() const
get the depth buffer mask
void disable_shader_file_cache()
disable the usage of the shader file caches
bool phong_shading
whether to use phong shading
virtual void push_pixel_coords()=0
use this to push new modelview and new projection matrices onto the transformation stacks such that x...
void end_attribute_less_rendering()
unbind dummy attribute array after attribute-less rendering
void push_projection_matrix()
same as push_V but for the projection matrix - a different matrix stack is used.
bvec4 get_color_mask() const
get the color buffer mask
const rgba & get_color() const
return current color
bool is_shader_file_cache_enabled() const
whether the shader file caches are enabled
bool current_material_is_textured
store flag to tell whether current material is textured
void push_bg_accum_color()
push a copy of the current background accumulation color onto the stack
virtual media::font::font_face_ptr get_current_font_face() const
return the currently enabled font face
virtual void set_projection_matrix(const dmat4 &P)
set the current projection matrix, which transforms from eye to clip space
rgba current_color
current color value
static const unsigned nr_default_light_sources
number of default light sources
cgv::media::illum::light_source default_light_source[nr_default_light_sources]
default light sources
std::stack< int > bg_stencil_stack
stack of background stencil values
virtual dmat4 get_projection_matrix() const =0
return homogeneous 4x4 projection matrix, which transforms from eye to clip space
void begin_attribute_less_rendering()
this function ensures that in core profile a dummy attribute array is bound, what is essential for at...
dmat4 get_modelview_projection_device_matrix() const
return matrix to transfrom from model to device coordinates, i.e. the product of modelview,...
std::stack< vec4 > bg_accum_color_stack
stack of background accumulation colors
virtual void set_cursor(int x, int y)
flush the output_stream and set a new cursor position given in opengl coordinates with (0,...
void pop_bg_accum_color()
pop the top of the current background accumulation color from the stack
virtual void set_bg_stencil(int s)
set a user defined background stencil value
virtual void put_cursor_coords(const vecn &p, int &x, int &y) const
transform point p in current world coordinates into opengl coordinates with (0,0) in lower left corne...
virtual void set_bg_accum_color(vec4 rgba)
set a user defined background color for the accumulation buffer
virtual void set_default_render_pass_flags(RenderPassFlags)
return the default render pass flags
float get_bg_depth() const
return the current depth value for clearing the background
const std::vector< window_transformation > & get_window_transformation_array() const
return the current window transformation array
virtual unsigned get_max_window_transformation_array_size() const =0
query the maximum number of supported window transformations, which is at least 1
int x_offset
offset in x and y direction where text starts
void put_bg_accum_color(float *rgba) const
copy the current accumulation background rgba color into the given float array
std::map< void *, std::pair< cgv::media::illum::light_source, light_source_status > > light_sources
map handle to light source and light source status information
virtual void set_textured_material(const textured_material &mat)
set the current material
std::stack< std::vector< window_transformation > > window_transformation_stack
keep stack of window transformations
dvec3 get_model_point(int x_window, int y_window) const
compute model space 3D point from the given opengl pixel location (window location)
int cursor_x
current cursor location for textual output
vec4 get_bg_accum_color() const
return the current color value for clearing the accumulation buffer
const cgv::media::illum::light_source & get_light_source(void *handle) const
read access to light source
virtual bool make_current() const =0
make the current context current if possible
bool draw_in_compatibility_mode
whether to do all drawing in compatibility mode, only possible if support_compatibility_mode is true,...
virtual void set_blend_state(BlendState state)
set the complete blend state
virtual void render_pass(RenderPass render_pass=RP_MAIN, RenderPassFlags render_pass_flags=RPF_ALL, void *user_data=0, int rp_idx=-1)
perform the given render task
bool remove_light_source(void *handle)
remove a light source by handle and whether it existed
bool sRGB_framebuffer
whether to use opengl option to support sRGB framebuffer
virtual RenderPassFlags get_default_render_pass_flags() const
return the default render pass flags
virtual void set_bg_depth(float d)
set a user defined background depth value
void set_gamma(float _gamma)
set the current per channel gamma values to single value
virtual void enable_blending()
enable blending
virtual dmat4 get_modelview_matrix() const =0
return homogeneous 4x4 viewing matrix, which transforms from world to eye space
vec3 get_light_eye_spot_direction(const cgv::media::illum::light_source &light, bool place_now) const
helper function to place spot lights
void set_current_material(shader_program &prog) const
set the shader program material to the currently enabled material
void pop_cull_state()
pop the top of the current culling state from the stack
virtual void draw_text(const std::string &text)
draw some text at cursor position and update cursor position
void pop_modelview_matrix()
see push_V for an explanation
virtual ~context()
virtual destructor
void * default_light_source_handles[nr_default_light_sources]
handles of default light sources
void push_modelview_matrix()
push the current viewing matrix onto a matrix stack for viewing matrices.
std::stack< frame_buffer_base * > frame_buffer_stack
stack of currently enabled frame buffers
virtual void pop_pixel_coords()=0
pop previously pushed transformation matrices from modelview and projection stacks
bool at_line_begin
store whether we are at the beginning of the line
size_t get_nr_light_sources() const
return the number of light sources
void tesselate_unit_square(bool flip_normals=false, bool edges=false)
tesselate a unit square in the xy-plane with texture coordinates
bool auto_set_view_in_current_shader_program
whether to automatically set viewing matrixes in current shader program, defaults to true
bool debug_render_passes
whether to debug render passes
std::vector< void * > enabled_light_source_handles
keep track of enabled light source handles
void tesselate_unit_cone(int resolution=25, bool flip_normals=false, bool edges=false)
tesselate a cone of radius 1
CullingMode get_cull_state() const
return the current culling state
virtual void mul_projection_matrix(const dmat4 &P)
multiply given matrix from right to current projection matrix
virtual void set_viewport(const ivec4 &viewport, int array_index=-1)
set the current viewport or one of the viewports in the window transformation array
virtual void post_redraw()=0
the context will be redrawn when the system is idle again
const cgv::media::illum::surface_material * current_material_ptr
store pointer to current material
virtual void set_modelview_matrix(const dmat4 &MV)
set the current modelview matrix, which transforms from world to eye space
void push_bg_color()
push a copy of the current background color onto the stack
void * get_enabled_light_source_handle(size_t i) const
access to handle of i-th light source
void push_buffer_mask()
push a copy of the current buffer mask onto the stack saved attributes: depth mask,...
virtual void enable_phong_shading()
enable phong shading with the help of a shader (enabled by default)
void set_debug_render_passes(bool _debug)
set flag whether to debug render passes
cgv::media::font::font_face_ptr current_font_face
store current font
cgv::signal::callback_stream out_stream
use a callback stream to write text to the opengl context
std::stack< vec4 > bg_color_stack
stack of background colors
unsigned get_render_pass_recursion_depth() const
return current render pass recursion depth
std::stack< BlendState > blend_state_stack
stack of blend states
virtual void set_depth_mask(bool flag)
set the depth buffer mask
bool auto_set_gamma_in_current_shader_program
whether to automatically set gamma in current shader program, defaults to true
void set_context(context *_ctx)
set the current focus context, this should only be called by the context itself
virtual void finish_draw(context &)
this method is called when the current drawable is left in a tree traversal that calls the draw metho...
virtual void draw(context &)
overload to draw the content of this drawable
virtual void after_finish(context &)
this method is called in one pass over all drawables after finish frame
virtual void finish_frame(context &)
this method is called in one pass over all drawables after drawing
virtual bool init(context &)
this method is called after creation or recreation of the context, return whether all necessary funct...
base interface for framebuffer
frame_buffer_base()
initialize members
base interface for all render components
virtual bool is_created() const
return whether component has been created
const context * ctx_ptr
keep pointer to my context
render_component()
initialize members
void put_id_void(void *ptr) const
copy the rendering api specific id the component to the memory location of the given pointer.
base interface for shader programs
shader_program_base()
initializes members
a shader program combines several shader code fragments to a complete definition of the shading pipel...
bool set_uniform(const context &ctx, const std::string &name, const T &value, bool generate_error=false)
Set the value of a uniform by name, where the type can be any of int, unsigned, float,...
bool set_attribute(const context &ctx, const std::string &name, const T &value)
set constant default value of a vertex attribute by attribute name, if name does not specify an attri...
bool set_textured_material_uniform(const context &ctx, const std::string &name, const textured_material &material, bool generate_error=false)
set a uniform of type textured_material
bool set_light_uniform(const context &ctx, const std::string &name, const cgv::media::illum::light_source &light, bool generate_error=false)
set a uniform of type light source
int get_uniform_location(const context &ctx, const std::string &name) const
query location index of an uniform
bool set_material_uniform(const context &ctx, const std::string &name, const cgv::media::illum::surface_material &material, bool generate_error=false)
set a uniform of type material
texture_base(TextureType _tt=TT_UNDEF)
initialize members
class that extends obj_material with the management of textures
defines a symmetric view with the following quantities:
the base namespace holds the base hierarchy, support for plugin registration and signals
data::ref_ptr< group, true > group_ptr
ref counted pointer to a node
void register_object(base_ptr object, const std::string &options)
register an object and send event to all current registration ref_listeners()
ComponentFormat
define standard formats, which should be used to avoid wrong assignment of component names
@ CF_D
color format with components B, G, R and A
RenderAPI
enumeration of rendering APIs which can be queried from the context
CullingMode
different culling modes
void register_context_factory(context_creation_function_type fp)
registration context creation functions
BlendFunction
different blend functions
std::ostream & operator<<(std::ostream &os, const type_descriptor &td)
operator to write textual description to stream
TextAlignment
different text alignments
std::string get_render_pass_name(RenderPass rp)
convert render pass type into string
TextureFilter
different texture filter
render_config_ptr get_render_config()
return a pointer to the current shader configuration
TextureWrap
different texture wrap modes
FrameBufferType
different frame buffer types which can be combined together with or
MaterialSide
different sides of a material
context * create_context(RenderAPI api, unsigned int w, unsigned int h, const std::string &title, bool show)
construct a context of the given size.
TextureCubeSides
the six different sides of a cube
void tesselate_unit_dodecahedron_or_icosahedron(context &c, bool dual, bool flip_normals, bool edges)
render an icosahedron at a given center.
PrimitiveType
different primitive types
RenderPass
Enumeration of different render passes, which can be queried from the context and used to specify a n...
TextureType
different texture types
RenderPassFlags
available flags that can be queried from the context and set for a new render pass
@ RPF_DRAWABLES_FINISH_FRAME
whether to call finish frame method of drawables
@ RPF_SET_LIGHTS
whether to define default lights
@ RPF_DRAWABLES_DRAW
whether to call draw and finish_draw methods of drawables
@ RPF_DRAWABLES_AFTER_FINISH
whether to call after finish method of drawables
@ RPF_DEFAULT
all flags set, defines default render pass
@ RPF_NONE
no frame initialization is performed
@ RPF_HANDLE_SCREEN_SHOT
whether to perform a screen shot if this was scheduled
@ RPF_DRAW_TEXTUAL_INFO
whether to draw textual information
CompareFunction
different comparison functions used for depth testing or texture comparisons
GPUVendorID
IDs for GPU vendors.
unsigned int get_type_size(TypeId tid)
function that returns the size of a type specified through TypeId
@ TI_INT32
signed integer stored in 16 bits
@ TI_FLT32
floating point type stored in 16 bits
@ TI_UINT32
unsigned integer stored in 16 bits
@ TI_UINT8
signed integer stored in 64 bits
@ TI_FLT64
floating point type stored in 32 bits
std::string to_string(const std::string &v, unsigned int w, unsigned int p, bool)
specialization of conversion from string to strings
this header is dependency free
cgv::math::fvec< float, 4 > vec4
declare type of 4d single precision floating point vectors (used for homogeneous coordinates)
cgv::media::color< float, cgv::media::RGB, cgv::media::OPACITY > rgba
declare rgba color type with 32 bit components
cgv::math::fvec< double, 3 > dvec3
declare type of 3d double precision floating point vectors
cgv::math::fvec< int32_t, 4 > ivec4
declare type of 4d 32 bit integer vectors
cgv::media::color< float, cgv::media::RGB > rgb
declare rgb color type with 32 bit components
cgv::math::fvec< int32_t, 2 > ivec2
declare type of 2d 32 bit integer vectors
cgv::math::fvec< bool, 4 > bvec4
declare type of 4d boolean vectors
cgv::math::fvec< float, 3 > vec3
declare type of 3d single precision floating point vectors
cgv::math::fvec< double, 2 > dvec2
declare type of 2d double precision floating point vectors
Represents a blend state used to configure fragment blending.
BlendFunction dst_color
the destination color (rgb) factor
BlendFunction dst_alpha
the destination alpha factor
BlendFunction src_alpha
the source alpha factor
BlendFunction src_color
the source color (rgb) factor
Represents a buffer mask used to mask depth and color buffer outputs.
Represents a depth test state used to configure depth testing.
status information of light sources
information necessary for a rendering pass
configuration object used to define context parameters that need to be set already at creation time
bool multi_sample_buffer
default: false
bool stencil_buffer
default: false
int version_minor
default: -1 ... minor version of maximum supported OpenGL version
int depth_bits
default: -1
bool double_buffer
default: true
int version_major
default: -1 ... major version of maximum supported OpenGL version
context_config()
construct config with default parameters
bool debug
default: false in release and true in debug version
bool forward_compatible
default: false
bool stereo_buffer
default: false
bool alpha_buffer
default: false
bool self_reflect(cgv::reflect::reflection_handler &srh)
reflect the shader_path member
bool core_profile
default: true
int stencil_bits
default: -1
int nr_multi_samples
default: -1
bool accumulation_buffer
default: false
int accumulation_bits
default: -1
bool depth_buffer
default: true
structure to store information on a shader program variable, i.e.
unsigned array_size
dimension of arrays
void compute_sizes(size_t &cnt, size_t &s, size_t &S) const
helper member function to compute counts and sizes
cgv::render::type_descriptor type_descr
type descriptor providing information on component and compositions (scalar, vector or matrix)
configuration object used to define render view creation parameters including error handling configur...
int window_width
default: 640
render_config()
construct config with default parameters
bool dialog_on_error
default: true (only in case a gui_driver, which supports this, is loaded)
bool self_reflect(cgv::reflect::reflection_handler &srh)
reflect the shader_path member
int fullscreen_monitor
default: -1 ... no fullscreen
int window_height
default: 480
bool abort_on_error
default: false
std::string get_type_name() const
return "render_config"
bool show_error_on_console
default: true
compact type description of data that can be sent to the context; convertible to int