Results 1 to 10 of 10

Thread: OpenGL status and efficiency in Qwt

  1. #1
    Join Date
    Jul 2016
    Posts
    57
    Thanks
    4
    Qt products
    Qt5
    Platforms
    Windows

    Question OpenGL status and efficiency in Qwt

    Several questions:

    1) The QwtPlotGLCanvas is based on QGLWidget, correct? And QGLWidget is now obsolete and there is a new class - QOpenGLWidget, will the QwtPlotGLCanvas be reworked to use a newer class then? If Yes, will there be any real improvement in speed for example?

    2) is QwtPlotGLCanvas using a QPainter in order to draw to OpenGL?

    3) Is there now some ongoing work with further testing/improvement of the OpenGL capabilities of Qwt library?

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,277
    Thanked 871 Times in 819 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: OpenGL status and efficiency in Qwt

    In SVN trunk you find more OpenGL based options including a canvas derived from QOpenGLWidget.

    Nevertheless don't expect too much, as the implementation is not yet complete and the quality of all OpenGL paint engines offered by Qt is not comparable to other backends. IMO the best and most performant backend for Qwt on the market is Qt4/X11 - hardware accelerated and without known bugs.

    Concerning your question about QPainter: allmost all Qt chart packages will be QPainter based, simply because this is mandatory for creating PDFs. Not doing QPainter means, that you would have to implement 2 completely different backends or have to drop PDF or printing. Nothing that makes much sense beside you want to focus on specific use cases like an oscilloscope etc.

    But even with the scene graph don't expect, that hardware acceleration will always be the best solution. Depending on the use case you will have different conclusions, when comparing CPU vs. GPU rendering. Better trust on good algos reducing what has to be painted - instead of challenging the hardware.

    Uwe

  3. #3
    Join Date
    Jul 2016
    Posts
    57
    Thanks
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: OpenGL status and efficiency in Qwt

    Quote Originally Posted by Uwe View Post
    beside you want to focus on specific use cases like an oscilloscope etc.
    Which is exactly what I'm looking for...

    Quote Originally Posted by Uwe View Post
    Better trust on good algos reducing what has to be painted - instead of challenging the hardware.

    So is Qwt utilizing some of such algorithms?





    p.s. Sometimes I do *not* want any fancy algos and just need to show real data (or give user to select it manually from graph, but that's another thing)




    Alright, I tried to build now the SVN version and got the following output with LNK errors:

    Qt Code:
    1. Generating Code...
    2. linking ..\lib\qwt.dll
    3. Creating library ..\lib\qwt.lib and object ..\lib\qwt.exp
    4. qwt_plot_glcanvas.obj : error LNK2019: unresolved external symbol __imp_glBegin
    5. referenced in function "protected: virtual void __cdecl QwtPlotGLCanvas::paintGL
    6. (void)" (?paintGL@QwtPlotGLCanvas@@MEAAXXZ)
    7. qwt_plot_opengl_canvas.obj : error LNK2001: unresolved external symbol __imp_glB
    8. egin
    9. qwt_plot_glcanvas.obj : error LNK2019: unresolved external symbol __imp_glBindTe
    10. xture referenced in function "protected: virtual void __cdecl QwtPlotGLCanvas::p
    11. aintGL(void)" (?paintGL@QwtPlotGLCanvas@@MEAAXXZ)
    12. qwt_plot_opengl_canvas.obj : error LNK2001: unresolved external symbol __imp_glB
    13. indTexture
    14. qwt_plot_glcanvas.obj : error LNK2019: unresolved external symbol __imp_glEnable
    15. referenced in function "protected: virtual void __cdecl QwtPlotGLCanvas::paintG
    16. L(void)" (?paintGL@QwtPlotGLCanvas@@MEAAXXZ)
    17. qwt_plot_opengl_canvas.obj : error LNK2001: unresolved external symbol __imp_glE
    18. nable
    19. qwt_plot_glcanvas.obj : error LNK2019: unresolved external symbol __imp_glEnd re
    20. ferenced in function "protected: virtual void __cdecl QwtPlotGLCanvas::paintGL(v
    21. oid)" (?paintGL@QwtPlotGLCanvas@@MEAAXXZ)
    22. qwt_plot_opengl_canvas.obj : error LNK2001: unresolved external symbol __imp_glE
    23. nd
    24. qwt_plot_glcanvas.obj : error LNK2019: unresolved external symbol __imp_glTexCoo
    25. rd2f referenced in function "protected: virtual void __cdecl QwtPlotGLCanvas::pa
    26. intGL(void)" (?paintGL@QwtPlotGLCanvas@@MEAAXXZ)
    27. qwt_plot_opengl_canvas.obj : error LNK2001: unresolved external symbol __imp_glT
    28. exCoord2f
    29. qwt_plot_glcanvas.obj : error LNK2019: unresolved external symbol __imp_glVertex
    30. 2f referenced in function "protected: virtual void __cdecl QwtPlotGLCanvas::pain
    31. tGL(void)" (?paintGL@QwtPlotGLCanvas@@MEAAXXZ)
    32. qwt_plot_opengl_canvas.obj : error LNK2001: unresolved external symbol __imp_glV
    33. ertex2f
    34. ..\lib\qwt.dll : fatal error LNK1120: 6 unresolved externals
    35. NMAKE : fatal error U1077: 'echo' : return code '0x460'
    36. Stop.
    37. NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0
    38. \VC\BIN\amd64\nmake.exe"' : return code '0x2'
    39. Stop.
    40. NMAKE : fatal error U1077: 'cd' : return code '0x2'
    41. Stop.
    To copy to clipboard, switch view to plain text mode 

    Any ideas why? it seems OpenGL functions related, I already tried adding LIBS += opengl32.lib GLU32.lib to the qwt.pro file but that didn't help.
    Last edited by r2com; 12th August 2016 at 19:18.

  4. #4
    Join Date
    Jul 2016
    Posts
    57
    Thanks
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: OpenGL status and efficiency in Qwt

    So any idea why compilation of Qwt from Trunk fails with above errors?

    Again, I can now successfully build 6.1.3 Qwt, but I cannot build 6.2.0 from the Trunk due to above errors, any ideas?
    Last edited by r2com; 15th August 2016 at 17:24.

  5. #5
    Join Date
    Jul 2016
    Posts
    57
    Thanks
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: OpenGL status and efficiency in Qwt

    darn... so I had to open file .../src/src.pri within the trunk SVN source file, and modify the following lines:
    Qt Code:
    1. contains(QWT_CONFIG, QwtOpenGL) {
    2.  
    3. QT += opengl
    4. }
    To copy to clipboard, switch view to plain text mode 

    to be:

    Qt Code:
    1. contains(QWT_CONFIG, QwtOpenGL) {
    2.  
    3. QT += opengl
    4. LIBS += opengl32.lib GLU32.lib
    5. }
    To copy to clipboard, switch view to plain text mode 

    it took me so long to get to this, I did not know that just adding "LIBS += opengl32.lib GLU32.lib" to qwt.pro file does not solve it!

    I guess someone maybe should correct files in SVN or put some instructions...


    Added after 56 minutes:


    One more personal comment (correct me if I'm wrong) that line "QT += opengl" must be excluded for future release, because Qt does not recommend using it once you started using the QOpenGLWidget class.

    If I'm correct that line only necessary if you are compiling the qwt_plot_glcanvas.h/cpp files which are based on QGLWidget which is now obsolete. So I guess the whole Makefile and other config files will be modified later to exclude old stuff, right?
    Last edited by r2com; 15th August 2016 at 22:51.

  6. #6
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,277
    Thanked 871 Times in 819 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: OpenGL status and efficiency in Qwt

    it took me so long to get to this, I did not know that just adding "LIBS += opengl32.lib GLU32.lib" to qwt.pro file does not solve it!
    Adding those libs - if you need them - is the job of the qmake spec files, nothing that should be added to any Qwt or application project files.

    The overall idea of Makefile generators ( like qmake ) is, that platform specific details ( spec files ) and application specific details ( application project files ) are isolated and the generator merges both into a Makefile.

    Don't know if you don't have proper spec file for your environment or you are simply using a wrong spec file - but anyway, this is where you have to look for fixes.
    I guess someone maybe should correct files in SVN or put some instructions...
    If the corresponding spec files are indeed broken you should file a bug report at the Qt bugtracker. Qwt project files are not the right place to define, what needs to be done for "QT += opengl".


    One more personal comment (correct me if I'm wrong) that line "QT += opengl" must be excluded for future release, because Qt does not recommend using it once you started using the QOpenGLWidget class.
    Qwt 6.x works with many different versions of Qt ( >= 4.5 ) and I'm not intending to drop compatibilities without good reason.

    Uwe

  7. #7
    Join Date
    Jul 2016
    Posts
    57
    Thanks
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: OpenGL status and efficiency in Qwt

    Quote Originally Posted by Uwe View Post
    Adding those libs - if you need them - is the job of the qmake spec files, nothing that should be added to any Qwt or application project files.
    I described my problem and I could not build Qwt with new OpenGL, and there was no any reply for two days, neither any suggestion what exactly has to be added and where.
    So I figured this flow, if you have a suggestion of how to compile that and include "LIBS += opengl32.lib GLU32.lib" in a proper place I'd be glad to see how to do it properly.

    So far editing the .pri inside /src folder seems the working approach, otherwise compile fails with errors shown in previous post.

  8. #8
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,277
    Thanked 871 Times in 819 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: OpenGL status and efficiency in Qwt

    Quote Originally Posted by r2com View Post
    if you have a suggestion of how to compile that and include "LIBS += opengl32.lib GLU32.lib" in a proper place I'd be glad to see how to do it properly.
    I don't know about your specific platform, but f.e. in msvc-desktop.conf ( checks the mkspecs directory of your Qt installations ) you already find the following line:
    Qt Code:
    1. QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib
    To copy to clipboard, switch view to plain text mode 
    To me it looks like, that you lost your way in the very beginning, when installing Qt and now you are struggling with problems ( like your missing nmake path ) fixing, what went wrong there. I can imagine because of 32/64 bit mismatches.

    Maybe it is a good idea to download the Qt source zip file and let the Qt build process analyze your system instead of using a pre-build package. I can imagine, that all your problems will be gone.

    For analyzing, what is happening behind the scene it might help to disable "CONFIG +=silent" in qwtbuild.pri - or simply having a look into the generated Makefile, to see what libs have been added by qmake, when seeing ( QT += opengl ).

    Uwe

  9. #9
    Join Date
    Jul 2016
    Posts
    57
    Thanks
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: OpenGL status and efficiency in Qwt

    I am not building Qt... I installed it.

    And I successfully built Qwt 6.1.3 as well.

    The problem was only when I tried the above (successful) method to build SVN version of Qwt 6.2.0 thats it. And even that problem is gone after I added those opengl32.lib GLU32.lib libs. So I assume its working now OK.

  10. #10
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,277
    Thanked 871 Times in 819 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: OpenGL status and efficiency in Qwt

    I am not building Qt... I installed it.
    Yes and obviously a version, that is not 100% compatible with your environment - or at least defaults to wrong spec file. That's why I recommend to build Qt as you can be sure then, that it matches your system

    And I successfully built Qwt 6.1.3 as well.
    Sure because you didn't enable OpenGL there - otherwise you will run exactly into the same problems.

    And even that problem is gone after I added those opengl32.lib GLU32.lib libs. So I assume its working now OK.
    Fine for you - but this is a public forum and readers might be trying to solve problems your way. That's why I'm always commenting wrong ideas with a "don't do it".

    So for the record: when reading "CONFIG += opengl" qmake adds a list of libraries, that are needed for using this module. This list is specific for a platform and therefore comes from a platform specific spec file. When calling qmake without parameters a default spec file is used - if this one is wrong you can specify the correct one as command line parameter or using an environment variable. The list of available spec files is part of your Qt installation, but of course you could also write your own.

    Further details can be found in the qmake docs.

    Uwe

Similar Threads

  1. efficiency
    By szisziszilvi in forum Newbie
    Replies: 2
    Last Post: 5th January 2011, 17:31
  2. Replies: 3
    Last Post: 8th July 2010, 07:41
  3. Efficiency Question
    By winston2020 in forum Qt Programming
    Replies: 1
    Last Post: 20th January 2009, 20:02
  4. The efficiency of QtAlgorithm
    By calmspeaker in forum Qt Programming
    Replies: 1
    Last Post: 19th September 2008, 06:52
  5. Efficiency is the name of the game
    By baray98 in forum General Programming
    Replies: 7
    Last Post: 19th September 2007, 20:03

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.