Reputation: 461
I'm searching for a way to find out the name of the currently used graphics card driver inside a C++ OpenGL program. At best would be a platform-independent way (Linux and Windows). The only thing I could find was this but that's a shell solution and might even vary along different distributions (and still, Windows would be a problem).
I already looked at glGetString() with the GL_VENDOR parameter, however that outputs the vendor of the graphics card itself, not the driver. I couldn't find any options/functions that give me what I want.
Is there an easy solution to this problem?
Upvotes: 4
Views: 3433
Reputation: 1029
Try these:
const GLubyte* vendor = glGetString(GL_VENDOR);
const GLubyte* renderer = glGetString(GL_RENDERER);
const GLubyte* version = glGetString(GL_VERSION);
Upvotes: 3
Reputation: 1486
This is probably not the ultimate answer, but it might help you. You can work out the driver name and version combining both the lsmod
and modinfo
commands, under Linux.
For example, my lsmods
returns the following:
$ lsmod
Module Size Used by
autofs 28170 2
binfmt_misc 7984 1
vboxnetadp 5267 0
vboxnetflt 14966 0
vboxdrv 1793592 2 vboxnetadp,vboxnetflt
snd_hda_codec_nvhdmi 15451 1
snd_hda_codec_analog 80317 1
usbhid 42030 0 hid
nvidia 11263394 54
from which I know that nvidia refers to the graphics card.
I can then run modinfo nvidia
and I get
filename: /lib/modules/2.6.35-32-generic/kernel/drivers/video/nvidia.ko
alias: char-major-195-*
version: 304.54
supported: external
license: NVIDIA
alias: pci:v000010DEd00000E00sv*sd*bc04sc80i00*
alias: pci:v000010DEd00000AA3sv*sd*bc0Bsc40i00*
alias: pci:v000010DEd*sv*sd*bc03sc02i00*
alias: pci:v000010DEd*sv*sd*bc03sc00i00*
depends:
And I can extract the driver version etc...
I know this is neither a straight forward solution nor multiplatform, but you might work out an script that extracts driver name and versions if you guess that most of names will be nvidia, ati, intel etc... by grep / awk the output of lsmod
.
Upvotes: 0