PDA

View Full Version : Question to glGetIntegerv() function



Snapshot
08-01-2006, 02:28 AM
On systems with more then one graphic card installed, to which card are the values, returned by glGetIntegerv(), related to ? And how can I get these informations (like GL_MAX_CLIP_PLANES etc.) for every installed card separately ?

k_szczech
08-01-2006, 06:51 AM
All OpenGL operations are performed on the graphics card you have created context for.
On Windows you use such functions as EnumDisplayDevices to list all available rendering devices. Than you must switch to the device you want, create a window and OpenGL context.

Snapshot
08-02-2006, 01:14 AM
Okay, here's what I tried: First I created a window placed on the display connected to the first adapter, created a context and gathered the informations I needed. Then I did the same with a window placed on a display connected to the second graphic card and did the same.
But, in both cases I received the same results for to completely different cards!? But the strange thing is, a driver problem causes the fact that opengl support is only available for the primary adapter. So there shouldn't be any valid results returned on the second run.
What am I doing wrong?

This is my code:

...
hWnd = CreateOpenGLWindow("OpenGL Framework", 0, 0, 600, 600, color, buffer);
if( hWnd == NULL )
return 0;

//get device context and gl context
hDC = GetDC(hWnd);
hRC = wglCreateContext(hDC);
wglMakeCurrent(hDC, hRC);

ShowWindow(hWnd, SW_SHOW);
UpdateWindow(hWnd);

/* get the max number of modelview matrices */
glGetIntegerv(GL_MAX_MODELVIEW_STACK_DEPTH, &sys.max_model_stack);
...

Snapshot
08-02-2006, 07:32 AM
I ran the same procedure once more, but now with two more familiar graphic cards where opengl support is available for both cards, and received individual values there.

ZbuffeR
08-02-2006, 08:16 AM
for the previous test (with same values) it is likely you had software rendering OpenGL on both cards.

Snapshot
08-02-2006, 08:27 AM
That's a good point, but hardware acceleration was definitely available for the first card. On the second card there was no rendering at all. Just an empty window.
That's why the whole thing seems so strange to me, because despite the fact the second card is not rendering, it is returning values when calling glGetIntegerv(...) which seem to belong to the pimary adapter instead.