Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QGLFormat has no effect
Forum Updated to NodeBB v4.3 + New Features

QGLFormat has no effect

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 854 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    floatingWoods
    wrote on last edited by
    #1

    Hello,

    I have a QWidget that displays some OpenGl content. That works fine.
    Now I am experimenting with other settings (e.g. stereo), but noticed that I cannot even change the basic settings inside of QGLFormat.

    In my QWidget constructor, this is what I do:

    @CMyGLWidget::CMyGLWidget(QWidget *parent)
    {
    QGLFormat fmt;
    fmt.setStereo(false);
    fmt.setDoubleBuffer(false);
    fmt.setDepth(false);
    fmt.setStencil(false);
    fmt.setDirectRendering(false);
    ::QGLWidget(fmt,parent);
    if (format().depth())
    printf("Has depth!!\n");
    if (format().doubleBuffer())
    printf("Has double buffer!!\n");
    if (format().stereo())
    printf("Has stereo!!\n");
    if (format().stencil())
    printf("Has stencil!!\n");
    if (format().directRendering())
    printf("Direct rendering!!\n");
    }@

    But whatever settings I select for the format, I always end-up with:

    • non-stereo (ok, that's very much hardware-related)
    • double buffer
    • depth
    • stencil
    • direct rendering

    What does that mean? That my code is not correct, or that my graphic card (or platform) is not flexible? One would think that disabling the depth buffer should always work.

    I am running Windows 8.1, Qt 5.1.1, and the graphic card is a NVidia GeForce GT 620

    Thanks for any help/comment

    1 Reply Last reply
    0
    • A Offline
      A Offline
      agocs
      wrote on last edited by
      #2

      That's not calling the base class constructor. You are merely creating an unused local QGLWidget instance.

      1 Reply Last reply
      0
      • F Offline
        F Offline
        floatingWoods
        wrote on last edited by
        #3

        Thanks for your reply. You are perfectly right. Actually I first did it the correct way (see below), but seeing no effect I tested some other constructs. Following does not work either:

        @CMyGLWidget::CMyGLWidget(QWidget *parent) : QGLWidget(QGLFormat(QGL::SingleBuffer|QGL::NoDepthBuffer|QGL::NoStencilBuffer|QGL::IndirectRendering),parent)
        {
        if (format().depth())
        printf("Has depth!!\n");
        if (format().doubleBuffer())
        printf("Has double buffer!!\n");
        if (format().stereo())
        printf("Has stereo!!\n");
        if (format().stencil())
        printf("Has stencil!!\n");
        if (format().directRendering())
        printf("Direct rendering!!\n");
        }
        @

        Same result as in my first post. How come?

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved