Combine Ogre-Next on qt with others QOpenGLWidget on same iu.

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


promero
Gnoblar
Posts: 1
Joined: Sun Apr 27, 2025 6:05 pm

Combine Ogre-Next on qt with others QOpenGLWidget on same iu.

Post by promero »

Hi,

I try to embed Ogre-next on Qt6 ( using opengl ). Everything works fine if any QOpenGLWidget are present and ogre-next is the only one.

I have generated a class with ogrenext functions that can work passing wId from a QOpenGLWidget and it is posible to render from ogre to this qwidget, others QOpenGLWidget are present too.

The main problem is that I can't control the paintgl function and if I use makecurrent I get a black screen over ogre, If I don't use it, I can see ogre-next rendering ( using Qtimer ) but as soon as I focus on another QOpenGLWidget , ogre-next render became black.

I guess problem is because ogre use internal openglcontext and Qt others..

I have checked the possibility to use "externalGLControl","currentGLContext","externalGLContext" without sucess.

To resume: i wantot use ogre-next inside Qt6, working with opengl together with others QOpenGLWidget ,and if it is posible to share textures between them, generating a texture on a QOpenGLWidget , and using the texture on ogre using the textureID.

Is it posible, or I will have to use ogre ( no next ) to work together with Qt ??

I would apreciate some ideas about it

Thanks !!!

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5494
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1365

Re: Combine Ogre-Next on qt with others QOpenGLWidget on same iu.

Post by dark_sylinc »

Getting two libraries using OpenGL at the same time and cooperate can be tricky, but not impossible.
See how Gazebo does it which uses both Ogre-Next and Qt6.

Gazebo creates a dummy 1x1 window that is hidden, acts as the "main" window and remains available for the lifetime of the application. This makes it easier to work with Qt if you need more than one window.