Lab 10: Qt Photon Visualizer


To render emitted photons that were collected ("stuck") on model (scene) surfaces using the Qt Graphical User Interface (GUI) toolkit


  1. You can think of the GUI toolkit as a kind of visual interface to otherwise normal processing of data. One of the main differences between the GUI toolkit and command-line processing is that the GUI program is event-driven. The GUI program basically sits idle waiting for user events, which are key strokes, mouse motions, mouse button clicks, and window events such as window resize, or window exposure, to name a few.
  2. Our basic template for Qt interaction follows the basic Qt OpenGL tutorials (e.g., the Hello GL example).
  3. OpenGL is the graphics library that we use to display graphics primitives, in this case GL_POINTS which are just 3D points in space (the 3D world).
  4. Our graphics window, the main Qt window that "listens" to user events can also process OpenGL commands.


  1. Use the given photons.pts to test your Qt photon viewer.
  2. For the Qt app, your best bet is to follow the Hello GL tutorial and create the following files:
  3. If all the Qt is set up properly, the following main() is one way to start the program (Qt documentation suggests an alternate approach using something like the QMainWindow but the following will work just as well, but feel free to use either):
    int main(int argc, char **argv)
        QApplication app(argc,argv);
      if(!QGLFormat::hasOpenGL()) {
        qWarning( "This system has no OpenGL support. Exiting." );
        return -1;
      // Create OpenGL format
      QGLFormat f;
      f.setDoubleBuffer(TRUE); f.setRgba(TRUE); f.setDepth(TRUE);
      GLObjectWindow* w = new GLObjectWindow;
      // set size...
      w->resize( 640, 480 );
      // ... or go full screen
      int result = app.exec();
      delete w;
      return result;

Turn in

Turn in all of your code, in one tar.gz archive of your lab##/ directory, including:
  1. A README file containing
    1. Course id--section no
    2. Name
    3. Lab description
    4. Brief solution description (e.g., program design, description of algorithm, etc., however appropriate).
    5. Lessons learned, identified interesting features of your program
    6. Any special usage instructions
  2. Makefile
  3. source code (.h headers and .cpp source)
  4. object code (do a make clean before tar)

How to hand in

See sendlab notes