From 009baca90428399d4e3540bff18510ef51a28454 Mon Sep 17 00:00:00 2001 From: don bright Date: Thu, 24 Jan 2013 04:10:24 +0100 Subject: [PATCH] move imageutils platform stuff to qmake build file mv system-gl. fix gcc warning --- openscad.pro | 5 +++- src/fbo.cc | 2 +- src/imageutils-lodepng.cc | 1 + src/imageutils.cc | 6 ----- src/system-gl.h | 12 +++------- tests/system-gl.cc | 50 --------------------------------------- tests/system-gl.h | 10 -------- 7 files changed, 9 insertions(+), 77 deletions(-) delete mode 100644 tests/system-gl.cc delete mode 100644 tests/system-gl.h diff --git a/openscad.pro b/openscad.pro index 1edf97c7..c79551e0 100644 --- a/openscad.pro +++ b/openscad.pro @@ -235,7 +235,8 @@ HEADERS += src/version_check.h \ src/OffscreenContext.h \ src/OffscreenView.h \ src/fbo.h \ - src/imageutils.h + src/imageutils.h \ + src/system-gl.h SOURCES += src/version_check.cc \ src/ProgressWidget.cc \ @@ -295,6 +296,8 @@ SOURCES += src/version_check.cc \ src/svg.cc \ src/OffscreenView.cc \ src/fbo.cc \ + src/system-gl.cc \ + src/imageutils.cc \ \ src/openscad.cc \ src/mainwin.cc diff --git a/src/fbo.cc b/src/fbo.cc index a6677c16..e12c2958 100644 --- a/src/fbo.cc +++ b/src/fbo.cc @@ -59,7 +59,7 @@ bool check_fbo_status() else if (status == GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT) cerr << "GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT\n"; else - cerr << "Unknown Code: glCheckFramebufferStatusEXT returned %i\n",status; + cerr << "Unknown Code: glCheckFramebufferStatusEXT returned:" < +#include bool write_png(const char *filename, unsigned char *pixels, int width, int height) { diff --git a/src/imageutils.cc b/src/imageutils.cc index e15ba2b0..7ee14e9c 100644 --- a/src/imageutils.cc +++ b/src/imageutils.cc @@ -8,9 +8,3 @@ void flip_image(const unsigned char *src, unsigned char *dst, size_t pixelsize, memmove(dst + (height - i - 1) * rowBytes, src + i * rowBytes, rowBytes); } } - -#ifdef __APPLE__ -#include "imageutils-macosx.cc" -#else -#include "imageutils-lodepng.cc" -#endif diff --git a/src/system-gl.h b/src/system-gl.h index d7de3c6d..4a8ccac1 100644 --- a/src/system-gl.h +++ b/src/system-gl.h @@ -2,15 +2,9 @@ #define SYSTEMGL_H_ #include +#include -#ifdef __APPLE__ - #include -#else - #include - #include - #ifdef _WIN32 - #include // For the CALLBACK macro - #endif -#endif +std::string glew_dump(bool dumpall=false); +bool report_glerror(const char *task); #endif diff --git a/tests/system-gl.cc b/tests/system-gl.cc deleted file mode 100644 index 2e3f3bc0..00000000 --- a/tests/system-gl.cc +++ /dev/null @@ -1,50 +0,0 @@ - -/* OpenGL helper functions */ - -#include -#include -#include -#include "system-gl.h" -#include - -using namespace std; -using namespace boost; - -string glew_dump(bool dumpall) -{ - stringstream out; - out << "GLEW version: " << glewGetString(GLEW_VERSION) << endl - << "GL Renderer: " << (const char *)glGetString(GL_RENDERER) << endl - << "GL Vendor: " << (const char *)glGetString(GL_VENDOR) << endl - << "OpenGL Version: " << (const char *)glGetString(GL_VERSION) << endl; - - out << "GL Extensions: " << endl; - if (dumpall) { - string extensions((const char *)glGetString(GL_EXTENSIONS)); - replace_all( extensions, " ", "\n " ); - out << " " << extensions << endl; - } - - out << "GL_ARB_framebuffer_object: " - << (glewIsSupported("GL_ARB_framebuffer_object") ? "yes" : "no") - << endl - << "GL_EXT_framebuffer_object: " - << (glewIsSupported("GL_EXT_framebuffer_object") ? "yes" : "no") - << endl - << "GL_EXT_packed_depth_stencil: " - << (glewIsSupported("GL_EXT_packed_depth_stencil") ? "yes" : "no") - << endl; - - return out.str(); -}; - -bool report_glerror(const char * function) -{ - GLenum tGLErr = glGetError(); - if (tGLErr != GL_NO_ERROR) { - cerr << "OpenGL error 0x" << hex << tGLErr << ": " << gluErrorString(tGLErr) << " after " << function << endl; - return true; - } - return false; -} - diff --git a/tests/system-gl.h b/tests/system-gl.h deleted file mode 100644 index 4a8ccac1..00000000 --- a/tests/system-gl.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef SYSTEMGL_H_ -#define SYSTEMGL_H_ - -#include -#include - -std::string glew_dump(bool dumpall=false); -bool report_glerror(const char *task); - -#endif