|
|
Here a small example program of that. Also, be sure to read : https://fltk.gitlab.io/fltk/opengl.html#opengl_normal
=================================
#include <FL/Fl_Window.H> #include <FL/Fl.H> #include <FL/fl_draw.H> #include <FL/gl.h>
class test : public Fl_Widget { public: test(int x, int y, int w, int h); void draw(); };
test::test(int x, int y, int w, int h) : Fl_Widget(x,y,w,h) { ; }
void test::draw() { fl_color(FL_WHITE); fl_font(0, 30); fl_draw("LABEL", 0, 50);
gl_start(); gl_color(FL_YELLOW); gl_rectf(0,0,w(),h()-100); gl_color(FL_RED); gl_rectf(10,10,100,100); gl_color(FL_BLACK); gl_font(0,24); const char *text = "Text€ç§δεфисвенг 新東"; //const char *text = "TextpgW"; int w, h; gl_measure(text, w, h); gl_rect(20, 20-fl_descent(), w, h); gl_draw(text, 20, 20); gl_draw("next"); gl_finish(); }
int main(int argc, char **argv) { Fl::gl_visual(FL_RGB); Fl_Window *mainwin = new Fl_Window(400, 400, "main"); new test(0,0,400,400); mainwin->end(); mainwin->resizable(mainwin); mainwin->show(); return Fl::run(); }
--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/40c307f6-4864-488e-9a5e-34ddfcb0d17fn%40googlegroups.com.
[ Direct Link to Message ] | |
|
| |