[Interest] OpenGL: Setting samples on default QSurfaceFormat

Sean Harmer sh at theharmers.co.uk
Wed Sep 19 10:27:56 CEST 2018


Hi Andy,

In your main, set up the desired QSurfaceFormat, use it to try to create 
a context, and check the results. If that works great, destroy it and 
carry on with that as the default surface format. Otherwise, drop down a 
level and try again until you find a surface format that works.

Cheers,

Sean


On 17/09/2018 17:57, Andy wrote:
> I seem to have a catch-22.
>
> - QSurfaceFormat::setDefaultFormat() needs to be called before 
> application construction.
>
> - I want multisampling on a 3.3 context by default, so I need to call 
> QSurfaceFormat::setSamples().
>
> - I can't know how many samples are supported until after application 
> construction by actually creating a context and asking how many it 
> supports. (Or can I somehow?)
>
> - If I just setSamples() to the number I want (8) and call 
> setDefaultFormat, then any card/driver that doesn't support that many 
> samples fails to be created and I end up with a 2.0 default context.
>
> Any ideas?
>
> ---
> Andy Maloney  // https://asmaloney.com
> twitter ~ @asmaloney <https://twitter.com/asmaloney>
>
>
>
> _______________________________________________
> Interest mailing list
> 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/20180919/2dfdc4ed/attachment.html>


More information about the Interest mailing list