Re: [UFO-devel] Hallo Wieder - Clarification of my problem - I will pay $ for your consulting!
Status: Beta
Brought to you by:
schmidtjf
From: Johannes S. <sch...@us...> - 2007-05-11 12:28:36
|
Hi Andrew, I have to admit, that it isn't really outlined in detail, how to use images in LibUFO. If you want to pipe an array of chars representing an image, you can use UImageIO to create the basic image software buffer used in UFO. To get a hardware image (i.e. OpenGL image) usable in UFO, you need a UImage object. Usually, you shouldn't need to use the UGL_Image class directly. In short: Use the display image to convert the UImageIO object (the software buffer) to a UImage object (the hardware surface). UImage * UDisplay::createImage(UImageIO *); Longer version: Several backends handle hardware data differently (especially, how hardware surfaces are shared between contexts) The display object handles the whole connection to the underlying system and controls all data acquired by the system (for instance an OpenGL texture encapsulated in a UImage object). Therefore, the display object is responsible for all data/memory allocated by the system, as video devices, images, fonts, events etc. (this has changed a little bit over time, so this is usually done by the UXDisplay class, whereas the UDisplay class is still a bit limited). I have attached two files: A modified version of test/base.cpp, which reads in a char array, creates a UImageIO object, then a UImage object and uses this as Icon for a label. A header file called fuzzy.h which contains the image array (created with the GIMP). Compile it via: g++ -o base base.cpp `pkg-config --cflags --libs ufo` If you have the GIMP, you can create another image and save it as C header under the name "fuzzy.h", then recompile. If there are any problems understanding the code, please ask. Best regards, Johannes Am Freitag, 11. Mai 2007 03:43 schrieb hv...@st...: > Hi again, > > I'm having some serious trouble trying to figure out how to pass an image > so that libUFO displays it. I'm trying to follow the directions which you > outlined on this email that I found archived on the mailing list, but I > can't for the life of me get it to work. > > I'm really panicking, because I need to have this functionality working > soon. As far as I can tell from the specifications on sourceforge, > UGL_Image must be passed as an argument to UImage, and then you can pass > UImageIO as an argument to UGL_Image? (And UGL_Image can take a flat array > of unsigned char, each representing one color of a pixel). > > If you could write out a quick example which reads in an image from an > array or something (not a file, I can do that with UIcon) and explain a > bit how it functions I'd be happy to Paypal you $25 for all the time > you've spent helping me. Consider it a "donation" for all the hard work > you've put into this great toolkit! > > Mit sehr Freundlichen Grussen, > Andrew > > "It is not that trivial but it is possible. > > If you do not care about performance too much (at least in the beginning), > you can use the built-in image class (UImage) and assign this as icon of a > label (or button). > > That means, you create your own image buffer and feed it as RGB(A) data to > an UImageIO class, create an image and so on. I have attached a small > example (image.cpp) which shows how to do that (based on the base.cpp > example). Compile it via: > g++ -o image image.cpp `pkg-config --cflags --libs ufo` > > Otherwise you can draw the image yourself using OpenGL methods. To do > this, you have to subclass UWidget and override > UWidget::paintWidget(UGraphics*) with your own code (set up matrices and > OpenGL state, draw image, revert OpenGL matrices and states). " > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > LibUFO-devel mailing list > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/libufo-devel |