summaryrefslogtreecommitdiffstats
path: root/tests/manual
diff options
context:
space:
mode:
authorJulian Thijssen <Nimthora@gmail.com>2016-07-27 15:45:31 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2017-01-23 11:34:05 +0000
commit7dc88b68904c7f1b7e012bd65ccdcbf48cc6e2e0 (patch)
tree6de47b86b99200b999eddd8de0f07c2e86d8e027 /tests/manual
parentda4b6c4774c0adf8dee5ee4a9a8d9d24967ede3c (diff)
Add support for OpenGL 3.2+ core profile contexts in QPainter
This change allows painting via QPainter onto a QOpenGLWindow, QOpenGLWidget or QOpenGLFramebufferObject when an core profile context is in use. This is important on macOS in particular, where compatibility profiles are not available, and so the only way to use modern OpenGL is via a core profile context. Added core profile compatible shaders with moder GLSL keywords. The paint engine binds a VAO and two VBOs from now on, whenever VAOs are supported. Note that this changes behavior also for OpenGL 2.x context that have VAO support via extensions. The Lancelot test suite gains support for core profile contexts. This can be triggered via -coreglbuffer in place of -glbuffer when manually inspecting via 'lance', while tst_lancelot will automatically run core context-based tests whenever supported. Task-number: QTBUG-33535 Change-Id: I6323a7ea2aaa9e111651ebbffd3e40259c8e7a9c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests/manual')
-rw-r--r--tests/manual/lance/main.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/manual/lance/main.cpp b/tests/manual/lance/main.cpp
index c1ace138f9..a8fa6bd402 100644
--- a/tests/manual/lance/main.cpp
+++ b/tests/manual/lance/main.cpp
@@ -91,6 +91,7 @@ static void printHelp()
#ifndef QT_NO_OPENGL
" -opengl Paints the files to a QGLWidget (Qt4 style) on screen\n"
" -glbuffer Paints the files to a QOpenGLFrameBufferObject (Qt5 style) \n"
+ " -coreglbuffer Paints the files to a Core Profile context QOpenGLFrameBufferObject\n"
#endif
#ifdef USE_CUSTOM_DEVICE
" -customdevice Paints the files to the custom paint device\n"
@@ -213,6 +214,7 @@ int main(int argc, char **argv)
#endif
DeviceType type = WidgetType;
+ QSurfaceFormat contextFormat;
bool checkers_background = true;
QImage::Format imageFormat = QImage::Format_ARGB32_Premultiplied;
@@ -281,6 +283,11 @@ int main(int argc, char **argv)
type = OpenGLType;
else if (option == "glbuffer")
type = OpenGLBufferType;
+ else if (option == "coreglbuffer") {
+ type = OpenGLBufferType;
+ contextFormat.setVersion(3, 2);
+ contextFormat.setProfile(QSurfaceFormat::CoreProfile);
+ }
#endif
#ifdef USE_CUSTOM_DEVICE
else if (option == "customdevice")
@@ -423,11 +430,13 @@ int main(int argc, char **argv)
{
QWindow win;
win.setSurfaceType(QSurface::OpenGLSurface);
+ win.setFormat(contextFormat);
win.create();
QOpenGLFramebufferObjectFormat fmt;
fmt.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
fmt.setSamples(4);
QOpenGLContext ctx;
+ ctx.setFormat(contextFormat);
ctx.create();
ctx.makeCurrent(&win);
QOpenGLFramebufferObject fbo(width, height, fmt);