28 #if MRPT_HAS_OPENGL_GLUT 47 #if MRPT_HAS_OPENGL_GLUT 64 glEnableVertexAttribArray(attr_position);
66 glVertexAttribPointer(
77 glEnableVertexAttribArray(attr_color);
79 glVertexAttribPointer(
90 glEnableVertexAttribArray(attr_normals);
92 glVertexAttribPointer(
101 glDrawArrays(GL_TRIANGLES, 0, 3 *
m_triangles.size());
102 CHECK_OPENGL_ERROR();
104 glDisableVertexAttribArray(attr_position);
105 glDisableVertexAttribArray(attr_color);
106 glDisableVertexAttribArray(attr_normals);
mrpt::img::TColorf ambient
void createOnce()
Calls create() only if the buffer has not been created yet.
#define IMPLEMENTS_VIRTUAL_SERIALIZABLE(class_name, base_class, NS)
This must be inserted as implementation of some required members for virtual CSerializable classes: ...
mrpt::img::TColorf diffuse
const mrpt::opengl::Program * shader
void allocate(const void *data, int byteCount)
Reserves byteCount bytes in the buffer and copy to it the provided data.
The base class of 3D objects that can be directly rendered through OpenGL.
const mrpt::opengl::TLightParameters * lights
mrpt::img::TColorf specular
Renderizable generic renderer for objects using the triangles shader.
void renderUpdateBuffers() const override
Called whenever m_outdatedBuffers is true: used to re-generate OpenGL vertex buffers, etc.
int attributeId(const char *name) const
Context for calls to render()
COpenGLVertexArrayObject m_vao
COpenGLBuffer m_trianglesBuffer
virtual void onUpdateBuffers_Triangles()=0
Must be implemented in derived classes to update the geometric entities to be drawn in "m_*_buffer" f...
bool hasUniform(const char *name) const
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::vector< mrpt::opengl::TTriangle > m_triangles
List of triangles.
mrpt::math::TVector3Df direction
Light direction (must be normalized)
The namespace for 3D scene representation and rendering.
void createOnce()
Calls create() only if the buffer has not been created yet.
int uniformId(const char *name) const
A resource handling helper for OpenGL Shader "programs".
virtual ~CRenderizableShaderTriangles() override
#define BUFFER_OFFSET(offset)
void render(const RenderContext &rc) const override
Implements the rendering of 3D objects in each class derived from CRenderizable.