Here a small example program of that.
Also, be sure to read :
=================================
#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();
}