VGUI has two main purposes: firstly, to provide an easy way to display OpenGL in a user-interface, and secondly, to allow users to write code once that will produce a simple user-interface on many platforms (UNIX, Linux and Windows)
For every supported GUI toolkit (eg. MFC, Qt, GTK), VGUI provides a vgui_adaptor (eg. vgui_mfc_adaptor, vgui_qt_adaptor, vgui_gtk_adaptor) that provides an interface to an OpenGL rendering area. This adaptor is plugged into a GUI and produces a rectangular area on which OpenGL can be displayed. The adaptor contains a tableau which is used to draw the OpenGL and to receive events from the user (see vgui_tableau).
Some of the most useful tableaux are:
You can write your GUI in, for example, MFC and use vgui_adaptor/vgui_tableau to produce an OpenGL area. In fact, this is what you will have to do if you want to produce a complicated or very professional looking user-interface.
Alternatively, you may also use VGUI to write a simple user-interface that will use native GUI toolkits on each platform. The same code written using VGUI can be used to generate user-interfaces in MFC on Windows or Qt on Linux, for example.
Here is an example using VGUI to display an image in a window:
* #include <vgui/vgui.h> * #include <vgui/vgui_image_tableau.h> * #include <vgui/vgui_viewer2D.h> * int main(int argc, char **argv) * { * vgui::init(argc, argv); * vgui_image_tableau_new image("my-image.jpg"); * vgui_viewer2D_tableau_new viewer(image); * return vgui::run(viewer, image->width(), image->height()); * } *
There are more examples for VGUI on the VXL webpage and in vgui/examples. Also xcv uses VGUI and you can find its code in oxl/xcv.
Joe Mundy is responsible for co-ordinating significant changes to vgui. http://sourceforge.net/sendmessage.php?touser=527125