QT OpenGL support
Original Reporter info from Mantis: crlab @neurolabusc1
-
Reporter name: Chris Rorden
Original Reporter info from Mantis: crlab @neurolabusc1
- Reporter name: Chris Rorden
Description:
Zeljko recently added updated GLGtkGlxContext to support QT5 (instead of just QT4). However, the current GLGtkGlxContext has two limitations:
1. It ignores the TOpenGLContext MajorVersion and MinorVersion, so it does not support more recent versions of OpenGL.
2. It ignores TOpenGLContext.Multisampling, so lines look jagged.
I have attached a patch that fixes issue 1: this will allow QT to support modern versions of OpenGL. The code includes the compiler switch
{$DEFINE ModernGL}
if this line is commented out, you can see the previous behavior. Note that with this line commented out you will be limited to an old version of OpenGL (on my Linux QT4 setup, I am limited to OpenGL 3.0 without this patch), with the patch I get the most recent version supported by my hardware (4.6).
This patch does not appear to fix issue 2. I did copy much of the boilerplate from glgtkglxcontext.pas for supporting multisampling, and the new code does appear to identify a BestFBConfig that supports multisampling, but there must be some other adjustment to enable multisampling.
Steps to reproduce:
See attached project
1.) Without this patch, when compiled to QT4/5 the caption reports "OpenGL 3.0" with the patch it supports the version supported by your system. Likewise, if you compile to GTK2 it uses the most recent version. Note that this project only uses OpenGL 3.0 so it runs with or without the patch, but projects that use more recent features only work with this patch.
2.) Note that the lines look jagged when you compile to the QT widgetset, but look smooth when compiled to GTK2 (as the project uses multisampling).