diff --git a/src/OffscreenContextNULL.cc b/src/OffscreenContextNULL.cc new file mode 100644 index 00000000..bcf9ff66 --- /dev/null +++ b/src/OffscreenContextNULL.cc @@ -0,0 +1,66 @@ +/* + +Create an NULL OpenGL context that doesnt actually use any OpenGL code, +and can be compiled on a system without OpenGL. + +*/ + +#include + +#include "OffscreenContext.h" +#include "printutils.h" +#include "imageutils.h" + +#include +#include +#include + +using namespace std; + +struct OffscreenContext +{ + int width; + int height; +}; + +void offscreen_context_init(OffscreenContext &ctx, int width, int height) +{ + ctx.width = width; + ctx.height = height; +} + +string offscreen_context_getinfo(OffscreenContext *ctx) +{ + return string("NULLGL"); +} + +OffscreenContext *create_offscreen_context(int w, int h) +{ + OffscreenContext *ctx = new OffscreenContext; + offscreen_context_init( *ctx, w, h ); +} + +bool teardown_offscreen_context(OffscreenContext *ctx) +{ + return true; +} + +bool save_framebuffer(OffscreenContext *ctx, char const * filename) +{ + std::ofstream fstream(filename,std::ios::out|std::ios::binary); + if (!fstream.is_open()) { + std::cerr << "Can't open file " << filename << " for writing"; + return false; + } else { + save_framebuffer(ctx, fstream); + fstream.close(); + } + return true; +} + +bool save_framebuffer(OffscreenContext *ctx, std::ostream &output) +{ + output << "NULLGL framebuffer"; + return true; +} + diff --git a/src/grid.h b/src/grid.h index c6cc7d25..913623c7 100644 --- a/src/grid.h +++ b/src/grid.h @@ -11,8 +11,14 @@ typedef __int64 int64_t; #include #include -const double GRID_COARSE = 0.001; -const double GRID_FINE = 0.000001; +//const double GRID_COARSE = 0.001; +//const double GRID_FINE = 0.000001; +/* Using decimals that are exactly convertible to binary floating point +(and then converted exactly to GMPQ Rational in CGAL's engine) provides +at least a 5% speedup for ctest -R CGAL. We choose 1/1024 and 1/(1024*1024) +In python: print '%.64f' % float(fractions.Fraction(1,1024)) */ +const double GRID_COARSE = 0.0009765625; +const double GRID_FINE = 0.00000095367431640625; template class Grid2d