How to force OGL to render command on specify card

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?

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.

That’s the X11 way to do it, certainly. On Windows there’s the WGL_gpu_affinity extension which makes things slightly easier.

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.

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).

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;