diff options
author | don bright <hugh.m.bright@gmail.com> | 2011-11-23 04:45:37 (GMT) |
---|---|---|
committer | don bright <hugh.m.bright@gmail.com> | 2011-11-23 04:45:37 (GMT) |
commit | aa8d53614a1a8aa16d076a3346d781cb3dc797e2 (patch) | |
tree | de28d2802a437de98a7359a838f9f6e903a7af3f /tests/OffscreenContextWGL.cc | |
parent | cea502f9a3531888dbbb55099421fb1ab565f2c1 (diff) |
fix stencil code for windows. tweak pretty printer for windows
Diffstat (limited to 'tests/OffscreenContextWGL.cc')
-rw-r--r-- | tests/OffscreenContextWGL.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/tests/OffscreenContextWGL.cc b/tests/OffscreenContextWGL.cc index ba12a4f..f36671c 100644 --- a/tests/OffscreenContextWGL.cc +++ b/tests/OffscreenContextWGL.cc @@ -82,8 +82,8 @@ string offscreen_context_getinfo(OffscreenContext *ctx) { stringstream out; out << "GL context creator: WGL\n" - out << "PNG generator: lodepng\n" - << get_windows_info(); + << "PNG generator: lodepng\n" + << get_os_info(); return out.str(); } @@ -130,11 +130,15 @@ bool create_wgl_dummy_context(OffscreenContext &ctx) ZeroMemory( &pixformat, sizeof( pixformat ) ); pixformat.nSize = sizeof( pixformat ); pixformat.nVersion = 1; - pixformat.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL; + pixformat.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; pixformat.iPixelType = PFD_TYPE_RGBA; - pixformat.cColorBits = 24; - pixformat.cDepthBits = 16; - pixformat.iLayerType = PFD_MAIN_PLANE; + pixformat.cGreenBits = 8; + pixformat.cRedBits = 8; + pixformat.cBlueBits = 8; + pixformat.cAlphaBits = 8; + pixformat.cDepthBits = 24; + pixformat.cStencilBits = 8; + chosenformat = ChoosePixelFormat( dev_context, &pixformat ); if (chosenformat==0) { cerr << "MS GDI - ChoosePixelFormat failed\n"; @@ -215,6 +219,7 @@ bool teardown_offscreen_context(OffscreenContext *ctx) */ bool save_framebuffer(OffscreenContext *ctx, const char *filename) { + wglSwapLayerBuffers( ctx->dev_context, WGL_SWAP_MAIN_PLANE ); if (!ctx || !filename) return false; int samplesPerPixel = 4; // R, G, B and A vector<GLubyte> pixels(ctx->width * ctx->height * samplesPerPixel); |