Pbuffers and render to (depth) texture

I was tempted to post this in beginner’s forum but since looks like other people is also speaking of pbuffers here, I decided it would be good to keep similar threads in the same place.

The first question comes from a recent post in beginner’s forum, about pbuffer rendering context sharing. Is this really worth it? The architecture I used to manage pbuffers turned out to be pretty damn difficult to modify to enable that feature. My rendering context has display list and other stuff shared. Can someone provide some real-case numbers?

Second question is about depth textures. I guess after a TEX instruction they go in (L, L, L, 1) in the result register. Do someone tried this out?

Now, the real reason I have posted this is that I am having a problem with my pbuffer. Looks like it can initialize correctly. The initialization looks like:

HPBUFFERARB newBuffer = wglCreatePbufferARB(wglGetCurrentDC(), pixelFormat, width, height, &attribList[0]);
if(!newBuffer) return false;

HDC newDeviceContext = wglGetPbufferDCARB(newBuffer);
if(!newDeviceContext) {
wglDestroyPbufferARB(newBuffer);
return false;
}
HGLRC newRenderingContext = wglCreateContext(newDeviceContext);
if(!newRenderingContext) {
wglReleasePbufferDCARB(newBuffer, newDeviceContext);
wglDestroyPbufferARB(newBuffer);
return false;
}
<other small things here but I don’t think they are the source of the problem>
return true;

This looks pretty similar to all the demos I’ve seen here and there. I checked GetLastError immediatly after if(!newRenderingContext) block and returned no error. Also checked after the function return and no errors were detected so I guess I’m fine here.
Now, in the render loop, there’s a moment in which I try to render to my pbuffer:

wglMakeCurrent(newDeviceContext, newRenderingContext);

Immediatly before the call no errors are detected. After the call, the detected error is 1400, which is “invalid window handle”.
I checked the values passed to wglMakeCurrent and they look correct. Ack. I have not a single clue on where to search for bugs. Can you suggest me something please?

EDIT: ugly typos messed up everything.

[This message has been edited by Obli (edited 09-15-2003).]