libQGLViewer examples

»»   Introduction
»»   Basic examples
»»   Pedagogical examples
»»   More complex examples

Introduction

Many pedagogical examples illustrate some of the functionalities of the viewer and are provided for understanding and cut and paste. They were not designed to be impressive, but to demonstrate what can be achieved with few lines of code.

One should first try the basic examples listed below and read the introduction page to understand the philosophy of the library. See also the compilation with libQGLViewer page to learn how to create your first program.

Basic examples

simpleViewer
simpleViewer

The simplest application example: 20 lines of code and yet all the power !
manipulatedFrame
manipulatedFrame

A ManipulatedFrame can be moved with the mouse in the scene.
select
select

Selection of scene objects using select() and an GL_SELECT render mode.
keyboardAndMouse
keyboardAndMouse

Shows how to customize your keyboard and mouse bindings.

Pedagogical examples

animation
animation

The animate() function illustrated by a water particle simulation.
callback
callback

Using the Qt signal-slot mechanism to connect a QGLViewer to your scene.
cameraLight
cameraLight

This example shows how to position a GL_LIGHT on the camera.
clippingPlane
clippingPlane

A clipping plane is manipulated using a ManipulatedFrame
constrainedCamera
constrainedCamera

Constraints applied on the Camera Frame to limit its translation and/or rotation.
constrainedFrame
constrainedFrame

Constraints can limit the translation and/or rotation of a (Manipulated)Frame.
drawLight
drawLight

The drawLight() function is a light debugging tool.
fastDraw
fastDraw

The fastDraw() function enables interactivity even with large scenes.
frameTransform
frameTransform

Coordinate transformation between different Frames.
frustumCulling
frustumCulling

Frustum culling using getFrustumPlanesCoefficients.
interface
interface

Adding a graphical user interface around a QGLViewer.
keyFrames
keyFrames

The KeyFrameInterpolator test example.
luxo
luxo

A more complex example that combines ManipulatedFrames, selection and constraints.
mouseGrabber
mouseGrabber

MouseGrabbers enable complex mouse interaction.
multiSelect
multiSelect

Customized select() function that enables the selection of several objects.
multiView
multiView

A multi-view application, with constrained camera displacements.
overpainting
overpainting

Mixing OpenGL (3D) and QPainter (2D) drawing in the same viewer.
screenCoordSystem
screenCoordSystem

A saucers control viewer that illustrates the screen coordinate system feature.
standardCamera
standardCamera

A 'standard' Camera with fixed near and far planes.
stereoViewer
stereoViewer

Simply press S to toggle stereo display (if supported).
 

More complex examples

3dsViewer
3dsViewer

The LGPL lib3ds library is used to load and display a 3ds scene.
agora
agora

Implementation of the game of Agora.
anaglyph
anaglyph

Displays a scene in pseudo-stereo using anaglyph.
backgroundImage
backgroundImage

Displays a background image in the viewer.
blobWar
blobWar

Implementation of the game of BlobWar.
cornerAxis
cornerAxis

Displays a world axis in the lower-left corner of the window.
dvonn
dvonn

Implementation of the game of Dvonn.
eventRecorder
eventRecorder

Records a scenario that can be replayed and converted into a movie.
quarto
quarto

A simulation of the game of Quarto.
terrain
terrain

A random fractal terrain with trees, animated water, sky and shadows.
textureViewer
textureViewer

Loads an image file and texture maps a polygon with it.
thumbnail
thumbnail

Displays an alternative 3D view in a corner thumbnail.

Back to the examples main page.