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 287 auto where = strchr(extension,
' ');
288 if (where || *extension ==
'\0')
return 0;
294 auto start =
reinterpret_cast<const char*
>(extensions);
297 where = strstr(
start, extension);
299 auto terminator = where + strlen(extension);
300 if (where ==
start || *(where - 1) ==
' ')
301 if (*terminator ==
' ' || *terminator ==
'\0')
return 1;
GLAPI void GLAPIENTRY glDeleteTextures(GLsizei n, const GLuint *textures)
GLAPI void GLAPIENTRY glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
int isExtensionSupported(const char *extension)
Provide information on Framebuffer object extension.
GLAPI void GLAPIENTRY glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
#define THROW_EXCEPTION(msg)
void(GLAPIENTRY * PFNGLGENFRAMEBUFFERSEXTPROC)(GLsizei n, GLuint *framebuffers)
#define GL_TEXTURE_RECTANGLE_NV
void getFrame(const COpenGLScene &scene, mrpt::img::CImage &image)
Render the scene and get the rendered rgb image.
void(GLAPIENTRY * PFNGLDELETEFRAMEBUFFERSEXTPROC)(GLsizei n, const GLuint *framebuffers)
GLAPI void GLAPIENTRY glBindTexture(GLenum target, GLuint texture)
#define ASSERT_(f)
Defines an assertion mechanism.
#define ASSERT_EQUAL_(__A, __B)
Assert comparing two values, reporting their actual values upon failure.
CCamera & getCamera(const COpenGLScene &scene)
Get a reference to the scene camera.
virtual ~CFBORender()
Destructor.
#define glDeleteFramebuffersEXT
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 GL_COLOR_ATTACHMENT0_EXT
#define GL_TEXTURE_RECTANGLE_EXT
void getFrame2(const COpenGLScene &scene, mrpt::img::CImage &image)
Render the scene and get the rendered rgb image.
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)
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 setCamera(const COpenGLScene &scene, const CCamera &camera)
Change the scene camera.
void resize(unsigned int width, unsigned int height)
Resize the rendering canvas size.
GLAPI const GLubyte *GLAPIENTRY glGetString(GLenum name)
GLAPI void GLAPIENTRY glGenTextures(GLsizei n, GLuint *textures)
#define glFramebufferTexture2DEXT
#define glGenFramebuffersEXT
void render() const
Render this scene.
#define GL_FRAMEBUFFER_EXT
The namespace for 3D scene representation and rendering.
This class allows the user to create, load, save, and render 3D scenes using OpenGL primitives...
void(GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
#define glBindFramebufferEXT
#define GL_TEXTURE_RECTANGLE_ARB
mrpt::img::TColorf m_default_bk_color
A camera: if added to a scene, the viewpoint defined by this camera will be used instead of the camer...
GLenum GLsizei GLsizei height
void(GLAPIENTRY * PFNGLBINDFRAMEBUFFEREXTPROC)(GLenum target, GLuint framebuffer)
GLAPI void GLAPIENTRY glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
A class for storing images as grayscale or RGB bitmaps.
#define MRPT_UNUSED_PARAM(a)
Determines whether this is an X86 or AMD64 platform.