Class PointsProxyBase
Defined in File RenderableProxy.h
Inheritance Relationships
Base Type
public mrpt::opengl::RenderableProxy(Class RenderableProxy)
Derived Type
public mrpt::opengl::PointsProxy(Class PointsProxy)
Class Documentation
-
class PointsProxyBase : public mrpt::opengl::RenderableProxy
Specialization for proxies that render points.
This provides common functionality for all point-based rendering, including vertex and color buffer management.
See also
mrpt::viz::VisualObjectParams_Points
Subclassed by mrpt::opengl::PointsProxy
Public Functions
-
PointsProxyBase() = default
-
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 data version of the source object changes (mrpt::viz::CVisualObject::dataVersion()). 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 std::vector<shader_id_t> requiredShaders() const override
Returns the list of shader programs this object needs.
Most objects use a single shader, but some may use multiple (e.g., different shaders for shadow map pass vs. normal rendering).
- Returns:
Vector of shader IDs, typically with 1 element
-
inline virtual bool castsShadows() const override
Does this object cast shadows?
Used to determine if the object should be rendered during the shadow map generation pass (1st pass of shadow rendering).
- Returns:
m_castShadows by default, which follows mrpt::viz::CVisualObject::castShadows() of the object and its parents.
-
inline virtual const char *typeName() const override
Returns a human-readable type name for this proxy. Used for debugging and logging.
Protected Attributes
-
VertexArrayObject m_vao
Vertex Array Object (caches attribute bindings)
-
size_t m_pointCount = 0
Number of points to render
-
bool m_hasColorBuffer = false
If false, all points have m_baseColor
-
bool m_hasDirectionBuffer = false
If true, back-facing points are hidden using m_directionBuffer
-
PointsProxyBase() = default