init()
function is never called !draw()
function, and the screen remains black. I hate OpenGL !"
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) from the standard camera-centered OpenGL coordinate
system. The camera displacement and its associated projection matrix are handled by libQGLViewer:
simply remove any camera related code from the beginning of your draw()
function.init
function sets the default OpenGL state with glEnable(GL_LIGHTING, GL_FOG,
...)
as you did before. Also note that libQGLViewer slightly changes the default OpenGL state
: see the QGLViewer::initializeGL()
documentation.
manipulatedFrame
or a MouseGrabber
, depending on the context. By default, the mouse is used to move the
camera, as in classical 3D viewers. With a specific state key (default is Control
), it
is the manipulatedFrame
that receives the mouse events. The state keys can of course
be customized. The MouseGrabber
is described below.
ManipulatedFrame
is a
Frame (position and orientation in 3D) that can directly be moved with the mouse. It is used to move
objects in your scene, see the ManipulatedFrame example.
Frame
class represents a
position and orientation in 3D. These frames can be organized in a hierarchy and convenient
conversion functions are provided. The OpenGL code should reflect this organization, as is detailed
in the Frame detailed description.
vector
) that holds the pointers to the
different ManipulatedFrame
you have created. Use setManipulatedFrame()
to
decide which of them is active at a given time. See the Luxo
example for an illustration.
ManipulatedFrame
are MouseGrabbers
,
see the MouseGrabber example for an illustration.
You may have to connect additional signals to synchronize viewers' displays. A ManipulatedFrame
displayed
by several viewers will typically have its manipulated
signal connected to the other
viewers' updateGL()
slots.
QGLViewer
constructors'
documentations.
makeCurrent()
to do this.
F
key to toggle the frame rate display. It is computed as an average over 30
frames. Since the display is updated only when needed, the frame rate is valid only when you display
in a loop (such as when you move the camera with the mouse).
If you want to know the maximum possible frame rate of your machine on a given scene, you should
setAnimationPeriod(0)
and turn on the animation (by pressing Enter
). The
display will then be updated as quickly as possible, and the frame rate will be meaningful.
qtconfig
to fix
this if needed.
init()
function is never called !initializeGL()
: bad idea since it is this function that
calls init()
in QGLViewer. Move your code to init()
and remove your
initializeGL()
overloading.
Second reason : you call updateGL()
in your constructor, even indirectly. This calls
init()
, but at that point, virtual functions are not defined and it is the
QGLViewer::init()
that is called. Move all OpenGL specific code out of the constructor
into init()
.
renderText
method uses display lists to display characters. If you use more than
2000 display lists, they may overlap. See the drawText
documentation.
Other questions can be sent by e-mail and will be added to this page. See also the General FAQ.