Sign Up

Have an account? Sign In Now

Sign In

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Sign InSign Up

Softans

Softans Logo Softans Logo
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
Home/ Questions/Q 1280
In Process
Ghulam Nabi
Ghulam Nabi
Asked: January 27, 20222022-01-27T09:29:18+00:00 2022-01-27T09:29:18+00:00

How to ANGLE in Qt 6 OpenGL

Qt 6 has removed the support for ANGLE for their OpenGL backend. Now I would still like to use ANGLE with Qt because I would like to run custom OpenGL code that is translated by ANGLE to Vulkan Linux and Direct3D on Windows. I’ve tried to use ANGLE in my Qt 6 application, but without success. What I have tried is:

Build ANGLE from source files (on Linux) as per instructions (ANGLE build instructions).

Copied the generated libGLESv2.so and libEGL.so files into application directory. Then in my CMakeFiles.txt I have added:

find_library(libGLESv2 GLESv2)
find_library(libEGL EGL)
target_link_libraries(MyApp PRIVATE ${libGLESv2} ${libEGL})

Then in my main file I have added

QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);
QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);

My project links and builds fine, but the ANGLE backend seems to have no effect. It appears that Qt is still using the standard OpenGL implementation rather than the one provided by ANGLE (running QOpenGLContext::currentContext()->hasExtension("EGL_ANGLE_platform_angle") returns false when I set up my context).

Using QT_LOGGING_RULES=qt.qpa.gl=true,the logs show:

qt.qpa.gl: Choosing xcb gl-integration based on following priority (“xcb_glx”, “xcb_egl”) qt.qpa.gl: Xcb GLX gl-integration created qt.qpa.gl: Xcb GLX gl-integration successfully initialized qt.qpa.gl: Requested format before FBConfig/Visual selection: QSurfaceFormat(version 3.0, options QFlagsQSurfaceFormat::FormatOption(), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize -1, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile QSurfaceFormat::NoProfile)

How can I correctly setup Qt to rely on ANGLE?

anglec++openglqt 6
  • 0
  • 1 1 Answer
  • 85 Views
  • 0 Followers
  • 0
Answer
Share
  • Facebook
  • Report

1 Answer

  • Voted
  • Oldest
  • Recent
  1. Ghulam Nabi
    2022-01-30T07:36:38+00:00Added an answer on January 30, 2022 at 7:36 am

    When I asked for a buildable project that reproduces the problem I didn’t mean a snippet of source without the CMakeLists.txt that is causing the problem. I spent a good 4 hours trying to duplicate your environment blind. Nobody uses Qt 6 because it is horrible.

    The first problem is you can’t “just copy” libs. GLES libs GLES before copy

    EGL libs GLS libs before copy

    After copy

    enter image description here

    the build and runtime system wants its series of links. When you copy you loose that because you get multiple copies of the same file rather than one copy with a bunch of links. If you are going to use these libraries you need to use them from an installed location or the original build location.

    I wanted to prove this solution to you rather than just tell you, but I ran into the same problem 98.5% of all developers run into when anything Android is installed near Qt.

    I wanted you to look at the CMakeLists.txt file for WaylandGUI not because it is some shining example of wonderful, rather so you see how to use message() to dump your cmake variables. This is the “default debugger” when troubleshooting cmake issues.

    You aren’t properly using find_library()

    https://cmake.org/cmake/help/latest/command/find_library.html

    Had you installed the ANGLE library you built there is a 50/50 chance find_library would have found it. One would need to dump the cmake variables to see where it looked and what it found and to do that you need message().

    In particular read up on CMAKE_PREFIX_PATH and the PATHS option for find_library(). If the documentation seems clear as mud you can view this SO discussion on CMAKE_PREFIX_PATH.

    cmake – find_library – custom library location

    The other command you need to know is ldd. It’s really shocking how many people developing on Linux that don’t know this command.

    ldd of an example program

    What ldd does, from a high conceptual level, is tell you every library the loader is going to use when running your executable, at least from an initial load standpoint. The executable itself may be able to force load other libraries at run time. When an executable dies before it starts you can use ldd to track down what library (or library used by a library) cannot be found.

    In your particular case, ldd will tell you what GLES and EGL libraries were used during link. By default find_library() looks in “the usual places” first which isn’t your local build directory. The problem you are running into is you are trying to replace an existing system library in your link. Here’s a very detailed write-up on how to use HINTS and such with find_library().

    Without being able to replicate your build environment and without a complete buildable example replicating the problem I cannot be of further help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Ask A Question
  • Popular
  • Answers
  • Ghulam Nabi

    Why are the British confused about us calling bread rolls ...

    • 5 Answers
  • Alex

    application has failed to start because no appropriate graphics hardware ...

    • 4 Answers
  • Jerry

    Add file to native target programmatically via tuist/XcodeProj

    • 4 Answers
  • Ghulam Nabi
    Ghulam Nabi added an answer To resolve the NullPointerException, you need to identify the variable… March 15, 2023 at 8:25 am
  • Ghulam Nabi
    Ghulam Nabi added an answer You can replace the PnP code in your Azure Function… February 13, 2023 at 7:11 am
  • Ghulam Nabi
    Ghulam Nabi added an answer You can use the $match stage in the aggregate pipeline… February 10, 2023 at 6:20 am

Trending Tags

android c++ cypress flutter java javascript python selenium testng webdriver

Top Members

Robert

Robert

  • 3 Questions
  • 1k Points
Luci

Luci

  • 5 Questions
  • 1k Points
Kevin O Brien

Kevin O Brien

  • 2 Questions
  • 1k Points

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help

Footer

Softans

Softans is a social questions & Answers Engine which will help you establish your community and connect with other people.

About Us

  • Blog
  • Jobs
  • About Us
  • Meet The Team
  • Contact Us

Legal Stuff

Help

Follow

© 2021 Softans. All Rights Reserved
With Love by Softans.

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.