Why doesn't QT accept the Shading and the Lightning Features of OpenGL?



  • Hi guys,

    I am trying to create an Object in QT with OpenGL. I found a code that's in OpenGL and it works fine, it has Lighting sources, Shading and the object.

    The Interesting thing is that, in the C++ code that I downloaded, the program works perfectly, the Object appears with a shiny material, the shading works perfect and the light source also.

    I took and copy the code into a QT project, it is the same except I didn't add the Keyboard handling, because I don't need them. And in the QT project, the object is WHITE. No shading, no light nothing!

    Here are the pictures of the QT project and the original OpenGL project:

    Original Project - Image

    QT Project - Image

    I am new in QT and I really don't understand why the code isn't working ?

    Does anybody have any idea why it isn't working?


  • Qt Champions 2017

    Hi , Im no expert on opengl but I think the old code used stuff from fixed pipeline times
    and qt expects shaders as its modern opengl.

    If you look at
    http://doc.qt.io/qt-5/qtgui-openglwindow-example.html

    they use
    glVertexAttribPointer and other moden constructs.

    But its just a guess.



  • @mrjj , can you please explain to me which are these "fixed pipeline times"... because I really can't understand what should I do with the link that you sent me :(

    I checked these glVertexAttribPointer, but what should I do with them?

    I am new in QT and in OpenGL, sorry for not understanding you


  • Qt Champions 2017

    @taulant01
    Sorry for not being clear.
    I think the sample uses old opengl calls for lighting and textures.

    The old way is called fixed pipeline. And new is called modern/programmable pipeline.

    Most (older) samples use the fixed style and it just don't work nowadays.

    please read
    http://www.gamedev.net/topic/466751-fixed-pipeline-vs-programmable-pipeline/

    For good info to learn opengl (modern)
    http://www.opengl-tutorial.org/


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.