diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2019-11-08 13:58:28 +0100 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2019-11-08 13:58:28 +0100 |
| commit | 28ddf84793d58b097c67ad0fca950f8e9e9c48c0 (patch) | |
| tree | e1c0f0e4fba0bf9ab3d645574bebc0393195bda0 /test | |
| parent | cc4801133f940a1b321c741659aef61ddf1c394b (diff) | |
Fix cube demo if OpenGL is not available
(1) Fix a compilation error
(2) Fix high CPU usage
Diffstat (limited to 'test')
| -rw-r--r-- | test/cube.cxx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/test/cube.cxx b/test/cube.cxx index 36cd43e0b..725f6c31e 100644 --- a/test/cube.cxx +++ b/test/cube.cxx @@ -1,11 +1,11 @@ // // "$Id$" // -// Another forms test program for the Fast Light Tool Kit (FLTK). +// OpenGL test program for the Fast Light Tool Kit (FLTK). // // Modified to have 2 cubes to test multiple OpenGL contexts // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2019 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -145,12 +145,16 @@ void makeform(const char *name) { flat = new Fl_Radio_Light_Button(390,50,100,30,"Flat"); button = new Fl_Button(390,340,100,30,"Exit"); cube = new cube_box(23,23,344,344, 0); + +#if HAVE_GL if (Fl::cfg_gfx_opengl) { // try to overlay a button onto an OpenGL window cube->begin(); Fl_Button *test = new Fl_Button(35, 105, 100, 30, "Test"); test->box(FL_ROUND_UP_BOX); cube->end(); } +#endif // HAVE_GL + cube2 = new cube_box(513,23,344,344, 0); Fl_Box *b = new Fl_Box(FL_NO_BOX,cube->x(),size->y(), cube->w(),size->h(),0); @@ -195,7 +199,11 @@ int main(int argc, char **argv) { form->end(); // end of printing demo speed->bounds(4,0); +#if HAVE_GL speed->value(cube->speed = cube2->speed = 1.0); +#else + speed->value(cube->speed = cube2->speed = 0.0); +#endif size->bounds(4,0.01); size->value(cube->size = cube2->size = 1.0); flat->value(1); cube->wire = 0; cube2->wire = 1; |
