diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index 3da1908588b1be937eb61216f9b46bc61f3249ac..899503016d191edd70afc3612234acc1d60f1a90 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -128,11 +128,12 @@ GUI::GUI(int argc, char **argv) // e.g. directly loop through time steps with the keyboard) graph[0]->gl->take_focus(); - // test: create another graphic window - double mat[3][3]={{3,0,0}, {0,1,0}, {0,0,1}}; - drawContext *ctx = new drawContext(new drawTransformScaled(mat)); - graph.push_back(new graphicWindow(_fontsize, ctx)); - graph.back()->win->show(); + // test: create another graphic window, with a coordinate + // transformation + //graph.push_back(new graphicWindow(_fontsize)); + //drawTransform *tr = new drawTransformScaled(2,1,0, 0,1,0, 0,0,1); + //graph.back()->gl->getDrawContext()->setTransform(tr); + //graph.back()->win->show(); options = new optionWindow(_fontsize); fields = new fieldWindow(_fontsize); diff --git a/Fltk/graphicWindow.cpp b/Fltk/graphicWindow.cpp index 5e54b93b0cd4fb1c13278799b834c43226c46c45..8ea0885ce1ff4403f72f1d179649e6b9481ef884 100644 --- a/Fltk/graphicWindow.cpp +++ b/Fltk/graphicWindow.cpp @@ -278,7 +278,7 @@ static void status_stepforward_cb(Fl_Widget *w, void *data) status_play_manual(!CTX.post.anim_cycle, 1); } -graphicWindow::graphicWindow(int fontsize, drawContext *ctx) +graphicWindow::graphicWindow(int fontsize) { static bool first = true; if(first){ @@ -397,7 +397,7 @@ graphicWindow::graphicWindow(int fontsize, drawContext *ctx) win->resizable(resbox); // opengl window - gl = new openglWindow(0, 0, width, glheight, 0, ctx); + gl = new openglWindow(0, 0, width, glheight); int mode = FL_RGB | FL_DEPTH | (CTX.db ? FL_DOUBLE : FL_SINGLE); if(CTX.antialiasing) mode |= FL_MULTISAMPLE; gl->mode(mode); diff --git a/Fltk/graphicWindow.h b/Fltk/graphicWindow.h index b5386e7239e1b291ae28b4c0d4bccb6255a00ed0..266412126e883b556a1fd5b3ce3e1a0bef6fdc94 100644 --- a/Fltk/graphicWindow.h +++ b/Fltk/graphicWindow.h @@ -18,7 +18,7 @@ class graphicWindow{ Fl_Button *butt[12]; Fl_Box *label[2]; public: - graphicWindow(int fontsize, drawContext *ctx=0); + graphicWindow(int fontsize); void setAnimButtons(int mode); void checkAnimButtons(); }; diff --git a/Fltk/openglWindow.cpp b/Fltk/openglWindow.cpp index e37653d2c436107ac875dbb7f86fd9d10b5ae0f5..350e0320a9bcb19a41fd3821212407f343b6710c 100644 --- a/Fltk/openglWindow.cpp +++ b/Fltk/openglWindow.cpp @@ -68,9 +68,8 @@ static void lassoZoom(drawContext *ctx, mousePosition &click1, mousePosition &cl GUI::instance()->manip->update(); } -openglWindow::openglWindow(int x, int y, int w, int h, const char *l, - drawContext *ctx) - : _ctx(ctx), Fl_Gl_Window(x, y, w, h, l) +openglWindow::openglWindow(int x, int y, int w, int h, const char *l) + : Fl_Gl_Window(x, y, w, h, l) { addPointMode = lassoMode = selectionMode = false; selection = ENT_NONE; @@ -78,8 +77,7 @@ openglWindow::openglWindow(int x, int y, int w, int h, const char *l, undoSelection = invertSelection = 0; for(int i = 0; i < 4; i++) trySelectionXYWH[i] = 0; _point[0] = _point[1] = _point[2] = 0.; - // create default draw context if none given - if(!_ctx) _ctx = new drawContext(); + _ctx = new drawContext(); } openglWindow::~openglWindow() diff --git a/Fltk/openglWindow.h b/Fltk/openglWindow.h index 67f5d8599f0ca89decb074de7adccc9a7c766a0b..762e06f08dac7399bbd2529c6f8b8aee2f70cbe6 100644 --- a/Fltk/openglWindow.h +++ b/Fltk/openglWindow.h @@ -60,8 +60,7 @@ class openglWindow : public Fl_Gl_Window { public: bool addPointMode, lassoMode, selectionMode; int endSelection, undoSelection, invertSelection, quitSelection; - openglWindow(int x, int y, int w, int h, const char *l=0, - drawContext *ctx=0); + openglWindow(int x, int y, int w, int h, const char *l=0); ~openglWindow(); drawContext *getDrawContext(){ return _ctx; } char selectEntity(int type, diff --git a/Graphics/drawContext.h b/Graphics/drawContext.h index adf3fbbd35eeb6512dd5dd73627623ad2e935f9f..87824af945b92a4eaf6250c09fff9aa8d0b1dea8 100644 --- a/Graphics/drawContext.h +++ b/Graphics/drawContext.h @@ -17,24 +17,19 @@ class drawTransform { class drawTransformScaled : public drawTransform { private: - bool _identityTransform; double _mat[3][3]; public: - drawTransformScaled(double mat[3][3]) : drawTransform() + drawTransformScaled(double a11, double a12, double a13, + double a21, double a22, double a23, + double a31, double a32, double a33) + : drawTransform() { - if(mat[0][0] != 1. || mat[0][1] != 0. || mat[0][2] != 0. || - mat[1][0] != 0. || mat[1][1] != 1. || mat[1][2] != 0. || - mat[2][0] != 0. || mat[2][1] != 0. || mat[2][2] != 1.) - _identityTransform = false; - else - _identityTransform = true; - for(int i = 0; i < 3; i++) - for(int j = 0; j < 3; j++) - _mat[i][j] = mat[i][j]; + _mat[0][0] = a11; _mat[0][1] = a12; _mat[0][2] = a13; + _mat[1][0] = a21; _mat[1][1] = a22; _mat[1][2] = a23; + _mat[2][0] = a31; _mat[2][1] = a32; _mat[2][2] = a33; } virtual void transform(double &x, double &y, double &z) { - if(_identityTransform) return; double xyz[3] = {x, y, z}; x = y = z = 0.; for(int k = 0; k < 3; k++){