logoalt Hacker News

voxic11last Wednesday at 5:30 PM3 repliesview on HN

OpenGL doesn't have any way to do this except sometimes via vendor specific extensions. Basically how OpenGL works is it creates the graphics context on whichever device the system hands it. So you can configure the GPU used by OpenGL on the system level but not at the application level.


Replies

FrostKiwitoday at 2:58 AM

FYI, setting `NvOptimusEnablement` and `AmdPowerXpressRequestHighPerformance` have been the canonical way on Windows, `__NV_PRIME_RENDER_OFFLOAD` + `__GLX_VENDOR_LIBRARY_NAME` on Linux. Though not an OpenGL feature per se, as you mentioned.

KellyCriteriontoday at 2:38 PM

AFAIR there was a way to "list" existing output devices, so your app could select the proper one?

pjmlptoday at 2:32 AM

It does so via the respective OS way on how to create OpenGL context.