diff options
author | Marius Kintel <marius@kintel.net> | 2013-03-28 03:55:51 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-03-28 03:55:51 (GMT) |
commit | eefcd6d0b271642d470cd55bc47d1579d943938e (patch) | |
tree | 48f9e4db455879025adb9317b740bfa4b72c2d66 /src/OffscreenView.cc | |
parent | f70578f362c8c2c78036c9de846c20802ac7aa81 (diff) | |
parent | beff2b1f4811b7f9d2b58bfc6a469a363bc9bfd0 (diff) |
Merge branch 'master' into epec-kernel
Conflicts:
src/PolySetCGALEvaluator.cc
Diffstat (limited to 'src/OffscreenView.cc')
-rw-r--r-- | src/OffscreenView.cc | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/OffscreenView.cc b/src/OffscreenView.cc new file mode 100644 index 0000000..2186eb1 --- /dev/null +++ b/src/OffscreenView.cc @@ -0,0 +1,49 @@ +#include <GL/glew.h> +#include "OffscreenView.h" +#include "system-gl.h" +#include <math.h> +#include <stdio.h> +#include <string.h> +#include <cstdlib> +#include <sstream> +#include "printutils.h" + +OffscreenView::OffscreenView(size_t width, size_t height) +{ + this->ctx = create_offscreen_context(width, height); + if ( this->ctx == NULL ) throw -1; + GLView::initializeGL(); + GLView::resizeGL(width, height); +} + +OffscreenView::~OffscreenView() +{ + teardown_offscreen_context(this->ctx); +} + +#ifdef ENABLE_OPENCSG +void OffscreenView::display_opencsg_warning() +{ + PRINT("OpenSCAD recommended OpenGL version is 2.0."); +} +#endif + +bool OffscreenView::save(const char *filename) +{ + return save_framebuffer(this->ctx, filename); +} + +bool OffscreenView::save(std::ostream &output) +{ + return save_framebuffer(this->ctx, output); +} + +std::string OffscreenView::getRendererInfo() const +{ + std::stringstream out; + + out << glew_dump() + << offscreen_context_getinfo(this->ctx); + + return out.str(); +} |