INFO804 Introduction à l'informatique graphique
Loading...
Searching...
No Matches
Protected Member Functions | List of all members
Viewer Class Reference
Inheritance diagram for Viewer:

Protected Member Functions

virtual void draw ()
 Called at each draw of the window.
 
virtual void init ()
 Called before the first draw.
 
virtual QString helpString () const
 Called when pressing help.
 

Detailed Description

Definition at line 5 of file Viewer.h.

Constructor & Destructor Documentation

◆ Viewer()

Viewer::Viewer ( )
inline

Definition at line 8 of file Viewer.h.

8: QGLViewer() {}

Member Function Documentation

◆ draw()

void Viewer::draw ( )
protectedvirtual

Called at each draw of the window.

Definition at line 7 of file Viewer.cpp.

8{
9 float colorBronzeDiff[4] = { 0.8, 0.6, 0.0, 1.0 };
10 float colorRedDiff [4] = { 1.0, 0.0, 0.0, 1.0 };
11 float colorGreenDiff [4] = { 0.0, 1.0, 0.0, 1.0 };
12 float colorBlueDiff [4] = { 0.0, 0.0, 1.0, 1.0 };
13
14 // Draws triangles given by 3 vertices.
15 glBegin(GL_TRIANGLES);
16 glColor4fv(colorBronzeDiff);
17 glVertex3f( 0.0, 0.0, 0.0 );
18 glVertex3f( 1.0, 0.0, 0.0 );
19 glVertex3f( 0.0, 1.0, 0.0 );
20 glColor4fv(colorRedDiff);
21 glVertex3f( 1.0, 0.0, 0.0 );
22 glVertex3f( 0.0, 1.0, 0.0 );
23 glVertex3f( 0.0, 0.0, 1.0 );
24 glColor4fv(colorGreenDiff);
25 glVertex3f( 0.0, 0.0, 0.0 );
26 glVertex3f( 0.0, 1.0, 0.0 );
27 glVertex3f( 0.0, 0.0, 1.0 );
28 glColor4fv(colorBlueDiff);
29 glVertex3f( 0.0, 0.0, 0.0 );
30 glVertex3f( 1.0, 0.0, 0.0 );
31 glVertex3f( 0.0, 0.0, 1.0 );
32 glEnd();
33}

◆ helpString()

QString Viewer::helpString ( ) const
protectedvirtual

Called when pressing help.

Definition at line 45 of file Viewer.cpp.

46{
47 QString text("<h2>S i m p l e V i e w e r</h2>");
48 text += "Use the mouse to move the camera around the object. ";
49 text += "You can respectively revolve around, zoom and translate with the three mouse buttons. ";
50 text += "Left and middle buttons pressed together rotate around the camera view direction axis<br><br>";
51 text += "Pressing <b>Alt</b> and one of the function keys (<b>F1</b>..<b>F12</b>) defines a camera keyFrame. ";
52 text += "Simply press the function key again to restore it. Several keyFrames define a ";
53 text += "camera path. Paths are saved when you quit the application and restored at next start.<br><br>";
54 text += "Press <b>F</b> to display the frame rate, <b>A</b> for the world axis, ";
55 text += "<b>Alt+Return</b> for full screen mode and <b>Control+S</b> to save a snapshot. ";
56 text += "See the <b>Keyboard</b> tab in this window for a complete shortcut list.<br><br>";
57 text += "Double clicks automates single click actions: A left button double click aligns the closer axis with the camera (if close enough). ";
58 text += "A middle button double click fits the zoom of the camera and the right button re-centers the scene.<br><br>";
59 text += "A left button double click while holding right button pressed defines the camera <i>Revolve Around Point</i>. ";
60 text += "See the <b>Mouse</b> tab and the documentation web pages for details.<br><br>";
61 text += "Press <b>Escape</b> to exit the viewer.";
62 return text;
63}

◆ init()

void Viewer::init ( )
protectedvirtual

Called before the first draw.

Definition at line 36 of file Viewer.cpp.

37{
38 // Restore previous viewer state.
39 restoreStateFromFile();
40
41 // Opens help window
42 help();
43}

The documentation for this class was generated from the following files: