wglBindTexImageARB(HPBUFFERARB hPbuffer, int iBuffer)
{
HDC prevDrawable = stw_get_current_dc();
+ HDC dc;
struct stw_context *curctx = stw_current_context();
struct stw_framebuffer *fb;
GLenum texFormat, srcBuffer, target;
*/
pixelFormatSave = fb->iPixelFormat;
fb->iPixelFormat = curctx->iPixelFormat;
- retVal = stw_make_current(wglGetPbufferDCARB(hPbuffer), curctx->dhglrc);
+ dc = wglGetPbufferDCARB(hPbuffer);
+ retVal = stw_make_current(dc, curctx->dhglrc);
fb->iPixelFormat = pixelFormatSave;
if (!retVal) {
debug_printf("stw_make_current(#1) failed in wglBindTexImageARB()\n");
+ wglReleasePbufferDCARB(hPbuffer, dc);
return FALSE;
}
debug_printf("stw_make_current(#2) failed in wglBindTexImageARB()\n");
}
+ wglReleasePbufferDCARB(hPbuffer, dc);
+
return retVal;
}