Render on specific GPU in OpenGL

I have notebook with 2 GPUs. First one is integrated Intel HD 4000 and second one is nVidia 650M. I want to select which one will be used for rendering in my application. Is it possible?

First time I’ve ever heard of that :clue:

The most of powerful notebooks have one GPU in Intel i7 processor and second dedicated GPU for example nVidia 650M…

Most powerful… A GTX 650M is hardly the top of the line of laptops. The most powerful laptops are running two GPUs in SLI or Crossfire, for example two GTX 680Ms. What you’re talking about is called Nvidia Optimus.

I believe you can add games/executables to a list in the Nvidia Control Panel so that they always use the Nvidia GPU. You can also create a .exe file from your resulting .jar file, right-click on it and choose to run it with the Nvidia GPU.

He means nVidia optimus, basically hybrid graphics configuration.

Your integrated card (HD4000) takes care of any basic graphics rendering, while your dedicated card deals with more intense things such as games.

I currently run a optimus powered laptop with an i5 and GT780M, rarely ever use the dedicate card. I actually use the integrated HD (I think it’s 4600, not sure) for games such as Minecraft and Starbound, plenty of power.

Hi

You can use NV GPU affinity API to choose the GPU you would like to use. Unfortunately, it isn’t exposed yet in JOGL 2 (JogAmp).

From what I know that’s impossible. That extension only allows you to handle multiple Nvidia GPUs in the same machine. The choice between the Intel GPU and the Nvidia GPU is done before the application even starts. By the time the OpenGL context has been created it’ll be too late. Even worse, the Intel card uses a completely different driver which does not support the Nvidia specific NV_gpu_affinity extension, so it’d be impossible to even confirm that there is an Nvidia GPU from within the program itself without resorting to scanning the file system or some other hack. The selection of the Nvidia GPU has to be done during context creation, which no Java binding supports as far as I know.

To the original poster…

I’m guessing your on a Macbook Pro. Cause this two video card approach is exactly how they are setup.

So to answer your question and give you a hint to what your going to encounter next …

  1. you dont have to do anything … as soon as you init your display using OpenGL it will switch to the dedicated card. There is a GLX util you can download that monitors the cards and will show you it autoswitches.

  2. now the next challenge… which version of opengl do you want to use? By default the dedicated card will be a opengl 2.2 profile. If you want the opengl 4.1 profile you will have to specifically init the opengl profile asking for … 3.2 CORE … (yes 3.2 CORE = 4.1 implementation… if you ask for 4.1 you will get an error… welcome to the nuances that is Mac gaming :slight_smile: