PDA

View Full Version : wglMakeCurrent() ???



andreasMank
04-16-2004, 05:43 AM
i have some problems using pbuffer .. no problem to create it .. but i get wrong results while switching between pbuffer and frame buffer .. for testing i'm calling

wglMakeCurrent(wglGetCurrentDC(), wglGetCurrentContext());

before every rendering .. and i though it would just render my screen to the current window .. but it looks wrong .. the other mysterious thing happens after calling twice wglMakeCurrent() .. normaly i tought i should get the same result as calling only ones ..

wglGetCurrentContext(..));
render();

is different from

wglGetCurrentContext(..));
wglGetCurrentContext(..));
render();

.. perhaps i misunderstood something basicly .. would be great if somebody could help me ..

jwatte
04-16-2004, 03:08 PM
Note that a pbuffer typically doesn't share context with a window. Thus, you have to use wglShareLists() to make textures and display lists come across. You also have to re-apply whatever state you might think transfers between frames, because it might retain whatever the state was last left in when it was last current.

Also, if you just MakeCurrent on the current DC and RC, then that doesn't actually change what's current. You should MakeCurrent your pbuffer DC and RC to draw into pbuffer, and then MakeCurrent your window DC and RC to come back.