Class LinesProxy

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

Class Documentation

class LinesProxy : public mrpt::opengl::LinesProxyBase

GPU-side proxy for rendering lines and wireframes.

This proxy handles rendering of any CVisualObject that uses the WIREFRAME shader, such as:

  • CSetOfLines

  • CSimpleLine

  • CGridPlaneXY / CGridPlaneXZ

  • CAxis

  • Wireframe rendering of meshes

  • Any object derived from VisualObjectParams_Lines

The proxy manages:

  • Vertex buffer (line endpoints as pairs)

  • Color buffer (per-vertex RGBA colors)

  • Line rendering parameters (width, anti-aliasing)

  • VAO for efficient attribute binding

Line rendering features:

  • Variable line width

  • Per-vertex colors

  • Optional anti-aliasing (GL_LINE_SMOOTH)

  • Alpha blending for transparency

Typical data flow:

  1. compile(): Upload initial line vertices and colors to GPU

  2. updateBuffers(): Re-upload when lines change

  3. render(): Draw lines every frame

RenderableProxy Interface Implementation

virtual void compile(const mrpt::viz::CVisualObject *sourceObj) override

Initial compilation: uploads object data to GPU.

This is called once when the proxy is first created. It should:

  • Create OpenGL buffers (VBOs, VAOs, textures)

  • Upload initial vertex/color/normal/texture data

  • Cache any frequently-used values

Note

Must be called from OpenGL context thread

Note

After this call, the proxy should be ready to render

Parameters:

sourceObj – The abstract viz object (read-only access)

virtual void updateBuffers(const mrpt::viz::CVisualObject *sourceObj) override

Incremental update: refreshes GPU buffers with changed data.

This is called when the source object’s dirty flag is set (hasToUpdateBuffers() returns true). It should:

  • Re-upload only the changed data (vertices, colors, etc.)

  • Be as efficient as possible (don’t recompile everything)

Note

Must be called from OpenGL context thread

Note

Default implementation calls compile() - override for efficiency

Parameters:

sourceObj – The abstract viz object (read-only access)

virtual void render(const RenderContext &rc) const override

Renders this object using the provided context.

This is called every frame for visible objects. It should:

  • Bind appropriate buffers (VAO, VBO, textures)

  • Set shader uniforms (model matrix, material properties, etc.)

  • Issue draw calls (glDrawArrays, glDrawElements, etc.)

Note

Must be called from OpenGL context thread

Note

The shader program is already bound when this is called

Note

Common matrices (P, V, M) are already uploaded by CompiledViewport

Parameters:

rc – Rendering context (shader, matrices, lights)

inline virtual const char *typeName() const override

Returns a human-readable type name for this proxy. Used for debugging and logging.

Public Functions

LinesProxy() = default