Results 1 to 7 of 7

Thread: Qt program uses wrong video card

  1. #1
    Join Date
    Aug 2016
    Posts
    3
    Qt products
    Qt5
    Platforms
    Windows

    Default Qt program uses wrong video card

    Hey,

    I've made an application using qt creator, but when I run the application in qt creator it crashes because it is using the wrong video card. When I run the application on it's own it does use the right video card.

    I've selected in nvidia configuration screen to use higher end video card, but this doesn't work. Video card drivers are up to date. Reinstalling video drivers doesn't work.

    Can someone help me with this plz?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,677
    Thanks
    13
    Thanked 1,596 Times in 1,524 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Qt program uses wrong video card

    I run the application in qt creator it crashes because it is using the wrong video card.
    On what evidence do you base this assertion? What environment is Qt Creator providing the child process? What cards? What OS? Which Qt version? Which Qt features are you using?

  3. #3
    Join Date
    Aug 2016
    Posts
    3
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qt program uses wrong video card

    I use the function: glGetString(GL_VERSION)

    I find out it is using my intel GPU and not my nvidia GPU. (geforce gt540m)

    The intel card supports opengl 3.0 and the nvidia card supports 3.3. Im using functions for opengl 3.3, this is why it crashes.

    Im running it on windows 10, qt version 5.6. The program is the begin of a game, it shows a character on the screen using the opengl functions of qt.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,677
    Thanks
    13
    Thanked 1,596 Times in 1,524 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Qt program uses wrong video card

    Do you have the option to start a program using a particular GPU? On my laptop this is in the right-click context menu. If so, try running Qt Creator by explicitly selecting the nVidia card and then see if, when Creator launches your program it still has the wrong GPU.

  5. #5
    Join Date
    Aug 2016
    Posts
    3
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qt program uses wrong video card

    Im sorry I can't find it. Could you be more specific where this menu is?

  6. #6
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,719
    Thanks
    259
    Thanked 760 Times in 750 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: Qt program uses wrong video card

    On my laptop this is in the right-click context menu.
    Might depend on how you've configured your graphics drivers. I have Nvidia's Nsight HUD ("Heads up display") installed, and the right-click menu gives me the option of starting under that (but nothing else graphics-related).
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  7. #7
    Join Date
    Nov 2012
    Location
    Russia
    Posts
    228
    Thanks
    117
    Thanked 18 Times in 10 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt program uses wrong video card

    You can active your Geforce/Radeon video by adding this code:

    Qt Code:
    1. #ifdef _WIN32
    2. #include <windows.h>
    3. extern "C" __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
    4. extern "C" __declspec(dllexport) DWORD AmdPowerXpressRequestHighPerformance = 0x00000001;
    5. #endif
    6.  
    7. #include "widget.h"
    8.  
    9. #include <QApplication>
    10.  
    11. int main(int argc, char *argv[])
    12. {
    13. QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
    14. QApplication a(argc, argv);
    15.  
    16. Widget w;
    17. w.show();
    18.  
    19. return a.exec();
    20. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by 8Observer8; 12th June 2020 at 11:37.

Similar Threads

  1. Replies: 0
    Last Post: 8th December 2015, 07:11
  2. sd card
    By dmartino in forum Newbie
    Replies: 6
    Last Post: 19th January 2011, 22:34
  3. Qt and graphics card
    By leoalvesmachado in forum Newbie
    Replies: 2
    Last Post: 21st May 2010, 21:57
  4. wrong connection? program crashes altough it compiles
    By cbarmpar in forum Qt Programming
    Replies: 7
    Last Post: 30th September 2008, 13:48
  5. change gamma ramp in video card
    By hvengel in forum Qt Programming
    Replies: 5
    Last Post: 10th April 2007, 01:26

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.