PDA

View Full Version : How to force OGL to render command on specify card



pango
01-22-2008, 01:14 AM
My program run a system that has 2 display cards,for some reason,my program is required to render

all the OpenGL commands it is generated on a specify display card(card1,or card2),so how can I do

that?I heard if I create a window on a display that is connected to the target display card,and

create a RC from that window's DC,then all the commands send to the RC will be rendered on the

target display card,wwwis it right?

V-man
01-22-2008, 08:48 AM
I heard if I create a window on a display that is connected to the target display card,and create a RC from that window's DC,then all the commands send to the RC will be rendered on the target display card, is it right?

Yes in principle.
I know that with 2 nVidia cards will work. If it is 2 different vendors, the second card will use the default microsoft implementation.

Lindley
01-22-2008, 02:25 PM
That's the X11 way to do it, certainly. On Windows there's the WGL_gpu_affinity extension which makes things slightly easier.

pango
01-23-2008, 07:39 AM
Ok,but I also had a problem : How can I display the rendered image from different RC in a same window?Because the RC is created from different window,and the windows is created in different thread,so how to do it?The way I think out is readout the image from RC,and use "glDrawPixel()" to draw it in display window,but I think it is not a good idea.

jwatte
01-25-2008, 12:28 PM
There is no well supported way to transfer pixels between different pieces of hardware. You have to go through system memory. I would recommend rendering to a pbuffer or pixel buffer object, reading the data, uploading it as a texture on the second card, and rendering a quad with that texture.

pango
01-27-2008, 07:03 AM
There is no well supported way to transfer pixels between different pieces of hardware. You have to go through system memory. I would recommend rendering to a pbuffer or pixel buffer object, reading the data, uploading it as a texture on the second card, and rendering a quad with that texture.

It is not right all,I know if I use the same DC to render,that mean s first I call wglMakeCurrent(rc1,dc),second I call wglMakeCurrent(rc2,dc),and next I call wglMakeCurrent(rc1,dc),the rendered image from rc1 or rc2 can be displayed in dc;But I'm afraid this method will affect the parallel working of 2 RCs(the parallel working of 2 cards).

Lindley
01-27-2008, 12:02 PM
I wasn't aware you could have two OpenGL contexts attached to the same device context.

I'd be very curious whether you get that approach working or not.

pango
01-28-2008, 08:04 AM
I wasn't aware you could have two OpenGL contexts attached to the same device context.

I'd be very curious whether you get that approach working or not.

first render,call wglMakeCurrent(hdc,hrc1),the rendered image can be display in hdc;second render,call wglMakeCurrent(hdc,hrc2),the rendered image also can be displayed in hdc;