23 CFBORender::CFBORender(
24 unsigned int width,
unsigned int height,
const bool skip_glut_window)
27 m_win_used(!skip_glut_window),
28 m_default_bk_color(.6f, .6f, .6f, 1)
30 #if MRPT_HAS_OPENCV && MRPT_HAS_OPENGL_GLUT
37 if (!glutGet(GLUT_INIT_STATE))
41 char* argv[1] = {
nullptr};
42 glutInit(&argc, argv);
46 m_win = glutCreateWindow(
"CFBORender");
59 "glDeleteFramebuffersEXT");
64 "glFramebufferTexture2DEXT");
86 #if defined(GL_TEXTURE_RECTANGLE_NV)
88 #elif defined(GL_TEXTURE_RECTANGLE_ARB)
120 #if MRPT_HAS_OPENGL_GLUT
158 #if MRPT_HAS_OPENCV && MRPT_HAS_OPENGL_GLUT
165 buffer.getChannelCount() != 3 ||
buffer.isOriginTopLeft() !=
false)
187 #if MRPT_HAS_OPENGL_GLUT
233 #if MRPT_HAS_OPENCV && MRPT_HAS_OPENGL_GLUT
249 #if defined(GL_TEXTURE_RECTANGLE_NV)
251 #elif defined(GL_TEXTURE_RECTANGLE_ARB)
282 #if MRPT_HAS_OPENGL_GLUT
286 const GLubyte* extensions =
nullptr;
291 where = (
GLubyte*)strchr(extension,
' ');
292 if (where || *extension ==
'\0')
return 0;
301 where = (
GLubyte*)strstr((
const char*)
start, extension);
303 terminator = where + strlen(extension);
304 if (where ==
start || *(where - 1) ==
' ')
305 if (*terminator ==
' ' || *terminator ==
'\0')
return 1;
A class for storing images as grayscale or RGB bitmaps.
A camera: if added to a scene, the viewpoint defined by this camera will be used instead of the camer...
CCamera & getCamera(const COpenGLScene &scene)
Get a reference to the scene camera.
virtual ~CFBORender()
Destructor.
mrpt::img::TColorf m_default_bk_color
void getFrame(const COpenGLScene &scene, mrpt::img::CImage &image)
Render the scene and get the rendered rgb image.
void resize(unsigned int width, unsigned int height)
Resize the rendering canvas size.
void setCamera(const COpenGLScene &scene, const CCamera &camera)
Change the scene camera.
int isExtensionSupported(const char *extension)
Provide information on Framebuffer object extension.
void getFrame2(const COpenGLScene &scene, mrpt::img::CImage &image)
Render the scene and get the rendered rgb image.
This class allows the user to create, load, save, and render 3D scenes using OpenGL primitives.
COpenGLViewport::Ptr getViewport(const std::string &viewportName=std::string("main")) const
Returns the viewport with the given name, or nullptr if it does not exist; note that the default view...
void render() const
Render this scene.
void render_text_messages(const int w, const int h) const
Renders the messages to the current opengl rendering context (to be called OUT of MRPT mrpt::opengl r...
#define MRPT_UNUSED_PARAM(a)
Determines whether this is an X86 or AMD64 platform.
#define ASSERT_EQUAL_(__A, __B)
Assert comparing two values, reporting their actual values upon failure.
#define ASSERT_(f)
Defines an assertion mechanism.
#define THROW_EXCEPTION(msg)
#define glDeleteFramebuffersEXT
GLAPI void GLAPIENTRY glDeleteTextures(GLsizei n, const GLuint *textures)
#define GL_COLOR_ATTACHMENT0_EXT
void(GLAPIENTRY * PFNGLDELETEFRAMEBUFFERSEXTPROC)(GLsizei n, const GLuint *framebuffers)
#define glBindFramebufferEXT
void(GLAPIENTRY * PFNGLGENFRAMEBUFFERSEXTPROC)(GLsizei n, GLuint *framebuffers)
void(GLAPIENTRY * PFNGLBINDFRAMEBUFFEREXTPROC)(GLenum target, GLuint framebuffer)
#define glGenFramebuffersEXT
#define GL_TEXTURE_RECTANGLE_NV
#define GL_TEXTURE_RECTANGLE_EXT
GLAPI void GLAPIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
GLAPI void GLAPIENTRY glBindTexture(GLenum target, GLuint texture)
GLAPI void GLAPIENTRY glGenTextures(GLsizei n, GLuint *textures)
#define glFramebufferTexture2DEXT
GLAPI void GLAPIENTRY glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
#define GL_TEXTURE_RECTANGLE_ARB
GLAPI void GLAPIENTRY glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
#define GL_FRAMEBUFFER_EXT
GLAPI const GLubyte *GLAPIENTRY glGetString(GLenum name)
GLAPI void GLAPIENTRY glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
void(GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
GLenum GLsizei GLsizei height
The namespace for 3D scene representation and rendering.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.