dmitry wrote: > > It seems to me that it is possible to render the Fl_Double_Window or > Fl_Window to memory as a bitmap. But how? > > I am interested in using this option to create gl textures from such bitmaps. > Is it Possible? And how? > >
// image size, in the power of two to have it compatible // with opengl texture sizes int w = 256; int h = 256; unsigned char * image_data = new unsigned char[w*h*3]; // creating screen-compatible, platform dependent offscreen drawable Fl_Offscreen o = fl_creare_ofscreen(w, h); // making it current fl_begin_offscreen(o); // place your fltk drawings here ... ... ... // reading the data from the drawable to the RGB memory fl_read_image(image_data, 0, 0, w, h); // setting back previous drawable as current fl_end_offscreen(); // deleting offscreen fl_delete_offscreen(o); OpenGL code: // create your texture and load data to it, ie: GLuint texture_id; glGenTextures(1, &texture_id); if(!texture_id) // something wrong... handle_error(); // make the texture current glBindTexture(GL_TEXTURE_2D, texture_id); // set your other texture property here, like // GL_TEXTURE_MIN_FILTER, // GL_TEXTURE_MAG_FILTER, // GL_TEXTURE_WRAP_S, // GL_TEXTURE_WRAP_T // loading data eg using glu and building mipmaps for nice scaling gluBuild2DMipmaps(GL_TEXTURE_2D, 3, w, h, GL_RGB, GL_UNSIGNED_BYTE, image_data); // delete image data not needed any more delete[] image_data; Your texture is now loaded with the identifier texture_id Look for fl_create_offscreen(), fl_begin_offscreen(), fl_end_offscreen() and fl_read_image() functions in the documentation. R. _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

