#include /* time() */ #include /* srand() */ #include #include #include #include #include #include #include #include "SierpinskiDA.h" int main(int argc, char * argv[]) { Gtk::Main gtkmain(argc, argv); Gtk::GL::init(argc, argv); Glib::RefPtr glconfig; glconfig = Gdk::GL::Config::create(Gdk::GL::MODE_RGB | Gdk::GL::MODE_DEPTH | Gdk::GL::MODE_DOUBLE); if (!glconfig) { std::cerr << "Could not create double-buffered GL visual" << "Trying single-buffered visual." << std::endl; glconfig = Gdk::GL::Config::create(Gdk::GL::MODE_RGB | Gdk::GL::MODE_DEPTH); if (!glconfig) { std::cerr << "Cannot create OpenGL context!" << std::endl; return -1; } } srand(time(NULL)); Gtk::Window mw; mw.set_default_size(400, 420); Gtk::VBox vbox; SierpinskiDA da(glconfig); vbox.pack_start(da); Gtk::HBox hbox; Gtk::Label lbl("# of points:"); hbox.pack_start(lbl, false, false); Gtk::Entry num_points_e; hbox.pack_start(num_points_e, true, true); Gtk::Button regenerate_btn("_Regenerate", true); hbox.pack_start(regenerate_btn, false, false); vbox.pack_start(hbox, Gtk::PACK_SHRINK); mw.add(vbox); mw.show_all(); Gtk::Main::run(mw); return 0; }