QGLViewer - FAQ
What is libQGLViewer ?
libQGLViewer is a GPL free software C++ library which lets you
quickly start the development of a new 3D application. It is designed for 3D developers, who can
display and move around a 3D scene by simply providing the openGL orders that define their 3D
geometry. The viewer is designed to be as general as possible and is not designed for a specific 3D
application.
What is not libQGLViewer ?
libQGLViewer is not a 3D viewer that can be used directly to view 3D scenes in various formats
(well, there is a 3dsViewer example, but it is just a proof of concept). It
is more likely to be the starting point for the coding of such a viewer.
What is the difference with glut ?
Glut eases the creation of an
OpenGL window and lets you implements your own mouse and keyboard callback. In that sense, it is
very comparable to the Qt::QGLWidget class functionalities.
libQGLViewer is a higher level API: these default callback functions are already implemented and the
mouse can intuitively be used to move the camera (or any object of the scene) with no extra code
needed. Simple applications only have to define the draw function to be able to
visualize their scene. Although convenient for most applications, the default handlers can be
customized or entirely redefined if needed.
Rather than an openGL window API, libQGLViewer helps you create openGL 3D viewers.
What are the main features ?
libQGLViewer provides some useful classical functionalities such as a camera trackball, screenshot
saving, mouse manipulated frames, stereo display, camera point of view saving, full screen display,
keyFrames paths. See the features page for a more exhaustive listing.
Why is it based on Qt ?
As mentionned above, glut and the Qt::QGLWidget class provide similar
openGL window creation facilities with a callback framework. The clean Qt object
oriented design, the powerful GUI creation tools it provides and some of its functionalities
(framebuffer grabbing, image format abstration...) made us choose Qt for this library.
Why is Glut needed then ?
Glut is currently only used to draw text (such as the FPS display). This functionality is available
in Qt since version 3.1, and glut will soon be removed from the dependencies when Qt 3.1 is more
widely spread.
Who should use this library ?
Anyone who needs to visualize a 3D scene. libQGLViewer is currently used by Computer Graphics
research labs, industrials or game designers. It also has a strong pedagological interest, as it
allows students to very quickly develop their application and to focuss on what is drawned
instead of how to make the computer draw it.
How should I start ?
The main goal of libQGLViewer is to allow a student to have a complete 3D viewer application in less
than five minutes. Once the library is installed, the best way to
achieve this challenge is to start from one of the provided examples:
> cp -r /usr/share/doc/QGLViewer/examples/simpleViewer ~/
> cd simpleViewer
> qmake
> make
> simpleViewer
Your first program should execute and you can start customizing it. However, before you start
coding, you should discover the principles of the library and read a commented version of this example.
The black screen is back !
"I replaced the draw function by my code, and the screen remains black, just like with
the xxx library. I hate openGL !"
The classical openGL black screen is not supported by libQGLViewer :). There are probably two
reasons for your problem, as detailed in the introduction:
- The World coordinate system : when you start drawing in
draw, you are in the
world coordinate system: a fixed coordinate system, that is viewed by a moving camera. This
is different (but much more intuitive) than the standard camera-centered openGL default coordinate
system. The camera displacement and its associated projection matrix are handled by libQGLViewer:
simply remove any camera related code from the beginning of the draw function.
- The
sceneRadius : unlike lower level openGL APIs, libQGLViewer needs to have
few informations on what is displayed. Namely, you need to provide an estimation of your
scene radius (expressed in openGL units), and your scene center, if different from the world origin.
With these informations, libQGLViewer will be able to position the camera such that the entire scene
is visible, making black screens ancient history. See the principles page for
details.
Press 'A' to display the world axis and double click the mouse middle button to make the camera fit
the scene. You should at least see the axis.
It still look strange !
If your are still unable to get the results you had before switching to libQGLViewer, check that
your init function sets the default openGL state with glEnable(GL_LIGHTING, GL_FOG,
...) as you did before.
How can I redefine the mouse/keyboard behavior ?
See the mouse and keyboard pages for details.
Other questions can be send by
e-mail and will be added to this page.
Last modified on vendredi, juin 27 2003.