Gazebo Gui

API Reference

9.0.0
EngineToQtInterface Class Reference

This class is in charge of delivering data to Qt in a format it can understand. More...

#include <EngineToQtInterface.hh>

Public Member Functions

 EngineToQtInterface (QOpenGLContext *_glContext)
 Constructor.
 
 ~EngineToQtInterface ()
 Destructor.
 
bool NeedsFallback (gz::rendering::CameraPtr &_camera)
 
GLuint TextureId (gz::rendering::CameraPtr &_camera)
 Returns the texture handle that Qt wants, whether it's the fallback or native one.
 

Detailed Description

This class is in charge of delivering data to Qt in a format it can understand.

Ideally, this is a simple call. e.g. if Qt wants an OpenGL texture handle, and we're rendering to a texture; we simply give Qt the texture handle (i.e. that's what gz::rendering::Camera::RenderTextureGLId does)

If Qt wants an OpenGL texture handle, and we're rendering to Metal, ask Metal to convert it to an OpenGL handle and give it that.

However there are cases where this isn's so straightforward, either because the API doesn't have an interface for converting handles between rendering systems, the underlying engine (i.e. Ogre) hasn't yet implemented it, or simply because there's a lot of driver bugs around it.

Or perhaps the Qt version being compiled against is too old and doesn't have support (e.g. Qt is too old to have a Vulkan renderer mode or it's buggy)

For all these cases, we use a fallback method where we download the data from GPU into CPU and then upload it again to GPU using Qt's OpenGL.

This is slow, but it's almost certain guaranteed to work. A warning will be issued once when fallback is used, as it has an important performance impact.

Constructor & Destructor Documentation

◆ EngineToQtInterface()

EngineToQtInterface ( QOpenGLContext *  _glContext)
explicit

Constructor.

◆ ~EngineToQtInterface()

Destructor.

Member Function Documentation

◆ NeedsFallback()

bool NeedsFallback ( gz::rendering::CameraPtr _camera)
Parameters
[in]_cameraCamera that wants to be rendered
Returns
False if memory is kept in the GPU and TextureId returns an API object. True if we must fallback to downloading data from GPU -> CPU and then uploading again CPU -> GPU using a different API (very slow)

◆ TextureId()

GLuint TextureId ( gz::rendering::CameraPtr _camera)

Returns the texture handle that Qt wants, whether it's the fallback or native one.

Parameters
[in]_cameraThe camera doing rendering that should be shown on Qt
Returns
Texture handle for Qt

The documentation for this class was generated from the following file: