1#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>
12#define SAFE_STACK_POP(STACK, WHERE) \
13if(STACK.size() == 1) error("context::" WHERE "() ... attempt to completely empty stack avoided."); \
20const int nr_backgrounds = 5;
21float background_colors[] = {
71 srh.reflect_member(
"debug",
debug) &&
105 return "render_config";
132 gpu_vendor = GPU_VENDOR_UNKNOWN;
166 projection_matrix_stack.push(cgv::math::identity4<double>());
169 wt.viewport =
ivec4(0, 0, 640, 480);
191 do_screen_shot =
false;
222 rc->last_error = message;
224 std::cerr << message << std::endl;
236 return gpu_capabilities;
244void context::init_render_pass()
249void context::draw_textual_info()
254void context::perform_screen_shot()
258void context::destruct_render_objects()
264void context::finish_render_pass()
282 error(
child->get_type_name()+
"::init(context&) failed");
415 error(
"context::enable_phong_shading() deprecated");
418void context::disable_phong_shading()
421 error(
"context::disable_phong_shading() deprecated");
426 error(
"context::enable_material(phong_material) deprecated");
431 error(
"context::disable_material(phong_material) deprecated");
433void context::enable_material(
const textured_material& mat,
MaterialSide ms,
float alpha)
435 error(
"context::enable_material(textured_material) deprecated");
483 dvec4 hL(
Le,
light.get_type() == cgv::media::illum::LT_DIRECTIONAL ? 0.0f : 1.0f);
486 if (
light.get_type() != cgv::media::illum::LT_DIRECTIONAL)
523 light_sources[handle] = std::pair<cgv::media::illum::light_source, light_source_status>(
539 if (iter->second.second.enabled) {
555 return iter->second.first;
562 return iter->second.second;
570 iter->second.first =
light;
574 if (iter->second.second.enabled)
585 prog.
set_uniform(*
this,
"inverse_modelview_matrix", inv(
V));
604 prog.
set_uniform(*
this,
"inverse_projection_matrix", inv(
P));
630 prog.
set_uniform(*
this,
prefix +
".spot_direction", iter->second.second.eye_spot_direction);
645 if (!prog.does_use_lights())
658 if (iter->second.second.enabled)
685 return iter->second.second.enabled;
694 if (iter->second.second.enabled)
696 iter->second.second.enabled =
true;
709 if (!iter->second.second.enabled)
711 iter->second.second.enabled =
false;
715 iter->second.second.light_source_index = -1;
740 "RP_OPAQUE_SURFACES",
741 "RP_TRANSPARENT_SURFACES",
802 if (
ri.pass_index != -1)
803 std::cout <<
":" <<
ri.pass_index;
804 std::cout <<
"> " << info << std::endl;
818 ri.user_data = user_data;
853 perform_screen_shot();
854 do_screen_shot =
false;
857 finish_render_pass();
865 unsigned int i,
j = 0;
866 for (
i = 0;
i<text.size(); ++
i) {
912 float y = (
float)cursor_y;
915 cursor_y =
int(y + 0.5f);
928 font_face->enable(
this, font_size);
961 unsigned char*
dst =
dv1.get_ptr<
unsigned char>();
974 unsigned char*
dst = dv.
get_ptr<
unsigned char>();
976 for (
size_t i=0;
i<n; ++
i, ++
dst)
990 "repeat",
"clamp",
"clamp_to_edge",
"clamp_to_border",
"mirror_clamp",
991 "mirror_clamp_to_edge",
"mirror_clamp_to_border"
1001 "undefined",
"Texture1D",
"Texture2D",
"Texture3D",
"CubeTexture"
1010 "x+",
"x-",
"y+",
"y-",
"z+",
"z-"
1019 "undef",
"points",
"lines",
"lines_adjacency",
"line_strip",
"line_strip_adjacency",
"line_loop",
1020 "triangles",
"triangles_adjacency",
"triangle_strip",
"triangle_strip_adjacency",
"triangle_fan",
1021 "quads",
"quad_strip",
"polygon",
"patches"
1032 "nearest_mipmap_nearest",
1033 "linear_mipmap_nearest",
1034 "nearest_mipmap_linear",
1035 "linear_mipmap_linear",
1042float black[4] = { 0, 0, 0, 1 };
1043float white[4] = { 1, 1, 1, 1 };
1044float gray[4] = { 0.25f, 0.25f, 0.25f, 1 };
1045float green[4] = { 0, 1, 0, 1 };
1046float brown[4] = { 0.3f, 0.1f, 0, 1 };
1047float dark_red[4] = { 0.4f, 0, 0, 1 };
1048float cyan[4] = { 0, 1, 1, 1 };
1049float yellow[4] = { 1, 1, 0, 1 };
1050float red[4] = { 1, 0, 0, 1 };
1051float blue[4] = { 0, 0, 1, 1 };
1053void compute_face_normals(
const float* vertices,
float* normals,
const int* vertex_indices,
int* normal_indices,
int nr_faces,
int face_degree)
1055 for (
int i = 0;
i < nr_faces; ++
i) {
1056 vec3& normal =
reinterpret_cast<vec3&
>(normals[3 *
i]);
1058 vec3 reference_pnt = *
reinterpret_cast<const vec3*
>(vertices + 3 * vertex_indices[face_degree*
i + face_degree - 1]);
1061 for (
int j = 0;
j < face_degree; ++
j) {
1067 for (
int j = 0;
j<face_degree; ++
j)
1068 normal_indices[face_degree*
i+
j] =
i;
1075 static float V[8*3] = {
1085 static float N[6*3] = {
1090 static const float ot =
float(1.0 / 3);
1091 static const float tt =
float(2.0 / 3);
1092 static float T[14*2] = {
1094 0.25f,0 , 0.25f,ot ,
1095 0.25f,tt , 0.25f,1 ,
1098 0.75f,ot , 0.75f,tt ,
1101 static int F[6*4] = {
1109 static int FN[6*4] = {
1114 static int FT[6*4] = {
1115 3,4,1,0 ,7,10,11,8 ,
1117 12,13,11,10 ,3,7,8,4
1128 static float N[6 * 3] = {
1133 static int F[6 * 4] = {
1141 static int FN[6 * 4] = {
1142 0, 0, 0, 0, 1, 1, 1, 1,
1143 2, 2, 2, 2, 3, 3, 3, 3,
1144 4, 4, 4, 4, 5, 5, 5, 5
1148 for (
unsigned i = 0;
i < 8; ++
i) {
1162 static const float V[6*3] = {
1170 static float a = 1.0f/
sqrt(5.0f);
1171 static float b = 2*a;
1172 static const float N[5*3] = {
1179 static const int FT[2*3] = { 0,1,2, 5,4,3 };
1180 static const int FQ[8] = { 4,1, 3,0, 5,2, 4,1};
1181 static const int FTN[2*3] = { 0,0,0, 1,1,1 };
1182 static const int FQN[8] = { 2,2, 2,2, 3,3, 4,4, };
1197 std::vector<float>
V;
V.reserve(3*(resolution+1));
1198 std::vector<float> N; N.reserve(3*(resolution+1));
1199 std::vector<float>
T;
T.reserve(2*(resolution+1));
1201 std::vector<int> F; F.resize(resolution+1);
1203 for (
i = 0;
i <= resolution; ++
i)
1206 float step =
float(2*M_PI/resolution);
1208 for (
i = 0;
i <= resolution; ++
i,
phi += step) {
1214 T.push_back((
float)
i/resolution);
1229 std::vector<float>
V;
V.reserve(6*(resolution+1));
1230 std::vector<float> N; N.reserve(6*(resolution+1));
1231 std::vector<float>
T;
T.reserve(4*(resolution+1));
1233 std::vector<int> F; F.resize(2*resolution+2);
1235 for (
i = 0;
i <= 2*resolution+1; ++
i)
1238 static float a = 1.0f/
sqrt(5.0f);
1239 static float b = 2*a;
1240 float step =
float(2*M_PI/resolution);
1244 for (
int i = 0;
i <= resolution; ++
i, u +=
duv,
phi += step) {
1273 std::vector<float>
V;
V.reserve(6*(resolution+1));
1274 std::vector<float> N; N.reserve(6*(resolution+1));
1275 std::vector<float>
T;
T.reserve(4*(resolution+1));
1277 std::vector<int> F; F.resize(2*(resolution+1));
1279 for (
i = 0;
i <= 2*resolution+1; ++
i)
1282 float step =
float(2*M_PI/resolution);
1286 for (
int i = 0;
i <= resolution; ++
i, u +=
duv,
phi += step) {
1315 std::vector<float>
V;
V.resize(6*(resolution+1));
1316 std::vector<float> N; N.resize(6*(resolution+1));
1317 std::vector<float>
T;
T.resize(4*(resolution+1));
1318 std::vector<int> F; F.resize(2*(resolution+1));
1320 for (
int i = 0;
i <= resolution; ++
i) {
1324 float step =
float(2*M_PI/resolution);
1329 for (
i = 0;
i < resolution; ++
i, u +=
duv) {
1337 for (
int j = 0;
j <= resolution; ++
j,
theta += step, v +=
duv) {
1365 std::vector<float>
V;
V.resize(6*(resolution+1));
1366 std::vector<float> N; N.resize(6*(resolution+1));
1367 std::vector<float>
T;
T.resize(4*(resolution+1));
1368 std::vector<int> F; F.resize(2*(resolution+1));
1370 for (
int i = 0;
i <= resolution; ++
i) {
1374 float step =
float(M_PI/resolution);
1379 for (
i = 0;
i < resolution; ++
i, u +=
duv) {
1387 for (
int j = 0;
j <= resolution; ++
j,
theta += step, v +=
duv) {
1416 static const float a =
float(1.0/(2*
sqrt(3.0)));
1417 static const float b =
float(1.0/(3*
sqrt(3.0/2)));
1418 static const float V[4*3] = {
1424 static const int F[4*3] = {
1425 0,2,1,3,2,0,3,0,1,3,1,2
1428 static float N[4*3];
1431 compute_face_normals(
V, N, F,
FN, 4, 3);
1444 static float N[1*3] = {
1447 static float V[4*3] = {
1451 static float T[4*2] = {
1455 static int FN[1*4] = {
1458 static int F[1*4] = {
1471 static float N[8*3] = {
1472 -1,-1,+1, +1,-1,+1, -1,+1,+1, +1,+1,+1,
1473 -1,-1,-1, +1,-1,-1, -1,+1,-1, +1,+1,-1
1475 static float V[6*3] = {
1480 static int FN[8*3] = {
1490 static int F[8*3] = {
1509 static const float h = 0.4472135956f;
1510 static const float r = 0.8944271912f;
1511 static const float s =
float(M_PI/2.5);
1512 static const float o =
float(M_PI/5);
1513 static const float V[13*3] = {
1515 r*
sin(1*s),r*
cos(1*s),-h,
1516 r*
sin(2*s),r*
cos(2*s),-h,
1517 r*
sin(3*s),r*
cos(3*s),-h,
1518 r*
sin(4*s),r*
cos(4*s),-h,
1519 r*
sin(5*s),r*
cos(5*s),-h,
1520 r*
sin(1*s+o),r*
cos(1*s+o),h,
1521 r*
sin(2*s+o),r*
cos(2*s+o),h,
1522 r*
sin(3*s+o),r*
cos(3*s+o),h,
1523 r*
sin(4*s+o),r*
cos(4*s+o),h,
1524 r*
sin(5*s+o),r*
cos(5*s+o),h,
1528 static int F[20*3] = {
1529 0,1,2, 0,2,3, 0,3,4, 0,4,5, 0,5,1,
1530 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,
1531 11,6,10, 11,10,9, 11,9,8, 11,8,7, 11,7,6
1533 static int DF[12*5] = {
1547 static float N[20*3];
1548 static int FN[20*3];
1549 static int DFN[12*5] = {
1566 compute_face_normals(
V, N, F,
FN, 20, 3);
1619 if (prog.does_use_gamma())
1642 if (!prog.does_context_set_color())
1644 int clr_loc = prog.get_color_index();
1663 if (!prog.does_use_material())
1682 if (!prog.does_use_material())
1815 mask.red_flag = flags[0];
1816 mask.green_flag = flags[1];
1817 mask.blue_flag = flags[2];
1818 mask.alpha_flag = flags[3];
1846 SAFE_STACK_POP(projection_matrix_stack,
"pop_projection_matrix");
1867 if (!prog.does_use_view())
1875 projection_matrix_stack.top() =
P;
1884 if (!prog.does_use_view())
1899bool context::ensure_window_transformation_index(
int&
array_index)
1909 std::string message(
"context::ensure_window_transformation_index() ... attempt to resize window transformation array larger than maximum allowed size of ");
1922 if (!ensure_window_transformation_index(
array_index))
1929 if (!ensure_window_transformation_index(
array_index))
1943 std::string message(
"context::get_window_matrix() ... attempt to query window matrix with array index ");
1945 message +=
" out of range [0,";
1949 return cgv::math::identity4<double>();
1952 dmat4 M = cgv::math::identity4<double>();
1953 M(0, 0) = 0.5*
wt.viewport[2];
1954 M(0, 3) =
M(0, 0) +
wt.viewport[0];
1955 M(1, 1) = 0.5*
wt.viewport[3];
1956 M(1, 3) =
M(1, 1) +
wt.viewport[1];
1957 M(2, 2) = 0.5*(
wt.depth_range[1] -
wt.depth_range[0]);
1958 M(2, 3) =
M(2, 2) +
wt.depth_range[0];
1974 return vec3(
float(x(0) / x(3)),
float(x(1) / x(3)),
float(x(2) / x(3)));
1993 for (
unsigned int c = 0; c < p.
size(); ++c)
2005 int x_offset,
int y_offset)
2013 case 0 : x -= (
int)(floor(w)*0.5f);
break;
2014 case 2 : x -= (
int)floor(w);
break;
2018 case 0 : y -= (
int)(floor(h)*0.3f);
break;
2019 case 4 : y -= (
int)(floor(h)*0.6f);
break;
2043 std::cout <<
"tesselate_arrow not implemented in cgv::render::context" << std::endl;
2048 std::cout <<
"tesselate_arrow not implemented in cgv::render::context" << std::endl;
2053 std::cout <<
"draw_light_source not implemented in cgv::render::context" << std::endl;
2059 internal_format = 0;
2074 std::cerr <<
"no context set when render_component::put_id_void was called" << std::endl;
2080render_buffer_base::render_buffer_base()
2087 mag_filter = TF_LINEAR;
2088 min_filter = TF_LINEAR_MIPMAP_LINEAR;
2089 wrap_s = TW_CLAMP_TO_EDGE;
2090 wrap_t = TW_CLAMP_TO_EDGE;
2091 wrap_r = TW_CLAMP_TO_EDGE;
2094 border_color[0] = 1;
2095 border_color[1] = 1;
2096 border_color[2] = 1;
2097 border_color[3] = 1;
2099 compare_function = CF_LEQUAL;
2100 use_compare_function =
false;
2101 have_mipmaps =
false;
2104void shader_program_base::allow_context_to_set_color(
bool allow)
2106 context_sets_color =
allow;
2112 geometry_shader_input_type = PT_POINTS;
2113 geometry_shader_output_type = PT_POINTS;
2114 geometry_shader_output_count = 1;
2116 auto_detect_uniforms =
true;
2117 auto_detect_vertex_attributes =
true;
2120 uses_material =
false;
2121 uses_lights =
false;
2124 position_index = -1;
2127 context_sets_color =
true;
2128 texcoord_index = -1;
2132void shader_program_base::specify_standard_uniforms(
bool view,
bool material,
bool lights,
bool gamma)
2134 auto_detect_uniforms =
false;
2136 uses_material = material;
2141void shader_program_base::specify_standard_vertex_attribute_names(context& ctx,
bool color,
bool normal,
bool texcoord)
2143 auto_detect_vertex_attributes =
false;
2144 position_index = ctx.get_attribute_location(*
this,
"position");
2145 color_index =
color ? ctx.get_attribute_location(*
this,
"color") : -1;
2146 normal_index = normal ? ctx.get_attribute_location(*
this,
"normal") : -1;
2147 texcoord_index = texcoord ? ctx.get_attribute_location(*
this,
"texcoord") : -1;
2150void 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)
2152 auto_detect_vertex_attributes =
false;
2153 position_index = position.empty() ? -1 : ctx.get_attribute_location(*
this, position);
2154 color_index =
color.empty() ? -1 : ctx.get_attribute_location(*
this,
color);
2155 normal_index = normal.empty() ? -1 : ctx.get_attribute_location(*
this, normal);
2156 texcoord_index = texcoord.empty() ? -1 : ctx.get_attribute_location(*
this, texcoord);
2158bool context::shader_program_link(shader_program_base&
spb)
const
2160 if (
spb.handle == 0)
2162 if (
spb.auto_detect_vertex_attributes) {
2163 spb.position_index = get_attribute_location(
spb,
"position");
2164 spb.color_index = get_attribute_location(
spb,
"color");
2165 spb.normal_index = get_attribute_location(
spb,
"normal");
2166 spb.texcoord_index = get_attribute_location(
spb,
"texcoord");
2167 spb.auto_detect_vertex_attributes =
false;
2169 if (
spb.auto_detect_uniforms) {
2170 spb.uses_lights = get_uniform_location(
spb,
"light_sources[0].light_source_type") != -1;
2171 spb.uses_material = get_uniform_location(
spb,
"material.brdf_type") != -1;
2173 get_uniform_location(
spb,
"modelview_matrix") != -1 ||
2174 get_uniform_location(
spb,
"projection_matrix") != -1 ||
2175 get_uniform_location(
spb,
"inverse_projection_matrix") != -1 ||
2176 get_uniform_location(
spb,
"normal_matrix") != -1 ||
2177 get_uniform_location(
spb,
"inverse_modelview_matrix") != -1 ||
2178 get_uniform_location(
spb,
"inverse_normal_matrix") != -1;
2179 spb.uses_gamma = get_uniform_location(
spb,
"gamma3") != -1 || get_uniform_location(
spb,
"gamma") != -1;
2180 spb.auto_detect_uniforms =
false;
2185bool context::shader_program_enable(shader_program_base&
spb)
2187 if (
spb.is_enabled) {
2189 error(
"context::shader_program_enable() called with program that is currently active", &
spb);
2192 error(
"context::shader_program_enable() called with program that is recursively reactivated", &
spb);
2196 spb.is_enabled =
true;
2200bool context::shader_program_disable(shader_program_base&
spb)
2203 error(
"context::shader_program_disable() called with empty stack", &
spb);
2206 if (!
spb.is_enabled) {
2207 error(
"context::shader_program_disable() called with disabled program", &
spb);
2211 error(
"context::shader_program_disable() called with program that was not on top of shader program stack", &
spb);
2215 spb.is_enabled =
false;
2219bool context::shader_program_destruct(shader_program_base&
spb)
const
2221 if (
spb.is_enabled) {
2222 error(
"context::shader_program_destruct() on shader program that was still enabled", &
spb);
2246void context::shader_program_set_uniform_locations(shader_program_base&
spb)
const
2248 spb.uniform_locations.clear();
2267 if (aab.is_enabled) {
2268 error(
"context::attribute_array_binding_destruct() on array binding that was still enabled", &aab);
2293bool context::attribute_array_binding_enable(attribute_array_binding_base& aab)
2296 error(
"context::attribute_array_binding_enable() called in not created attribute array binding.", &aab);
2299 if (aab.is_enabled) {
2301 error(
"context::attribute_array_binding_enable() called with array binding that is currently active", &aab);
2304 error(
"context::attribute_array_binding_enable() called with array binding that is recursively reactivated", &aab);
2308 aab.is_enabled =
true;
2312bool context::attribute_array_binding_disable(attribute_array_binding_base& aab)
2315 error(
"context::attribute_array_binding_disable() called with empty stack", &aab);
2318 if (!aab.is_enabled) {
2319 error(
"context::attribute_array_binding_disable() called with disabled array binding", &aab);
2323 error(
"context::attribute_array_binding_disable() called with array binding that was not on top of array binding stack", &aab);
2327 aab.is_enabled =
false;
2344 depth_attached =
false;
2345 std::fill(attached, attached+16,
false);
2348void context::get_buffer_list(
frame_buffer_base&
fbb,
bool& depth_buffer, std::vector<int>& buffers,
int offset)
2350 if (
fbb.enabled_color_attachments.size() == 0) {
2351 for (
int i = 0;
i < 16; ++
i)
2352 if (
fbb.attached[
i])
2353 buffers.push_back(
i + offset);
2356 for (
int i = 0;
i < (
int)
fbb.enabled_color_attachments.size(); ++
i)
2357 if (
fbb.attached[
fbb.enabled_color_attachments[
i]])
2358 buffers.push_back(
fbb.enabled_color_attachments[
i]+offset);
2363bool context::frame_buffer_create(frame_buffer_base&
fbb)
const
2365 if (
fbb.width == -1)
2367 if (
fbb.height == -1)
2372bool context::frame_buffer_attach(frame_buffer_base&
fbb,
const render_buffer_base&
rb,
bool is_depth,
int i)
const
2374 if (
fbb.handle == 0) {
2375 error(
"gl_context::frame_buffer_attach: attempt to attach to frame buffer that is not created", &
fbb);
2378 if (
rb.handle == 0) {
2379 error(
"gl_context::frame_buffer_attach: attempt to attach empty render buffer", &
fbb);
2383 fbb.depth_attached =
true;
2385 fbb.attached[
i] =
true;
2390bool 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
2392 if (
fbb.handle == 0) {
2393 error(
"context::frame_buffer_attach: attempt to attach to frame buffer that is not created", &
fbb);
2396 if (t.handle == 0) {
2397 error(
"context::frame_buffer_attach: attempt to attach texture that is not created", &
fbb);
2401 fbb.depth_attached =
true;
2403 fbb.attached[
i] =
true;
2408bool context::frame_buffer_enable(frame_buffer_base&
fbb)
2410 if (
fbb.handle == 0) {
2411 error(
"context::frame_buffer_enable: attempt to enable not created frame buffer", &
fbb);
2414 if (
fbb.is_enabled) {
2416 error(
"context::frame_buffer_enable() called with frame buffer that is currently active", &
fbb);
2419 error(
"context::frame_buffer_enable() called with frame buffer that is recursively reactivated", &
fbb);
2423 fbb.is_enabled =
true;
2427bool context::frame_buffer_disable(frame_buffer_base&
fbb)
2430 error(
"gl_context::frame_buffer_disable called with empty stack", &
fbb);
2434 error(
"gl_context::frame_buffer_disable called with different frame buffer enabled", &
fbb);
2438 fbb.is_enabled =
false;
2442bool context::frame_buffer_destruct(frame_buffer_base&
fbb)
const
2444 if (
fbb.handle == 0) {
2445 error(
"context::frame_buffer_destruct: attempt to destruct not created frame buffer", &
fbb);
2448 if (
fbb.is_enabled) {
2449 error(
"context::frame_buffer_destruct() on frame buffer that was still enabled", &
fbb);
2455std::vector<context_creation_function_type>& ref_context_creation_functions()
2457 static std::vector<context_creation_function_type>
ccfs;
2464 ref_context_creation_functions().push_back(fp);
2467context_factory_registration::context_factory_registration(context_creation_function_type fp)
2476 unsigned int w,
unsigned int h,
2477 const std::string& title,
bool show)
2479 std::vector<context_creation_function_type>&
ccfs = ref_context_creation_functions();
2480 for (
unsigned i=0;
i<
ccfs.size(); ++
i) {
2487 std::cerr <<
"could not create context for given parameters" << std::endl;
2495#include <cgv/base/register.h>
2507#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
void zeros()
fill the vector with zeros
A matrix type (full column major storage) The matrix can be loaded directly into OpenGL without need ...
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
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
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
vec3 get_model_point(int x_window, int y_window) const
compute model space 3D point from the given opengl pixel location (window location)
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
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
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
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
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
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 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
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
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
vertex_buffer_base()
initialize members
VertexBufferType type
buffer type defaults to VBT_VERTICES
VertexBufferUsage usage
usage defaults to VBU_STATIC_DRAW
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
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.
@ VBU_STATIC_DRAW
Modified once and used many times; Modified by the application, and used as the source for GL drawing...
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
@ VBT_VERTICES
The buffer contains vertices and will be bound to GL_ARRAY_BUFFER.
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.
@ TI_FLT32
floating point type stored in 16 bits
@ TI_UINT8
signed integer stored in 64 bits
std::string to_string(const std::string &v, unsigned int w, unsigned int p, bool)
specialization of conversion from string to strings
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< 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< 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
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