Blurred Qt Quick Text - windows

This is an example from Qt Quick examples inside Qt Creator, when I run the project all texts lost their quality and blurred, the attached picture describes clearly the problem.
Qt Version: 5.4.1
Platform: Windows 7

It is an old bug that may be reproduced on some hardware when Qt uses system OpenGL capabilities "[QTBUG-31983] Font rendering on Windows XP shows artifacts with QML Text element"
Before Qt version 5.5 there are two types of Qt releases for Windows: ANGLE and OpenGL. They can be distinguished by the suffix "opengl" in the installer file name, for example:
qt-opensource-windows-x86-msvc2013_opengl-5.4.1.exe
qt-opensource-windows-x86-msvc2013-5.4.1.exe
See "Qt 5 on Windows ANGLE and OpenGL" for the explanation.
The ANGLE build does not have such defect. Only OpenGL build is affected. OpenGL is poorly supported by default on many Windows installations. In some cases it can just crash during QML window initialization. The manual video driver installation was required. However, for some old hardware it is a problem to find such good video card driver that have enough support for OpenGL.
Possible solutions:
Use ANGLE Qt build
It is possible to subclass the standard QML Text control with default render type Text.NativeRendering:
Text { renderType: Text.NativeRendering; }
ANGLE Qt build could be a good solution if Windows XP should not be supported.
If no intensive graphics usage is required the better solution is to use software OpenGL rendering. Before Qt 5.4 it is was possible to use MSYS Mesa library opengl32.dll (only some specific version should be used). If such library is placed in the executable folder of Qt application built with OpenGL Qt version, that library is automatically used for software rendering instead of default hardware rendering. Starting from Qt 5.4 such library is provided by Qt: opengl32sw.dll (http://doc.qt.io/qt-5/windows-requirements.html).
The software OpenGL emulation works perfectly on all types of hardware and it does not require any special video card driver.
Starting from Qt 5.4 there is the application attribute Qt::AA_UseSoftwareOpenGL:
Forces the usage of a software based OpenGL implementation on
platforms that use dynamic loading of the OpenGL implementation. This
will typically be a patched build of Mesa llvmpipe, providing OpenGL
2.1. The value may have no effect if no such OpenGL implementation is available. The default name of this library is opengl32sw.dll and can
be overridden by setting the environment variable QT_OPENGL_DLL. See
the platform-specific pages, for instance Qt for Windows, for more
information. This value has been added in Qt 5.4.

This happened to my QT 5.4.2 MinGW project as well. Using Text.NativeRendering solved the blurry text in my case.

This renders the font with native rendering. But not solves the problem with default Qt rendering.
import QtQuick 2.4
import QtQuick.Window 2.0
Window {
visible: true
width: 512
height: 300
Text {
anchors.centerIn: parent
text: "Hello World!"
renderType: Text.NativeRendering
}
}

Related

OpenGl without compatible graphics card?

Basically I have a windows system that does not have a graphics card, and I am trying to execute a .jar file in cmd, which gives the following output:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\shattered>java -jar test.jar
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: OpenGL is not supported by the video driver.
I am only somewhat tech literate but the takeaway I got from that was that I needed to get OpenGl. So I did some research and found a few mentions of OpenGl software mode or something but I have no idea of how to go about doing so. Any help would be greatly appreciated, cheers!
And before it is mentioned, I have tried updating the video driver.
First on the "what":
OpenGL is a application programming interface (API) between the graphics facilities of the operating system (which in broad term covers everything between putting windows to the screen down to placing single pixels) and individual programs. The main purpose of OpenGL is providing access to accelerated graphics infrastructure optimized for rasterizing graphics primitives most suitable for 3D image generation.
Now to the "how":
The typical OpenGL implementation ships as part of the drivers of 3D graphics accelerator processors (GPUs). However since (a very old) version of OpenGL, namely OpenGL-1.1, has been specified as part of the Win32 API every version of Windows since Windows 95B and Windows NT-4 includes a fallback software implementation that can be used in case no accelerated OpenGL version is available. However if any version beyond OpenGL-1.1 is required this fallback does not provide it.
However you can substitute the standard OpenGL interface with an advanced software rasterizer implementation: The Mesa project provides a version of their software rasterizer that provides even modern core profile OpenGL. The usual recommendation is to place these substitute opengl32.dll besides the .exe file of the program that requires it; in fact on modern Windows systems with system file protection it's actually impossible to replace the original DLLs without jumping a few hoops. The MSys2 project offers prebuilt versions of substitute DLLs.
Current (as of writing this):
64 Bit version: https://sourceforge.net/projects/msys2/files/REPOS/MINGW/x86_64/mingw-w64-x86_64-mesa-17.0.0-1-any.pkg.tar.xz/download
32 Bit version: https://sourceforge.net/projects/msys2/files/REPOS/MINGW/i686/mingw-w64-i686-mesa-17.0.0-1-any.pkg.tar.xz/download
XZ archives can be unpacked with 7-zip.
Default VGA/VESA driver is also used for gfx card without propper driver. Such cards usually emulate EGA/VGA/VESA until initialized so windows default driver works for them.
So during boot freeze the screen and look at the PID/VID table of installed devices. from that numbers you can detect which gfx card you really have and look for drivers.
In rare case you really got just EGA/VGA/VESA (which I doubt) in the old MS-DOS times there were OpenGL software drivers even for those. What you need is find OpebGL DLL for your platform like (opengl32.dll) and place it either directly to your executable or into known path like system32 ... In such case you should get at least OpenGL 1.0 support in SW rendering mode
btw if my memory serves well in the old times of win3.11 and win9x this OpenGL32.dll was a part of windows instalation and we got the OpenGL screen savers running on VESA cards natively.

Unable to link OpenGL compatibility profile (EXT symbols not recognized)

I decided to use GLEW for handling extensions instead of requesting core profile and having to migrate my code.
I would like to add support for FBO's through the EXT profile as a first step.
The problem is gcc will not link my code (OSX 10.10), it does not recognize any gl*EXT() functions. For instance, glBindFrameBufferEXT()
flags as undefined symbol. (glBindFrameBuffer() was also
unrecognized...)
I link against GLEW and have tried using GLEXT or GLFW with compatibility profile, but nothing works! Am I missing a library? How do I tell gcc to use the right GL profile? Am I obliged to migrate to core profile?
In MacOS X GLEW is not doing a lot, because there are not a lot of OpenGL extensions on MacOS X and due to the way OpenGL is integrated in MacOS X all functions of the OpenGL version supported by the available framework are immediately available
… or not, if you're using an extension function that's not supported by MacOS X's OpenGL implementation.
MacOS X is the weird duckling in the OpenGL family: OpenGL is used at a very low level in the OS's core graphics routines, to OpenGL is very well supported by the OS. But it's built so deep into the OS that it hardly can be updated without updating the whole OS.
Solution: Don't use that extension. FBOs have been introduced with OpenGL-3.3 so you've to create a 3.3 core profile context and can use the functions (without the …EXT) directly.

Deploying Qt5 on Windows without Hardware Acceleration

Qt5 can use the OpenGL driver or the DirectX Driver by using ANGLE. As we cannot depend on an installed OpenGL driver, we need to use the ANGLE backend. Unfortunately, this doesn't solve all deployment problems especially on Windows virtual machines without hardware acceleration. On these systems, we're getting an error message saying that the creation of an OpenGL context failed.
Screenshot: Failed to create OpenGL context for format QSurfaceFormat
We're deploying all required libraries (libEGL.dll libGLESv2.dll libeay32.dll msvcp110.dll msvcr110.dll d3dcompiler_46.dll) but we're still getting this error message.
How do you deploy a QML application that needs to run on end user machines without OpenGL driver and on (virtual) machines without Direct3D Acceleration?
There is a page on the Qt wiki mentioning this problem, but that's not very helpful for solving it.
Update for Qt 5.4.0:
My findings so far are:
Setting QT_ANGLE_PLATFORM=warp -> creates a windows without content.
Setting QT_ANGLE_PLATFORM=d3d9 -> same error dialog, as expected.
Setting QT_ANGLE_PLATFORM=d3d11 -> same error dialog, as expected.
Setting QT_OPENGL=desktop -> same as QT_ANGLE_PLATFORM=warp.
Setting QT_OPENGL=angle -> same error dialog, as expected.
Setting QT_OPENGL=software + opengl32sw.dll (mesa for windows) -> unpredictable: May run, may crash, may show the error dialog.
Update for Qt Quick 2D Renderer
Although, Mesa seems to be a partial solution, the configration seems to be very crash often in Qt 5.4.0 .
Another fallback could be the Qt Quick 2D Renderer, but unfortunately this crashes too.
Copying softwarecontext.dll into /scenegraph + Setting QMLSCENE_DEVICE=softwarecontext -> crash
Update after some user experience:
Angle
Has some render bugs on some systems
Does not work reliable on all systems
Angle with Warp
Not reliable
Desktop OpenGL
The default implements OpenGL 1.1, which is too old.
Not reliable, even if the OpenGL version is ok.
Has render bugs, if used by Qt
QtQuick2dRenderer
Has some major render issues
Crashes, Freezes
Works on systems without HW acceleration
Mesa OpenGL Backend
Seems to be quite reliable at the moment
quite slow in general, very slow on some systems.
Heavy Deployment weight
Conclusion: there is still no real solution for these systems
Update for Qt 5.5
Anno 2015: Broken graphics drives are still broken.
My conclusion for the moment is:
Use QtQuick2dRenderer if possible.
Use Mesa backend otherwise.
Skip Angle, skip Desktop OpenGL, skip Warp.
QT 5 has huge compatibility issue with opengl on some hardware configurations
Combination of Intel HD3000 driver and Nvidia/ATI card won't work on Windows 10.
https://bugreports.qt.io/browse/QTBUG-42240
Intel drops support for this card but their drivers has bug that leads to crash.
You cannot rely on hardware opengl if you want to support customers with HD3000.
Under Windows, opengl32.dll is the default OpenGL driver. It implements OpenGL 1.1 (really old version).
ANGLE has a baseline of OpenGL ES 2.0 and needs DirectX 9/11 installed to map the calls into.
So if you got a video card that doesn't have an OpenGL driver installed, an OpenGL driver less than 2.0, and/or DirectX 9/11 not installed, your app is not going to work.
In regards to virtualization and 3D acceleration, these maybe worth a read:
Why does Qt Creator 3.0.0 Welcome Mode not work in VM?
https://bugreports.qt.io/browse/QTBUG-34964
Also, if you run a multi monitor Windows environment under VirtualBox, 3d acceleration will be disabled.
I re-checked this to see if these problems have been fixed by the latest release of QT 5.12.2, but no they have not. The function described in the QT wiki entry OP referenced
https://wiki.qt.io/Qt_5_on_Windows_ANGLE_and_OpenGL sounds good but in practice it simply doesn't work.
I conclude avoid OpenGL on QT in any form. It's just too unreliable.

QtOpenGL and MacOS X -- Software rendering?

I'm developing a cross-platform application and am not very familiar with the Mac platform. I use Qt for the GUI. I use a QGLWidget to make sure the drawing (with QPainter) is done in OpenGL.
My project built fine in XCode and runs. However, drawing is slow as hell, in situations where on Windows and Linux machines speed is not an issue. The Macbook has an Nvidia GPU, whereas the Windows machine has only onboard intel graphics.
When I look at the binary, it seems that while linking to QtOpenGL lib, it does not explicitely link to the GL lib itself.
How can I test if hardware acceleration is working or software fallback rendering is doing the job?
Shouldn't my binary link to the GL lib, or is this hidden as being a recursive dependency?
The best way to see what OpenGL implementation is using is to print the value of glGetString(GL_VENDOR) and glGetString(GL_RENDERER), this should help pinpoint the problem.

Update OpenGL libraries on windows

I'm using a 3rd party DLL which uses OpenGL. Right now that 3rd party does not work correctly as the display does not refresh correctly. I came to suspect that the OpenGL library isn't correctly installed or may be outdated.
Is there a way to update the OpenGL library on windows? Is there like an official site which will hold the correct opengl.dll file or something like that?
I believe the OpenGL libraries are just part of the drivers that ship with your graphics card. Upgrading your graphics drivers should upgrade your OpenGL stuff to the latest your card supports.
OpenGL should be up to date on Windows.
However, if you are getting display/refresh problems, and they're only occuring on windows, this is most likely an issue with your graphics driver.
Try updating to your latest OpenGL graphics driver. This fixes many OpenGL issues on Windows.
opengl.dll is part of your display card driver. Windows comes with a default opengl.dll that offers very little acceleration. Re installing the graphics card driver or upgrading to the latest version should take care of your problem.
OpenGL is implemented in the graphics driver. If you want to use the latest OpenGL version as a developer you download and use GLEW (http://glew.sourceforge.net/) as a normal library. This will give you access to cross platform OpenGL 4.1 or whatever version your card supports.

Resources