Go to the documentation of this file.
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);
A resource handling helper for OpenGL Shader "programs".
virtual void onUpdateBuffers_Triangles()=0
Must be implemented in derived classes to update the geometric entities to be drawn in "m_*_buffer" f...
const mrpt::opengl::Program * shader
void render(const RenderContext &rc) const override
Implements the rendering of 3D objects in each class derived from CRenderizable.
void createOnce()
Calls create() only if the buffer has not been created yet.
The base class of 3D objects that can be directly rendered through OpenGL.
COpenGLBuffer m_trianglesBuffer
std::vector< mrpt::opengl::TTriangle > m_triangles
List of triangles.
void allocate(const void *data, int byteCount)
Reserves byteCount bytes in the buffer and copy to it the provided data.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
COpenGLVertexArrayObject m_vao
#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 ambient
void createOnce()
Calls create() only if the buffer has not been created yet.
int attributeId(const char *name) const
mrpt::img::TColorf diffuse
virtual ~CRenderizableShaderTriangles() override
int uniformId(const char *name) const
Context for calls to render()
mrpt::img::TColorf specular
#define BUFFER_OFFSET(offset)
void renderUpdateBuffers() const override
Called whenever m_outdatedBuffers is true: used to re-generate OpenGL vertex buffers,...
const mrpt::opengl::TLightParameters * lights
Renderizable generic renderer for objects using the triangles shader.
mrpt::math::TVector3Df direction
Light direction (must be normalized)
bool hasUniform(const char *name) const
The namespace for 3D scene representation and rendering.
Page generated by Doxygen 1.8.17 for MRPT 2.0.4 at Sun Jul 19 15:15:43 UTC 2020 | |