[Interest] Divining the opengl versions available

Michael Sué sue at sf.mpg.de
Mon May 23 09:42:51 CEST 2016


Hi, 

 

One important question maybe: Do you use this application via remote desktop and how do you start it?

 

On WINDOWS 7, there were some problems with OpenGL forwarding via remote desktop and there were differences between starting the application on the server and connect afterwards or connect via remote desktop ant start it there.

 

Maybe somethig got better by the way.

 

- Michael.

 

 

 

From: Interest [mailto:interest-bounces+sue=sf.mpg.de at qt-project.org] On Behalf Of Andy
Sent: Tuesday, May 17, 2016 2:26 PM
To: Boudewijn Rempt <boud at valdyas.org>; Qt Project <interest at qt-project.org>
Subject: Re: [Interest] Divining the opengl versions available

 

FWIW here's how I'm doing it.

I set the default format at startup with my requested format:

   void  initOpenGL()
   {
      QSurfaceFormat format;

      format.setVersion( 3, 3 );
      format.setProfile( QSurfaceFormat::CoreProfile );

      format.setDepthBufferSize( 24 );
      format.setSamples( 4 );
      format.setStencilBufferSize( 8 );

      QSurfaceFormat::setDefaultFormat( format );
   }

Then I call this to dump some info so I know what I'm getting:

   void  openGLInfo()
   {
      // we need a QSurface active to get our GL functions from the context
      QWindow  surface;
      surface.setSurfaceType( QSurface::OpenGLSurface );
      surface.create();

      QOpenGLContext context;
      context.create();
      context.makeCurrent( &surface );

      QOpenGLFunctions  *funcs = context.functions();
      funcs->initializeOpenGLFunctions();

      qInfo() << "OpenGL Info";
      qInfo() << "  Vendor: " << reinterpret_cast<const char *>(funcs->glGetString( GL_VENDOR ));
      qInfo() << "  Renderer: " << reinterpret_cast<const char *>(funcs->glGetString( GL_RENDERER ));
      qInfo() << "  Version: " << reinterpret_cast<const char *>(funcs->glGetString( GL_VERSION ));
      qInfo() << "  Shading language: " << reinterpret_cast<const char *>(funcs->glGetString( GL_SHADING_LANGUAGE_VERSION ));
      qInfo() << "  Requested format: " << QSurfaceFormat::defaultFormat();
      qInfo() << "  Current format:   " << context.format();
   }

Which gives me something like this:

OpenGL Info
  Vendor:  NVIDIA Corporation
  Renderer:  NVIDIA GeForce GTX 780M OpenGL Engine
  Version:  4.1 NVIDIA-10.4.2 310.41.35f01
  Shading language:  4.10
  Requested format:  QSurfaceFormat(version 3.3, options QFlags(), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 8, samples 4, swapBehavior 0, swapInterval 1, profile  1)
  Current format:    QSurfaceFormat(version 4.1, options QFlags(), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize -1, stencilBufferSize 8, samples 4, swapBehavior 2, swapInterval 1, profile  1)


(Note: This only gives me a 3.0 context on VMware Fusion 8.1 running Windows 7 - should support 3.3 - so maybe I'm doing something wrong?)

If anyone has any suggestions for improvement it would be most welcome!





---
Andy Maloney  //  https://asmaloney.com

twitter ~ @asmaloney <https://twitter.com/asmaloney> 

 

 

On Tue, May 17, 2016 at 4:05 AM, Giuseppe D'Angelo <dangelog at gmail.com <mailto:dangelog at gmail.com> > wrote:

On Tue, May 17, 2016 at 9:59 AM, Boudewijn Rempt <boud at valdyas.org <mailto:boud at valdyas.org> > wrote:
> Hm... But when I tried that with a nonsense version, say 9.9, I
> got 9.9 back. Maybe I made a mistake, though. I copied the functions
> check approach from the tesselation example from KDab's website...

Did you _create_ the context or just set a format and asked for it
back immediately?

Using the functions for just testing whether you've got a certain GL
version seems to me to be doing it the other way around. Then, sure,
once you're happy with the version you need to grab them and use them.

--
Giuseppe D'Angelo

_______________________________________________
Interest mailing list
Interest at qt-project.org <mailto:Interest at qt-project.org> 
http://lists.qt-project.org/mailman/listinfo/interest

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160523/386a74aa/attachment.html>


More information about the Interest mailing list