1#include "group_renderer.h"
2#include <cgv_gl/gl/gl.h>
3#include <cgv_gl/gl/gl_tools.h>
15 group_renderer::group_renderer()
17 has_group_indices =
false;
18 has_group_colors =
false;
19 has_group_translations =
false;
20 has_group_rotations =
false;
27 has_group_indices =
true;
33 has_group_indices =
false;
38 has_group_indices =
true;
39 set_attribute_array(ctx,
"group_index", group_indices);
44 has_group_indices =
true;
45 set_attribute_array(ctx,
"group_index", group_indices, nr_elements, 0);
50 has_group_indices =
true;
51 set_attribute_array(ctx,
"group_index", element_type, vbo, offset_in_bytes, nr_elements, stride_in_bytes);
54 has_group_indices =
false;
55 remove_attribute_array(ctx,
"group_index");
67 ctx.
error(
"group_renderer::enable() group_index attribute not set while using group colors or group transformations");
71 ctx.
error(
"group_renderer::enable() group_colors not set");
75 ctx.
error(
"group_renderer::enable() group_translations not set");
79 ctx.
error(
"group_renderer::enable() group_rotations not set");
101 has_group_indices =
false;
126#include <cgv/gui/provider.h>
135 void* value_ptr,
const std::string& value_type,
136 const std::string& gui_type,
const std::string& options,
bool*)
149#include "gl/lib_begin.h"
base class for all classes that can be registered with support for dynamic properties (see also secti...
helper template for registration of gui creators
derive from this class to provide a gui to the current viewer
data::ref_ptr< control< T > > add_member_control(cgv::base::base *base_ptr, const std::string &label, T &value, const std::string &gui_type="", const std::string &options="", const std::string &align="\n")
add control with callback to cgv::base::on_set method on cgv::gui::control::value_change
the self reflection handler is passed to the virtual self_reflect() method of cgv::base::base.
bool reflect_member(const std::string &member_name, T &member_ref, bool hard_cast=false)
call this to reflect a member by member name and reference to the member.
attribute array manager used to upload arrays to gpu
base class for all drawables, which is independent of the used rendering API.
virtual void error(const std::string &message, const render_component *rc=0) const
error handling
void set_group_index_array(const context &ctx, const std::vector< unsigned > &group_indices)
method to set the group index attribute
bool disable(context &ctx)
disable renderer
void enable_attribute_array_manager(const context &ctx, attribute_array_manager &aam)
call this before setting attribute arrays to manage attribute array in given manager
void remove_group_index_array(const context &ctx)
remove the group index attribute
bool validate_attributes(const context &ctx) const
check additionally the group attributes
void disable_attribute_array_manager(const context &ctx, attribute_array_manager &aam)
call this after last render/draw call to ensure that no other users of renderer change attribute arra...
bool enable(context &ctx)
overload to activate group style
bool has_attribute(const context &ctx, const std::string &name)
check for attribute
virtual bool enable(context &ctx)
enables renderer
shader_program & ref_prog()
derived renderer classes have access to shader program
virtual void enable_attribute_array_manager(const context &ctx, attribute_array_manager &aam)
call this before setting attribute arrays to manage attribute array in given manager
virtual void disable_attribute_array_manager(const context &ctx, attribute_array_manager &aam)
call this after last render/draw call to ensure that no other users of renderer change attribute arra...
const render_style * get_style_ptr() const
access to render style
virtual bool validate_attributes(const context &ctx) const
call to validate, whether essential position attribute is defined
bool attributes_persist() const
return whether attributes persist after a call to disable
virtual bool disable(context &ctx)
disable renderer
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,...
a vertex buffer is an unstructured memory block on the GPU.
bool create(provider *p, const std::string &label, void *value_ptr, const std::string &value_type, const std::string &gui_type, const std::string &options, bool *)
attempt to create a gui and return whether this was successful
interface for gui creators
this reflection traits implementation is used for external self_reflect implementations of instances ...
render style used for group information
group_render_style()
set default values
bool use_group_transformation
whether to use group translation and rotation indexed through group index, defaults to false
bool use_group_color
whether to use group colors indexed through group index, defaults to false
compact type description of data that can be sent to the context; convertible to int
traits class with a static function get_name() of type const char* that returns the type name of the ...