Skip to content
  • 0 Votes
    1 Posts
    93 Views
    No one has replied
  • 0 Votes
    6 Posts
    279 Views
    S

    @jsulm the only query i have is if OpenGL is still supported why am i observing kind of jagged lines when i use Opengl? Also am i setting the backend properly like i stated in my code above?

  • 0 Votes
    2 Posts
    237 Views
    A

    Dug around other similar topics and found a solution, posting it here in case anyone has a similar problem to mine. The solution is in this thread

    It seems this is a 'problem' with high DPI displays in particular. I changed the way the program gets the X and Y coordinates from the mouse by taking into account the devicePixelRatio() as outlined in the linked thread, which solved the offsetting.

  • 0 Votes
    7 Posts
    589 Views
    SGaistS

    @slymas glad you found out and thanks for sharing ! :-)

  • 0 Votes
    1 Posts
    144 Views
    No one has replied
  • 0 Votes
    7 Posts
    672 Views
    G

    @SGaist Does it matter?
    How is 5.15 handling OpenGL apps when its internally using OpenGL?

  • 0 Votes
    1 Posts
    145 Views
    No one has replied
  • 0 Votes
    3 Posts
    735 Views
    johngodJ

    @julienchz
    Hi
    I have created some opengl tutorials check here: https://bitbucket.org/joaodeusmorgado/opengltutorials/src/master/
    I am using QOpenGLWidget, but I use mostly raw opengl, you could easily create a abstract render class, and then reuse it to QOpenGLWidget, or any other frame work of your choice render class.
    Hope it helps

  • 0 Votes
    1 Posts
    205 Views
    No one has replied
  • 0 Votes
    2 Posts
    256 Views
    S

    @wookie

    Oh man, getting Qt to work properly in a graphics intensive application at a good frame rate is tricky!

    QOpenGLWidget has absolute dog shit performance. Unfortunately you need it if you want the best integration with the rest of the Qt and nice things such as context menus. In my tests though rendering with QOpenGLWidget has an order of magnitude worse performance than simply using a QGLWidget or just QWindow. I think something really stupid is happening inside the implementations.. (texture copy or something like that perhaps..)

    In general one problem is that if your setSwapInterval actually works (plenty of bugs there across the whole stack) you're blocking your thread until your swap returns. So if your display is running at 60fps then you're stuck there for 16ms at a time which delays any user input processing that much since the event loop can't run. But it gets even worse if you're rendering multiple windows/widgets! If you're swapping twice then you're blocking twice and now your frame rate is halved, so you're dropping to 30fps and the UI is sluggish as a snail!

    In my game editor I've got a decent enough solution but it has taken some effort.

    Essentially what I've done is:

    I've settled on QWindow myself and creating the context myself and then wrapping that up inside QWidgetContainer. I use a "busy loop" that runs and uses QApplication::processEvents directly with AllEvents | WaitMoreEvents I use a separate thread to give a heartbeat, it sleeps some user defined interval and then posts a message to the main thread (on windows it'll try to use the compositor flush to sleep). Main thread then renders on the heartbeat message. I disabled app level VSYNC completely (i.e setSwapInterval is always 0)

    The key takeaways are that

    if you use any kind of blocking such as VSYNC or thread sleep etc. in your main thread your UI janks! if you don't use any kind of blocking and just busy loop as fast you can in your event loop you burn a lot of cycles and drain the users battery!

    so whatever solution you want to create you need

    ideally scaling so the frame rate is good and scales to the load interruptible waits for throttling the main loop, react to user input as soon as possible steady fps with good timing resolution
  • 0 Votes
    16 Posts
    2k Views
    R

    @jeremy_k @SGaist Gotcha. So I should leave the one RedHat installed alone. But I can have different Qt and Qt Creator installations installed at different locations, and they won't fight.

    They won't even fight over the system libraries on /usr/lib or some such?

  • 0 Votes
    2 Posts
    459 Views
    H

    Also here is the stacktrace if it helps:

    0 ??? 0x10a1029a8 ??? 1 <translation info unavailable> 0x10c7d5e24 ??? 2 libsystem_pthread.dylib 0x115b91ee6 pthread_kill + 263 3 libsystem_c.dylib 0x114e06e58 abort + 130 4 test5 0x104c96839 qAbort() + 9 (qglobal.cpp:161) 5 test5 0x104c9b6b8 qt_message_fatal(QtMsgType, QMessageLogContext const&, QString const&) + 24 (qlogging.cpp:2048) 6 test5 0x10510d7b6 QMessageLogger::fatal(char const*, ...) const + 246 (qlogging.cpp:934) 7 test5 0x10510d08a qt_assert(char const*, char const*, int) + 74 (qassert.cpp:68) 8 test5 0x1041c7e45 QGles2TextureRenderTarget::create() + 981 (qrhigles2.cpp:5462) 9 test5 0x103580e82 QQuickWidget::createFramebufferObject() + 1890 (qquickwidget.cpp:1137) 10 test5 0x103585ad1 QQuickWidget::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) + 225 (moc_qquickwidget.cpp:295) 11 test5 0x104da0579 void doActivate<false>(QObject*, int, void**) + 2313 (qobject.cpp:4004) 12 test5 0x104d9f039 QMetaObject::activate(QObject*, QMetaObject const*, int, void**) + 121 (qobject.cpp:4052) 13 test5 0x103607465 QQuickWindow::sceneGraphInitialized() + 37 (moc_qquickwindow.cpp:829) 14 test5 0x10360665d QQuickWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) + 109 (moc_qquickwindow.cpp:570) 15 test5 0x104da0579 void doActivate<false>(QObject*, int, void**) + 2313 (qobject.cpp:4004) 16 test5 0x104d9f039 QMetaObject::activate(QObject*, QMetaObject const*, int, void**) + 121 (qobject.cpp:4052) 17 test5 0x1036b52d2 QSGRenderContext::initialized() + 34 (moc_qsgcontext_p.cpp:289) 18 test5 0x1036c7b67 QSGDefaultRenderContext::initialize(QSGRenderContext::InitParams const*) + 295 (qsgdefaultrendercontext.cpp:57) 19 test5 0x1035f1a1a QQuickRenderControl::initialize() + 378 (qquickrendercontrol.cpp:309) 20 test5 0x1035806d3 QQuickWidgetPrivate::initializeWithRhi() + 867 (qquickwidget.cpp:1058) 21 test5 0x1035837aa QQuickWidget::resizeEvent(QResizeEvent*) + 474 (qquickwidget.cpp:1404) 22 test5 0x1038782cb QWidget::event(QEvent*) + 2683 (qwidget.cpp:9076) 23 test5 0x103584fb9 QQuickWidget::event(QEvent*) + 1321 (qquickwidget.cpp:1719) 24 test5 0x1037ea0ba QApplicationPrivate::notify_helper(QObject*, QEvent*) + 458 (qapplication.cpp:3284) 25 test5 0x1037ee456 QApplication::notify(QObject*, QEvent*) + 11974 (qapplication.cpp:3231) 26 test5 0x104d2212a QCoreApplication::notifyInternal2(QObject*, QEvent*) + 282 (qcoreapplication.cpp:1115) 27 test5 0x104d22df3 QCoreApplication::sendEvent(QObject*, QEvent*) + 131 (qcoreapplication.cpp:1533) 28 test5 0x10386f721 QWidgetPrivate::sendPendingMoveAndResizeEvents(bool, bool) + 353 (qwidget.cpp:7944) 29 test5 0x103875ff0 QWidgetPrivate::show_helper() + 64 (qwidget.cpp:7995) 30 test5 0x10387707f QWidgetPrivate::setVisible(bool) + 943 (qwidget.cpp:8344) 31 test5 0x103876cc0 QWidget::setVisible(bool) + 144 (qwidget.cpp:8276) 32 test5 0x10386871e QWidget::showMaximized() + 126 (qwidget.cpp:3057) 33 test5 0x103875e94 QWidget::show() + 100 (qwidget.cpp:7900) 34 test5 0x102e70702 MyOpenGLWidget::mousePressEvent(QMouseEvent*) + 82 (main.cpp:16) 35 test5 0x103877a73 QWidget::event(QEvent*) + 547 (qwidget.cpp:8902) 36 test5 0x1037ac198 QOpenGLWidget::event(QEvent*) + 712 (qopenglwidget.cpp:1698) 37 test5 0x1037ea0ba QApplicationPrivate::notify_helper(QObject*, QEvent*) + 458 (qapplication.cpp:3284) 38 test5 0x1037ec11c QApplication::notify(QObject*, QEvent*) + 2956 (qapplication.cpp:2772) 39 test5 0x104d2212a QCoreApplication::notifyInternal2(QObject*, QEvent*) + 282 (qcoreapplication.cpp:1115) 40 test5 0x104d22e83 QCoreApplication::sendSpontaneousEvent(QObject*, QEvent*) + 131 (qcoreapplication.cpp:1547) 41 test5 0x1037eabd0 QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) + 1216 (qapplication.cpp:2356) 42 test5 0x1038a44a5 QWidgetWindow::handleMouseEvent(QMouseEvent*) + 4485 (qwidgetwindow.cpp:623) 43 test5 0x1038a2849 QWidgetWindow::event(QEvent*) + 361 (qwidgetwindow.cpp:241) 44 test5 0x1037ea0ba QApplicationPrivate::notify_helper(QObject*, QEvent*) + 458 (qapplication.cpp:3284) 45 test5 0x1037ee474 QApplication::notify(QObject*, QEvent*) + 12004 (qapplication.cpp:3235) 46 test5 0x104d2212a QCoreApplication::notifyInternal2(QObject*, QEvent*) + 282 (qcoreapplication.cpp:1115) 47 test5 0x104d22e83 QCoreApplication::sendSpontaneousEvent(QObject*, QEvent*) + 131 (qcoreapplication.cpp:1547) 48 test5 0x103e0f2b0 QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) + 2384 (qguiapplication.cpp:2277) 49 test5 0x103e0ec51 QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) + 753 (qguiapplication.cpp:2187) 50 test5 0x103e110b4 QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::TouchEvent*) + 5412 (qguiapplication.cpp:3081) 51 test5 0x103e0e2de QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) + 110 (qguiapplication.cpp:2035) 52 test5 0x103e74a5e QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 190 (qwindowsysteminterface.cpp:1094) 53 test5 0x102e7af11 QIOSEventDispatcher::processPostedEvents() + 545 (qioseventdispatcher.mm:443) 54 test5 0x104f9bf3b RunLoopSource<QEventDispatcherCoreFoundation>::process(void*) + 107 (qeventdispatcher_cf_p.h:111) 55 CoreFoundation 0x113e56b8f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 56 CoreFoundation 0x113e56ad1 __CFRunLoopDoSource0 + 157 57 CoreFoundation 0x113e5632b __CFRunLoopDoSources0 + 311 58 CoreFoundation 0x113e509ba __CFRunLoopRun + 889 59 CoreFoundation 0x113e50264 CFRunLoopRunSpecific + 560 60 GraphicsServices 0x1225e324e GSEventRunModal + 139 61 UIKitCore 0x13abc47bf -[UIApplication _run] + 994 62 UIKitCore 0x13abc95de UIApplicationMain + 123 63 test5 0x102e79161 qt_main_wrapper + 705 (qioseventdispatcher.mm:206) 64 dyld_sim 0x112701384 start_sim + 10 65 dyld 0x20a3db41f start + 1903
  • 0 Votes
    1 Posts
    221 Views
    No one has replied
  • 0 Votes
    2 Posts
    230 Views
    Pl45m4P

    @Hyperspider-Software

    Resizing and moving the window will cause updates, renders and repaints. If everything is done and nothing changes, it doesn't have to get updated at such high rate as it would, when you grab the window and move it around and change dimensions of the content.
    Just a guess. Maybe it might be helpful if you show some code, how the window is rendered.
    Is it just one window or does everything behave like this?

  • 0 Votes
    5 Posts
    446 Views
    H

    Just changing the root widget of my application from QWidget to QQuickWidget fixed the problem. Well, that was way easier than I expected! Thanks for the help.

  • 0 Votes
    2 Posts
    645 Views
    D

    @nishithaa I have tried to do this for years to make a VR video player using Qt and I'm finally close to achieving it but without gstreamer. I don't know if gstreamer is a requirement to you but I use libvlc 4, based on this example : https://github.com/videolan/vlc/tree/master/doc/libvlc/QtGL .

    It compiles and runs well but I don't want to use QOpenGLWidget (I use QWindows with manually-managed QOpenGLContexts) and somehow I can't make it to work in this setup.

  • 0 Votes
    2 Posts
    567 Views
    M

    If it's a library that uses CMake, it's usually pretty straightforward. For glfw, which is one you appear to be using, see its CMake documentation

  • 0 Votes
    1 Posts
    271 Views
    No one has replied
  • 0 Votes
    1 Posts
    210 Views
    No one has replied