FLTK logo

[fltk.general] Porting a Qt application that uses QOffscreenSurface and QOpenGLContext

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Porting a Qt application that uses QOffscreenSurface and QOpenGLContext Gonzalo Garramuno Sep 14, 2022  
 
I find myself porting a Qt application that uses QOffscreenSurface and QOpenGLContext to draw opengl 4.1 graphics onto a separate thread that has no window. 
The QOpenGLContext class seems like it provides the gl context, with the following code at the constructor:

Constructor::
{
            glContext = new QOpenGLContext;
            QSurfaceFormat surfaceFormat;
            surfaceFormat.setMajorVersion(4);
            surfaceFormat.setMinorVersion(1);
            surfaceFormat.setProfile(QSurfaceFormat::CoreProfile);
            glContext->setFormat(surfaceFormat);
            glContext->create();

            offscreenSurface = new QOffscreenSurface;
            offscreenSurface->setFormat(glContext->format());
            offscreenSurface->create();
}

The thread when running (no draw() function, just a normal function) calls:

void class::run()
{
            glContext->makeCurrent( offscreenSurface.get() );
	   // other GL drawing code
}

The QOffscreenSurface I gather is the equivalent to Fl_Image_Surface in FLTK, but I don’t have a clue what would be equivalent to QOpenGLContext.  Does FLTK offer a GL context class?



—
Gonzalo Garramuno
ggarra13@gmail.com




-- 
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/D572F918-3BD6-4575-B9FE-974743582F75%40gmail.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.