On 05/18/12 23:21, david_ai...@yahoo.com wrote: > 1. the OpenGL window overlaps all of the wizard pages. It should only appear > on the first page.
Oh, and besides moving the creation of the window, I think your Fl_Group's are oddly positioned. Can you say why you're using: Fl_Group *g = new Fl_Group(0, H-60, W, 60); : Fl_Group *g = new Fl_Group(0, H-60, W, 60); : Fl_Group *g = new Fl_Group(0, H-60, W, 60); ..instead of: Fl_Group *g = new Fl_Group(0, 0, W, H); : Fl_Group *g = new Fl_Group(0, 0, W, H); : Fl_Group *g = new Fl_Group(0, 0, W, H); I think if you use the latter, and the mod in my last post, things will work. I think if you were to change the box() type for your groups to FL_FLAT_BOX and set the color() to FL_RED, you'd see where the groups were being positioned, and why you were getting strange drawing artifacts. (children should be positioned within Fl_Group, and if they are positioned outside of it, they draw oddly) FWIW, the following works for me, and can be compiled with 'fltk-config --compile -use-gl foo.cxx'. Changed the casing on some of the include files to get it to build on linux (which cares about case). I'm only resolving question #1 and #3, #2 is a separate issue that is pretty well covered elsewhere on resizable() behavior, eg: http://fltk.org/articles.php?L415 --------------------------------------------------------------------- #include <stdlib.h> #include <FL/Fl.H> #include <FL/Fl_Window.H> #include <FL/Fl_Gl_Window.H> #include <FL/Fl_Group.H> #include <FL/Fl_Wizard.H> #include <FL/Fl_Button.H> #include <FL/Fl_Multiline_Output.H> #include <FL/gl.h> class MyGlWindow : public Fl_Gl_Window { // FIX OPENGL VIEWPORT // Do this on init or when window's size is changed void FixViewport(int W,int H) { glLoadIdentity(); glViewport(0,0,W,H); glOrtho(-W,W,-H,H,-1,1); } // DRAW METHOD void draw() { if (!valid()) { valid(1); FixViewport(w(), h()); } // first time? init // Clear screen to bg color glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT); // Draw 'X' in fg color glColor3f(1, 1, 1); glBegin(GL_LINE_STRIP); glVertex2f(w(), h()); glVertex2f(-w(),-h()); glEnd(); glBegin(GL_LINE_STRIP); glVertex2f(w(),-h()); glVertex2f(-w(), h()); glEnd(); } // HANDLE WINDOW RESIZING void resize(int X,int Y,int W,int H) { Fl_Gl_Window::resize(X,Y,W,H); FixViewport(W,H); redraw(); } public: // OPENGL WINDOW CONSTRUCTOR MyGlWindow(int X,int Y,int W,int H,const char*L=0) : Fl_Gl_Window(X,Y,W,H,L) { end(); } }; Fl_Wizard *G_wiz = 0; void back_cb(Fl_Widget*,void*) { G_wiz->prev(); } void next_cb(Fl_Widget*,void*) { G_wiz->next(); } void done_cb(Fl_Widget*,void*) { exit(0); } class MyAppWindow : public Fl_Window { MyGlWindow *mygl; // opengl window public: // APP WINDOW CONSTRUCTOR MyAppWindow(int W,int H,const char*L=0) : Fl_Window(W,H,L) { G_wiz = new Fl_Wizard(0,0,W,H); // Wizard: page 1 { Fl_Group *g = new Fl_Group(0, 0, W, H); Fl_Button *next = new Fl_Button(290,H-30,100,25,"Next"); next->callback(next_cb); mygl = new MyGlWindow(10, 10, W-20, H-80); g->end(); } // Wizard: page 2 G_wiz->begin(); { Fl_Group *g = new Fl_Group(0,0,W,H); Fl_Button *next = new Fl_Button(290,H-30,100,25,"Next"); next->callback(next_cb); Fl_Button *back = new Fl_Button(120,H-30,100,25,"Back"); back->callback(back_cb); Fl_Multiline_Output *out = new Fl_Multiline_Output(10,30,W-20,H-80,"Terms And Conditions"); out->labelsize(20); out->align(FL_ALIGN_TOP|FL_ALIGN_LEFT); out->value("This is the Second page"); g->end(); } G_wiz->end(); // Wizard: page 3 G_wiz->begin(); { Fl_Group *g = new Fl_Group(0,0,W,H); Fl_Button *done = new Fl_Button(290,H-30,100,25,"Finish"); done->callback(done_cb); Fl_Button *back = new Fl_Button(120,H-30,100,25,"Back"); back->callback(back_cb); Fl_Multiline_Output *out = new Fl_Multiline_Output(10,30,W-20,H-80,"Finish"); out->labelsize(20); out->align(FL_ALIGN_TOP|FL_ALIGN_LEFT); out->value("This is the Last page"); g->end(); } G_wiz->end(); end(); } }; // Simple 'wizard' using fltk's new Fl_Wizard widget Fl_Window *G_win = 0; int main(int argc, char **argv) { int w = 500, h=300; G_win = new MyAppWindow(w,h,"Example Wizard"); G_win->resizable(G_win); G_win->end(); G_win->show(argc, argv); return Fl::run(); } _______________________________________________ fltk-opengl mailing list fltk-opengl@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-opengl