Skip to content

Commit

Permalink
glretrace: Fix wglCreatePbufferARB without current context.
Browse files Browse the repository at this point in the history
  • Loading branch information
brianpaul authored and jrfonseca committed Oct 31, 2015
1 parent 410e4f9 commit 974a1f2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions retrace/glretrace_wgl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ static void retrace_wglCreatePbufferARB(trace::Call &call) {

pbInfo.texMipmap = !!parseAttrib(attribs, WGL_MIPMAP_TEXTURE_ARB, 0);

// WGL interface needs the HDC
pbInfo.hdc_drawable = getDrawable(call.arg(0).toUInt());

glws::Drawable *drawable = glretrace::createPbuffer(iWidth, iHeight,
&pbInfo);

Expand Down
4 changes: 4 additions & 0 deletions retrace/glws.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ namespace glws {

using glprofile::Profile;

class Drawable;


bool
checkExtension(const char *extName, const char *extString);
Expand All @@ -53,6 +55,8 @@ struct pbuffer_info
int texFormat; // GL_RGB, GL_RGBA, or GL_NONE
int texTarget; // GL_TEXTURE_1D/2D/CUBE_MAP or GL_NONE
bool texMipmap; // 0 or 1 (false/true)

Drawable *hdc_drawable; // Needed for WGL Pbuffers
};


Expand Down
5 changes: 4 additions & 1 deletion retrace/glws_wgl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,10 @@ glws::WglDrawable::createPbuffer(const Visual *vis,

int pixelFormats[20];
UINT numPixelFormats;
HDC hdc = wglGetCurrentDC();
WglDrawable *wgl_draw = static_cast<WglDrawable *>(pbInfo->hdc_drawable);
HDC hdc = wgl_draw->hDC;
assert(hdc);

if (!pfnWglChoosePixelFormatARB(hdc, attribs, NULL,
20, pixelFormats,
&numPixelFormats)) {
Expand Down

0 comments on commit 974a1f2

Please sign in to comment.