Skip to content

Game Development

What can we say - we like games. And you can use Qt to write some. Questions? Ask here.
862 Topics 4.0k Posts
  • 0 Votes
    2 Posts
    1k Views
    SGaistS

    Hi and welcome to devnet,

    I'd recommend going on the #qt-creator IRC channel and/or Qt Creator mailing list, you'll find there Qt Creator's developers/maintainers (this forum is more user oriented)

    In any case, you should take a look qmldesigner plugin for starter

  • 0 Votes
    4 Posts
    2k Views
    timdayT

    Z-fighting is a completely different issue from aliasing. Maybe you need to set/check/increase the QSurfaceFormat::depthSize property (I've no idea what the default is).

    If your z-buffer precision is as good as it can be, glPolygonOffset and/or controlling draw-order are next lines of defence against z-fighting.

    I seem to remember the old forum allowed image upload; but maybe I'm thinking of the Jira (bugtracker). The markdown formatting here would let you link to a URL hosted elsewhere though (and maybe include it inline).

  • 0 Votes
    1 Posts
    1k Views
    No one has replied
  • Game Licensing Question

    2
    0 Votes
    2 Posts
    1k Views
    ?

    @cudo Hi, please see http://www.qt.io/FAQ/ .

  • 0 Votes
    2 Posts
    2k Views
    D

    http://www.trentreed.net/blog/qt5-opengl-part-0-creating-a-window/

    Follow thoose tutorials or at least the part 0, 1 ,2 ,3a, 3b and you will have decent basis to start.

    In the tutorial he use QOpenGLWindow which isn't really far from QOpenGLWidget so I think you should be able to adapt his code a bit to suit your need but if you didn't succed to do it ask here again.

    Do you look for opengl ressources to ?

  • Let's talk about Qt on Oculus Rift and X-Box

    4
    0 Votes
    4 Posts
    3k Views
    A

    FYI: https://github.com/aesir84/avatar/tree/master

  • 0 Votes
    3 Posts
    2k Views
    K

    @Chris-Kawa Hi thanks for your reply. For some reason, though, it has started working again. All i changed was I added QWidget::resizeEvent(pEvent); to the GameView class and it started working. However, here is where it gets weird. when i remove that line it still works, so effectively i have changed nothing and it started working

  • 0 Votes
    3 Posts
    3k Views
    SGaistS

    Just saw that you already posted the same question here

    Please, don't post the same questions multiple times in different sub forum. One is enough.

    Closing it.

  • 0 Votes
    1 Posts
    803 Views
    No one has replied
  • 0 Votes
    1 Posts
    3k Views
    No one has replied
  • 0 Votes
    1 Posts
    692 Views
    No one has replied
  • 0 Votes
    1 Posts
    952 Views
    No one has replied
  • 0 Votes
    4 Posts
    3k Views
    N

    Ok fixed.

  • How to draw lines opengl.

    4
    0 Votes
    4 Posts
    3k Views
    Q
    Have problem with code below , it allows to draw about 30 trianagles but if declare more they fail.
    How to make code correct to allow drawing more than ~30 triangles to be drawn?

    void TriangleWindow::render()//rend
    {
    const qreal retinaScale = devicePixelRatio();
    glViewport( 0 , 0 ,width() * retinaScale,height() * retinaScale);

    glClear(GL_COLOR_BUFFER_BIT);

    m_program->bind(); QMatrix4x4 matrix; matrix.perspective(60, 4.0f/3.0f, 0.1f, 100.0f); if(zoom > 594){zoom = 594;} matrix.translate(move_LEFT_RIGHT/100-shift_for_stabilisation, -3+move_UP_DOWN/100, -10+(zoom/60));

    m_program->setUniformValue(m_matrixUniform, matrix);

    GLfloat kastID[] = { //kast alu kast_lopp , kasti_sisenemis_vaartus , kasti_koht , kasti_sisenemis_vaartus-kast_korgus , kast_lopp , kasti_sisenemis_vaartus-kast_korgus , kast_lopp , kasti_sisenemis_vaartus , kasti_koht , kasti_sisenemis_vaartus-kast_korgus , kasti_koht , kasti_sisenemis_vaartus , //kast üle kast_lopp , kasti_sisenemis_vaartus+kast_korgus , kasti_koht , kasti_sisenemis_vaartus , kast_lopp , kasti_sisenemis_vaartus , kast_lopp , kasti_sisenemis_vaartus+kast_korgus , kasti_koht , kasti_sisenemis_vaartus , kasti_koht , kasti_sisenemis_vaartus+kast_korgus }; GLfloat vertices[] = {

    //lauis , kõrgus

    //jooned kolmunukrkadest SHIFTright + laius , TASE + korgus2 , eelmineAEG - laius , eelmineTASE , eelmineAEG + laius , eelmineTASE +korgus2 , SHIFTright + laius , TASE + korgus2 , eelmineAEG - laius , eelmineTASE , SHIFTright - laius , TASE , SHIFTright + laius , TASE , eelmineAEG - laius , eelmineTASE , eelmineAEG + laius , eelmineTASE , SHIFTright + laius , TASE , eelmineAEG - laius , eelmineTASE , SHIFTright - laius , TASE, -50000.0f , sl+laius , -50000.0f , sl-laius , 50000.0f , sl-laius , //rg -50000.0f ,kastist_valjumise_vaartus+laius, -50000.0f ,kastist_valjumise_vaartus-laius, 50000.0f ,kastist_valjumise_vaartus-laius, }; GLfloat KASTcolors[] = { //kast alumine 0.3f, 0.0f, 0.0f, 0.3f, 0.0f, 0.0f, 0.3f, 0.0f, 0.0f, 0.3f, 0.0f, 0.0f, 0.3f, 0.0f, 0.0f, 0.3f, 0.0f, 0.0f,

    //kast ülemine

    0.0f, 0.3f, 0.0f, 0.0f, 0.3f, 0.0f, 0.0f, 0.3f, 0.0f, 0.0f, 0.3f, 0.0f, 0.0f, 0.3f, 0.0f, 0.0f, 0.3f, 0.0f, }; GLfloat colors[] = {

    //valged jooned
    1.0f, 1.0f, 1.0f,
    1.0f, 1.0f, 1.0f,
    1.0f, 1.0f, 1.0f,

    1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, //sl värvid 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, //rg värvid RED_for_line, GREEN_for_line, 0.0f, RED_for_line, GREEN_for_line, 0.0f, RED_for_line, GREEN_for_line, 0.0f, }; glVertexAttribPointer(m_posAttr, 2, GL_FLOAT, GL_FALSE, 0, vertices); glVertexAttribPointer(m_colAttr, 3, GL_FLOAT, GL_FALSE, 0, colors); glVertexAttribPointer(m_posAttr, 2, GL_FLOAT, GL_FALSE, 0, kastID); glVertexAttribPointer(m_colAttr, 3, GL_FLOAT, GL_FALSE, 0, KASTcolors); glEnableVertexAttribArray(0); glEnableVertexAttribArray(1); glDrawArrays(GL_TRIANGLES, 0, 30); glDisableVertexAttribArray(1); glDisableVertexAttribArray(0); eelmineAEG = SHIFTright; eelmineTASE = TASE;

    }//for end

    TriangleWindow::setTitle("Tulemus="+QString::number(tulemus)+" K="+QString::number(KASTkorgus_plus_minus)+" L="+ QString::number(KASTlaius_plus_minus)+" Sl="+QString::number(sl_multiplier)+" len="+ QString::number(lugemis_tagasi_max));

    }//if end +++++++++++++++++++++++++++++++++++

    m_program->release(); ++m_frame;

    }

  • 0 Votes
    1 Posts
    1k Views
    No one has replied
  • [SOLVED]Qt and the vulkan API

    4
    0 Votes
    4 Posts
    5k Views
    Chris KawaC

    Well sure, but there's not gonna be any work on it done if there's no SDK or driver to use, so don't expect anything to start sooner. I doubt that it would be a priority for Digia looking at how much Qt is integrated with OpenGL right now and which platforms they support. Considering that OpenGL is not going away and is still going to be evolved (much in the same direction as Vulkan, Mantle or Metal are) I think it's just gonna be left to the users to implement that support if they need it. This is a similar situation to DirectX (not talking about the ANGLE wrapper). There's no QDirectXWidget as there would be little benefit from it for most people but you can implement it yourself given the window handle and flags Qt provides.

    This is all of course just my speculation and opinion. You might get a different story from the actual Qt devs. Hit the mailing list or IRC channel if you're interested in that.

  • OpenGL without Qt OpenGL classes?

    8
    0 Votes
    8 Posts
    4k Views
    T

    Hi all!
    Don't know how does it work on C++, but in a small application written in PyQt to show and move some QGraphicsSvgItems, I have noted some improvement just by adding a line to my code:

    @class MyView(QtWidgets.QGraphicsView):

    def __init__(self, parent=None): """A very simple instance of QGraphicsView.""" super(MyView, self).__init__(parent) # self.setRenderHints(QtGui.QPainter.Antialiasing | QtGui.QPainter.SmoothPixmapTransform) self.setViewport(QtOpenGL.QGLWidget()) (...)@

    The line 10 was magic for me! And I havent touch nothing openGL related (that I know), just regular code with QtGui, QtCore, QtSvg and QWidgets. Maybe it's called internally...

  • Problems understanding how to use indexing

    13
    0 Votes
    13 Posts
    4k Views
    Chris KawaC

    Looks good.

    The offsetting is a little hard to handle if there's a large depth difference in the scene as too much offset will result in visual disparity near the camera and too little will not fix the z problems far away.
    Another way to deal with this is to render the color and the outlines into separate textures without any offset (using FBOs) and then just blend them together in a final pass.

  • Memory Leak using OpenGL

    3
    0 Votes
    3 Posts
    1k Views
    Z

    Test case please?

  • 0 Votes
    4 Posts
    3k Views
    A

    Additionally, you need to request an OpenGL 4.3 (or newer) core profile context by calling setFormat() in the QOpenGLWidget subclass' constructor:

    [code]
    GLWindow::GLWindow() {
    QSurfaceFormat format;
    format.setVersion(4, 3);
    format.setProfile(QSurfaceFormat::CoreProfile);
    setFormat(format);
    }
    [/code]