diff options
author | Don Bright <hugh.m.bright@gmail.com> | 2011-11-23 02:31:57 (GMT) |
---|---|---|
committer | Don Bright <hugh.m.bright@gmail.com> | 2011-11-23 02:31:57 (GMT) |
commit | cea502f9a3531888dbbb55099421fb1ab565f2c1 (patch) | |
tree | 6709403e6ce359b6c8d62b0acce1248c58ca9622 /tests/OffscreenContextGLX.cc | |
parent | 03442e31241a859701c9efaf7525c9752444fa9f (diff) |
tweak and fix Stencilbuffer setup.
Diffstat (limited to 'tests/OffscreenContextGLX.cc')
-rw-r--r-- | tests/OffscreenContextGLX.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/OffscreenContextGLX.cc b/tests/OffscreenContextGLX.cc index 41f01f7..e607593 100644 --- a/tests/OffscreenContextGLX.cc +++ b/tests/OffscreenContextGLX.cc @@ -135,14 +135,15 @@ bool create_glx_dummy_window(OffscreenContext &ctx) */ int attributes[] = { - GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, + GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT | GLX_PIXMAP_BIT | GLX_PBUFFER_BIT, //support all 3, for OpenCSG GLX_RENDER_TYPE, GLX_RGBA_BIT, GLX_RED_SIZE, 8, GLX_GREEN_SIZE, 8, GLX_BLUE_SIZE, 8, - GLX_ALPHA_SIZE, 8, // extra stuff for fbo-disbaled on-screen testing. - GLX_DEPTH_SIZE, 24, + GLX_ALPHA_SIZE, 8, + GLX_DEPTH_SIZE, 24, // depth-stencil for OpenCSG GLX_STENCIL_SIZE, 8, + GLX_DOUBLEBUFFER, True, None }; @@ -169,6 +170,7 @@ bool create_glx_dummy_window(OffscreenContext &ctx) XSetWindowAttributes xwin_attr; int width = ctx.width; int height = ctx.height; + xwin_attr.background_pixmap = None; xwin_attr.background_pixel = 0; xwin_attr.border_pixel = 0; xwin_attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone); @@ -270,7 +272,6 @@ OffscreenContext *create_offscreen_context(int w, int h) cerr << "Unable to init GLEW: " << glewGetErrorString(err) << endl; return NULL; } - // cerr << glew_dump(0); ctx->fbo = fbo_new(); if (!fbo_init(ctx->fbo, w, h)) { @@ -299,6 +300,7 @@ bool teardown_offscreen_context(OffscreenContext *ctx) */ bool save_framebuffer(OffscreenContext *ctx, const char *filename) { + glXSwapBuffers(ctx->xdisplay, ctx->xwindow); if (!ctx || !filename) return false; int samplesPerPixel = 4; // R, G, B and A GLubyte pixels[ctx->width * ctx->height * samplesPerPixel]; |