curve_drawable_dynamic_extend
curve_drawable whose number of points can grow while the program runs (sketching).
Derives from: curve_drawable
Fields and methods
Members of the struct curve_drawable_dynamic_extend. Most of what you do with a CGP type goes through the free functions listed below.
Fields
int N_valid_points | Number of points added with push_back, the remaining capacity of the VBO being unused. |
Methods
| Builds an empty curve with no GPU data and N_valid_points set to 0. src | |
| Releases the GPU data of the curve, sets N_valid_points to 0, and returns the curve. src | |
| Allocates a VBO able to store initial_capacity points (100 by default) with no valid point, and returns the curve. src | |
| Writes a new point after the valid ones, initializing the VBO with capacity 100 if needed and doubling its capacity by a GPU copy when it is almost full, and returns the curve. src |
Inherited from curve_drawable (8 members)
Fields
curve_drawable_display_type display_type = curve_drawable_display_type::Curve | Drawing mode, Curve (default) for a GL_LINE_STRIP joining all the points, or Segments for GL_LINES between consecutive pairs of points. |
opengl_shader_structure shader | Shader program used to draw the curve, which must be valid (non-zero id) at draw time. |
opengl_vbo_structure vbo_position | VBO storing the positions of the curve points, bound to shader location 0. |
GLuint vao = 0 | OpenGL id of the Vertex Array Object of the curve, 0 when not initialized. |
affine model | Model transform sent to the uniform model, reset to identity by initialize_data_on_gpu and clear. |
vec3 color | Uniform RGB color of the curve sent to the uniform color, set to red by initialize_data_on_gpu. |
opengl_shader_structure default_shader | Static shader shared by all curve_drawable and used by default in initialize_data_on_gpu, loaded from shaders/single_color by the application. |
Methods
| Sends the uniforms color and model to the shader of the curve. src |
Functions taking a curve_drawable_dynamic_extend
Draw 2
void draw(
curve_drawable_dynamic_extend const& drawable,
environment_generic_structure const& environment
)Draw the N_valid_points points currently stored in a curve_drawable_dynamic_extend.
Documented on another page
drawDraw a curve_drawable as a line strip or as separate segments, limited to the first N_points points if N_points is not -1.oncurve_drawable
Functions returning a curve_drawable_dynamic_extend
None.
Operators
None.