DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New]
Link: http://www.fltk.org/str.php?L2595
Version: 1.3-current
Deleting OpenGL windows with the new Cocoa Mac version leads to crashes.
To trigger the issue:
- compile the small example (fltk-config --use-gl --compile gldelete.cpp)
- run the code and press 'd' (this should delete the OpenGL window, then
recreate a new one)
On my machine the code crashes with the new Cocoa version. It works fine
with fltk 1.1 (Carbon).
Link: http://www.fltk.org/str.php?L2595
Version: 1.3-current
// compile with "fltk-config --use-gl --compile gldelete.cpp"
//
// run code, then press 'd'
// - expected behaviour: the opengl window is deleted and replaced
// with a new one
// - observed behaviour: code crashes
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Tile.H>
#include <FL/Fl_Gl_Window.H>
#if defined(__APPLE__)
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <GL/gl.h>
#include <GL/glu.h>
#endif
class openglWindow : public Fl_Gl_Window{
public:
openglWindow(int x, int y, int w, int h) : Fl_Gl_Window(x, y, w, h){}
void draw()
{
glClearColor(0.5, 0.3, 0.8, 0.);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
}
};
Fl_Tile *tile;
int shortcuts(int event)
{
if(Fl::test_shortcut('d')){
tile->clear();
openglWindow *gl = new openglWindow(0, 0, 400, 400);
gl->end();
gl->mode(FL_RGB | FL_DEPTH | FL_DOUBLE);
tile->add(gl);
gl->show();
}
return 1;
}
int main(int argc, char **argv)
{
Fl_Window *win = new Fl_Window(0, 0, 400, 400);
tile = new Fl_Tile(0, 0, 400, 400);
openglWindow *gl = new openglWindow(0, 0, 400, 400);
gl->end();
gl->mode(FL_RGB | FL_DEPTH | FL_DOUBLE);
tile->end();
win->end();
win->show(argc, argv);
Fl::add_handler(shortcuts);
Fl::run();
}
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs