32 #if MRPT_HAS_OPENGL_GLUT 33 #ifdef MRPT_OS_WINDOWS 35 #if defined(_MSC_VER) || defined(__BORLANDC__) 36 #pragma comment (lib,"opengl32.lib") 37 #pragma comment (lib,"GlU32.lib") 39 #endif // MRPT_OS_WINDOWS 40 #endif // MRPT_HAS_OPENGL_GLUT 52 createViewport(
"main");
79 if (createMainViewport)
106 #if MRPT_HAS_OPENGL_GLUT 112 (*it)->render( win_dims[2],win_dims[3] );
115 glViewport( win_dims[0],win_dims[1],win_dims[2],win_dims[3] );
118 THROW_EXCEPTION(
"The MRPT has been compiled with MRPT_HAS_OPENGL_GLUT=0! OpenGL functions are not implemented");
162 view->m_objects.resize(
n);
177 CSerializablePtr newObj;
180 COpenGLViewportPtr newView = COpenGLViewportPtr(newObj);
181 newView->m_parent =
this;
200 if ((*it)->m_name == viewportName )
202 (*it)->insert(newObject);
216 CRenderizablePtr
obj;
218 if ( (
obj = (*it)->getByName(str) ).present() )
229 (*it)->initializeAllTextures();
241 lst.
add(
string(
"VIEWPORT: ")+ (*it)->m_name );
242 lst.
add(
"============================================");
243 (*it)->dumpListOfObjects(lst);
256 COpenGLViewportPtr old =
getViewport(viewportName);
260 COpenGLViewportPtr theNew = COpenGLViewportPtr(
new COpenGLViewport(
this, viewportName) );
274 if ( (*it)->m_name == viewportName)
276 return COpenGLViewportPtr();
288 COpenGLViewportPtr view =
getViewport(viewportName);
290 view->removeObject(
obj);
299 const COpenGLViewportPtr &vp=*it;
304 }
else if (tmp<dist) dist=tmp;
317 catch (...) {
return false; }
326 catch (...) {
return false; }
334 ASSERTMSG_(vp.present(),
"No opengl viewport exists with the given name")
336 return vp->getBoundingBox(bb_min, bb_max);
virtual ~COpenGLScene()
Destructor:
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
COpenGLScene()
Constructor.
The virtual base class which provides a unified interface for all persistent objects in MRPT...
void readFromStream(mrpt::utils::CStream &in, int version)
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
#define THROW_EXCEPTION(msg)
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const
Traces a ray.
const Scalar * const_iterator
IMPLEMENTS_SERIALIZABLE(CLogFileRecord_FullEval, CHolonomicLogFileRecord, mrpt::nav) IMPLEMENTS_SERIALIZABLE(CHolonomicFullEval
GLsizei GLsizei GLuint * obj
A viewport within a COpenGLScene, containing a set of OpenGL objects to render.
void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max, const std::string &vpn=std::string("main")) const
Evaluates the bounding box of the scene in the given viewport (default: "main").
void initializeAllTextures()
Initializes all textures in the scene (See opengl::CTexturedPlane::loadTextureInOpenGL) ...
A renderizable object suitable for rendering with OpenGL's display lists.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
A class for storing a list of text lines.
This base provides a set of functions for maths stuff.
void insert(const CRenderizablePtr &newObject, const std::string &viewportName=std::string("main"))
Insert a new object into the scene, in the given viewport (by default, into the "main" viewport)...
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
void removeObject(const CRenderizablePtr &obj, const std::string &viewportName=std::string("main"))
Removes the given object from the scene (it also deletes the object to free its memory).
void clear()
Clear the whole list.
void clear(bool createMainViewport=true)
Clear the list of objects and viewports in the scene, deleting objects' memory, and leaving just the ...
COpenGLViewportPtr getViewport(const std::string &viewportName=std::string("main")) const
Returns the viewport with the given name, or NULL if it does not exist; note that the default viewpor...
GLsizei const GLchar ** string
bool saveToFile(const std::string &fil) const
Saves the scene to a 3Dscene file, loadable by the application SceneViewer3D.
TListViewports m_viewports
The list of viewports, indexed by name.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
GLAPI void GLAPIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
COpenGLViewportPtr createViewport(const std::string &viewportName)
Creates a new viewport, adding it to the scene and returning a pointer to the new object...
#define CFileGZOutputStream
Saves data to a file and transparently compress the data using the given compression level...
bool loadFromFile(const std::string &fil)
Loads the scene from a 3Dscene file, the format used by the application SceneViewer3D.
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
CRenderizablePtr getByName(const std::string &str, const std::string &viewportName=std::string("main"))
Returns the first object with a given name, or NULL (an empty smart pointer) if not found...
COpenGLScene & operator=(const COpenGLScene &obj)
Copy operator:
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
GLAPI void GLAPIENTRY glGetIntegerv(GLenum pname, GLint *params)
void render() const
Render this scene.
The namespace for 3D scene representation and rendering.
This class allows the user to create, load, save, and render 3D scenes using OpenGL primitives...
unsigned __int32 uint32_t
#define ASSERTMSG_(f, __ERROR_MSG)
void dumpListOfObjects(mrpt::utils::CStringList &lst)
Retrieves a list of all objects in text form.
void add(const std::string &str)
Appends a new string at the end of the string list.