Skip to content

Game Development

What can we say - we like games. And you can use Qt to write some. Questions? Ask here.
842 Topics 4.1k Posts
  • "Invalid operation" error in resizeGL after window closed

    Unsolved
    3
    0 Votes
    3 Posts
    430 Views
    8Observer88

    I reported the bug: https://bugreports.qt.io/browse/QTBUG-111016

  • QPainterPath to draw curve with fading

    Unsolved
    2
    0 Votes
    2 Posts
    422 Views
    johngodJ

    AFAIK QPainter is not suitable to do that kind of lines. Take a look at this discussion, there are some hacks, but ... https://stackoverflow.com/questions/59591826/draw-a-line-and-curves-with-fading-edges-with-qpainter.
    I think the proper way would be to use OpenGL ou Quick3D, or other low level library and make your own shaders. I have done something like that in Opengl, but it was just a just a fuzzy circle, check here. For lines, it should be the same concept, the proper way is to use a mix() function to mix the vertex colors in fragment shader as they "fade" way from the line. Using shaders is not trivial at all, sorry if this is not the answer you're looking for, but I just dont know a easy way to do that in QPainter, I think it is not the right tool for what you want to achieve.

  • Musical MIDI game - is Qt right for my project?

    Unsolved
    9
    1 Votes
    9 Posts
    1k Views
    BrunodB

    @KH-219Design said in Musical MIDI game - is Qt right for my project?:

    User base of precisely 2. Sounds pretty excellent :)

    ^^ indeed it does

    I have next to zero free time these days. However, if your work is on github or gitlab (or similar), please share a link. I would definitely check it out and look in on it every couple weeks, and maybe share thoughts if anything strikes me.

    When I have something to share, I will :-)

    Here is another MIDI project that I found useful recently, and it sounds like it might belong in your bookmarks, too:

    https://github.com/markc/midicomp

    SWEET! I have plenty of stuff to learn from now. That should keep me busy for the foreseeable future. Thx

  • 0 Votes
    11 Posts
    719 Views
    8Observer88

    Added restart button:

    edit-gravity-debug-drawer-opengl1-pyqt6.gif

    Source code: https://github.com/8Observer8/edit-gravity-debug-drawer-opengl1-pyqt6

  • 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.

  • Pause and Resume a QTimer

    8
    1 Votes
    8 Posts
    2k Views
    B

    @Chris-Kawa You know what I just realized... the QTimer::singleShot method doesn't even work because you won't know the remaining time if you pause again during the single shot.

  • 0 Votes
    2 Posts
    266 Views
    uaniU

    appears to be a single precision floating point issue, as used by Qt3D internally

  • 0 Votes
    4 Posts
    457 Views
    uaniU

    appears to have been due to single precision floating point used by Qt3D internally.

  • QCameraLens fieldOfView is ... geometrically in Qt :

    Solved
    1
    0 Votes
    1 Posts
    241 Views
    No one has replied
  • Bad performance cube example

    Unsolved
    4
    0 Votes
    4 Posts
    555 Views
    P

    Ok, so I've added v-sync by using QOpenGLWindow and its frameSwapped signal. Some good news and some bad.

    V-sync solved one issue. At first with v-sync was still measuring many delays, but I found that some of those were actually measurement errors. QDateTime::currentMSecsSinceEpoch() is not accurate enough, I'm using QElapsedTimer now. Also the code I used to test somehow interfered with the measurement. When I just printed qDebug() << elapsedTimer.elapsed() - lastUpdateRotation; without branch, and did the analysis in excel, I found that almost all frames took 16-17 ms, so exactly 60fps :)

    It didn't solve the frame skips on the RTX 2060. I'm getting none on the surface's iGPU (ok, I got a few above 20, but all of these were still below 30ms), but for some reason the desktop with beefy GPU still skips 0.7% of frames. And these are above 40ms, so really noticeable, max is 100ms.

    I'm measuring on the frameSwapped signal now, so I can't blame the qt event loop for doing something between frameSwapped and paint. It might be something between the driver and GPU, but I'm still somewhat lost on this part.

  • QScreenRayCaster->addLayer(...) has no effect

    Unsolved
    1
    0 Votes
    1 Posts
    285 Views
    No one has replied
  • QtWheelEvent* in signal from handler: should I delete it?

    Solved
    2
    0 Votes
    2 Posts
    275 Views
    jsulmJ

    @uani No, you do not have to delete the events - those are handled by Qt.

  • 0 Votes
    3 Posts
    319 Views
    uaniU

    @e2002e yes, this is how the mouse pointer y coordinate is delivered but when I use it to screenraycast it hits on the opposite vertical side of the entity.

    I subtract the mouse pointer y from the viewport height now to have a QScreenRayCast hit as expected.

  • 0 Votes
    5 Posts
    475 Views
    uaniU

    oh, i'm sorry, i was referring to https://forum.qt.io/topic/140839/qtexturematerial-error-unable-to-find-suitable-texture-unit-for-diffusetexture-ogl-sampler-diffusetexture-wasn-t-set-on-material-rendering-might-not-work-as-expected-dx by "texture issue" where I posted about an issue almost too embarassing to mention it again. This one here I would contribute more research to but i already used more time than i envisioned for my project and i desired to prorgress that.

  • 0 Votes
    2 Posts
    693 Views
    uaniU

    my bad:

    ((Qt3DExtras::QTextureMaterial)material).setTexture(t);

    should have been

    ((Qt3DExtras::QTextureMaterial*)material)->setTexture(t);

    :facepalm:

    i'm sorry for bothering you.

    However the "status changed" signal i'm still not receiving.

  • 0 Votes
    4 Posts
    441 Views
    Chris KawaC

    I mean MSVC as the compiler

    Ok, so you asked why you can't use it.
    Well, you can.

  • Troubles with Arduino to Qt.

    Unsolved
    2
    0 Votes
    2 Posts
    260 Views
    SGaistS

    Hi and welcome to devnet,

    One way could be to use the serial port of your Arduino to communicate with the computer.

  • 0 Votes
    5 Posts
    935 Views
    M

    @JoeCFD thank you Joe,
    I found the solution on github
    https://github.com/jonaias/DynamicFontSizeWidgets

  • 0 Votes
    2 Posts
    262 Views
    SGaistS

    Hi,

    Did you try to use qWaitForWindowExposed ?

  • Do we still need to call XFlush in Qt 6?

    Unsolved
    4
    0 Votes
    4 Posts
    451 Views
    J.HilkJ

    @mhn2 afaik Q_WS_X11 was a Qt4 define, and was replaced by the much better Qt Platform Abstraction system.
    https://doc.qt.io/qt-6/qpa.html

    the x11 support still exists, you find that now here:
    https://doc.qt.io/qt-6/linux.html