mirror of https://github.com/vitalif/openscad
properly indent code
parent
f8ebf1c963
commit
466490a55a
|
@ -11,7 +11,7 @@ void bind_offscreen_context(OffscreenContext *ctx)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Capture framebuffer from OpenGL and write it to the given filename as PNG.
|
Capture framebuffer from OpenGL and write it to the given filename as PNG.
|
||||||
*/
|
*/
|
||||||
bool save_framebuffer(OffscreenContext *ctx, const char *filename)
|
bool save_framebuffer(OffscreenContext *ctx, const char *filename)
|
||||||
{
|
{
|
||||||
std::ofstream fstream(filename,std::ios::out|std::ios::binary);
|
std::ofstream fstream(filename,std::ios::out|std::ios::binary);
|
||||||
|
@ -28,7 +28,7 @@ bool save_framebuffer(OffscreenContext *ctx, const char *filename)
|
||||||
/*!
|
/*!
|
||||||
Capture framebuffer from OpenGL and write it to the given ostream.
|
Capture framebuffer from OpenGL and write it to the given ostream.
|
||||||
Called by save_framebuffer() from platform-specific code.
|
Called by save_framebuffer() from platform-specific code.
|
||||||
*/
|
*/
|
||||||
bool save_framebuffer_common(OffscreenContext *ctx, std::ostream &output)
|
bool save_framebuffer_common(OffscreenContext *ctx, std::ostream &output)
|
||||||
{
|
{
|
||||||
if (!ctx) return false;
|
if (!ctx) return false;
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
|
|
||||||
Create an OpenGL context without creating an OpenGL Window. for Linux.
|
Create an OpenGL context without creating an OpenGL Window. for Linux.
|
||||||
|
|
||||||
See Also
|
See also
|
||||||
|
|
||||||
glxgears.c by Brian Paul from mesa-demos (mesa3d.org)
|
glxgears.c by Brian Paul from mesa-demos (mesa3d.org)
|
||||||
http://cgit.freedesktop.org/mesa/demos/tree/src/xdemos?id=mesa-demos-8.0.1
|
http://cgit.freedesktop.org/mesa/demos/tree/src/xdemos?id=mesa-demos-8.0.1
|
||||||
http://www.opengl.org/sdk/docs/man/xhtml/glXIntro.xml
|
http://www.opengl.org/sdk/docs/man/xhtml/glXIntro.xml
|
||||||
http://www.mesa3d.org/brianp/sig97/offscrn.htm
|
http://www.mesa3d.org/brianp/sig97/offscrn.htm
|
||||||
http://glprogramming.com/blue/ch07.html
|
http://glprogramming.com/blue/ch07.html
|
||||||
OffscreenContext.mm (Mac OSX version)
|
OffscreenContext.mm (Mac OSX version)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ static int XCreateWindow_error(Display *dpy, XErrorEvent *event)
|
||||||
|
|
||||||
bool create_glx_dummy_window(OffscreenContext &ctx)
|
bool create_glx_dummy_window(OffscreenContext &ctx)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
create a dummy X window without showing it. (without 'mapping' it)
|
create a dummy X window without showing it. (without 'mapping' it)
|
||||||
and save information to the ctx.
|
and save information to the ctx.
|
||||||
|
|
||||||
|
@ -224,12 +224,12 @@ bool create_glx_dummy_window(OffscreenContext &ctx)
|
||||||
XFree( fbconfigs );
|
XFree( fbconfigs );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool create_glx_dummy_context(OffscreenContext &ctx);
|
Bool create_glx_dummy_context(OffscreenContext &ctx);
|
||||||
|
|
||||||
OffscreenContext *create_offscreen_context(int w, int h)
|
OffscreenContext *create_offscreen_context(int w, int h)
|
||||||
{
|
{
|
||||||
OffscreenContext *ctx = new OffscreenContext;
|
OffscreenContext *ctx = new OffscreenContext;
|
||||||
offscreen_context_init( *ctx, w, h );
|
offscreen_context_init( *ctx, w, h );
|
||||||
|
|
||||||
|
@ -241,10 +241,10 @@ OffscreenContext *create_offscreen_context(int w, int h)
|
||||||
}
|
}
|
||||||
|
|
||||||
return create_offscreen_context_common( ctx );
|
return create_offscreen_context_common( ctx );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool teardown_offscreen_context(OffscreenContext *ctx)
|
bool teardown_offscreen_context(OffscreenContext *ctx)
|
||||||
{
|
{
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
fbo_unbind(ctx->fbo);
|
fbo_unbind(ctx->fbo);
|
||||||
fbo_delete(ctx->fbo);
|
fbo_delete(ctx->fbo);
|
||||||
|
@ -254,17 +254,17 @@ bool teardown_offscreen_context(OffscreenContext *ctx)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool save_framebuffer(OffscreenContext *ctx, std::ostream &output)
|
bool save_framebuffer(OffscreenContext *ctx, std::ostream &output)
|
||||||
{
|
{
|
||||||
glXSwapBuffers(ctx->xdisplay, ctx->xwindow);
|
glXSwapBuffers(ctx->xdisplay, ctx->xwindow);
|
||||||
return save_framebuffer_common(ctx, output);
|
return save_framebuffer_common(ctx, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma GCC diagnostic ignored "-Waddress"
|
#pragma GCC diagnostic ignored "-Waddress"
|
||||||
Bool create_glx_dummy_context(OffscreenContext &ctx)
|
Bool create_glx_dummy_context(OffscreenContext &ctx)
|
||||||
{
|
{
|
||||||
// This will alter ctx.openGLContext and ctx.xdisplay and ctx.xwindow if successfull
|
// This will alter ctx.openGLContext and ctx.xdisplay and ctx.xwindow if successfull
|
||||||
int major;
|
int major;
|
||||||
int minor;
|
int minor;
|
||||||
|
@ -289,5 +289,5 @@ Bool create_glx_dummy_context(OffscreenContext &ctx)
|
||||||
|
|
||||||
if (!result) XCloseDisplay( ctx.xdisplay );
|
if (!result) XCloseDisplay( ctx.xdisplay );
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue