CGPdocs

curve_drawable

Polyline stored on the GPU, ready to be drawn.

module 16_drawablesource: curve_drawable.hpp
The fields of curve_drawable, and the same 6 points drawn as one connected line (display_type Curve) or as separate segments (Segments).
The fields of curve_drawable, and the same 6 points drawn as one connected line (display_type Curve) or as separate segments (Segments). Tap to enlarge.

Fields and methods

Members of the struct curve_drawable. Most of what you do with a CGP type goes through the free functions listed below.

Fields

curve_drawable_display_type display_type = curve_drawable_display_type::CurveDrawing 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 shaderShader program used to draw the curve, which must be valid (non-zero id) at draw time.
opengl_vbo_structure vbo_positionVBO storing the positions of the curve points, bound to shader location 0.
GLuint vao = 0OpenGL id of the Vertex Array Object of the curve, 0 when not initialized.
affine modelModel transform sent to the uniform model, reset to identity by initialize_data_on_gpu and clear.
vec3 colorUniform RGB color of the curve sent to the uniform color, set to red by initialize_data_on_gpu.
opengl_shader_structure default_shaderStatic shader shared by all curve_drawable and used by default in initialize_data_on_gpu, loaded from shaders/single_color by the application.

Methods

Uploads the positions into a new VBO and VAO, sets the shader, and resets model to identity and color to red (does nothing but warn if position is empty). src
Deletes the VBO and the VAO, sets the shader id to 0 without deleting the program, and resets model to identity and color to black. src
Sends the uniforms color and model to the shader of the curve. src

Functions taking a curve_drawable

Draw 1

void draw(
    curve_drawable const& drawable,
    environment_generic_structure const& environment,
    int N_points = -1
)

Draw a curve_drawable as a line strip or as separate segments, limited to the first N_points points if N_points is not -1.

Functions returning a curve_drawable

None.

Operators

None.

CGP - Computer Graphics Programming.