OpenGL Programming II: Working with Toolkits and Drawing into a Window, Slides of Computer Graphics

An overview of the opengl programming ii course, focusing on reviewing previous concepts, working through demos, and introducing windowing toolkits such as glut and fltk. It also covers the basics of drawing into a window using opengl and the need for toolkits to hide the os interface. Instructions on installing and using glut, as well as an introduction to fltk.

Typology: Slides

2012/2013

Uploaded on 04/23/2013

sarasvan
sarasvan 🇮🇳

4.4

(20)

118 documents

1 / 11

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
OpenGL Programming II
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download OpenGL Programming II: Working with Toolkits and Drawing into a Window and more Slides Computer Graphics in PDF only on Docsity!

OpenGL Programming II

Today

  • Review a bit from last time
  • Work through some demos
  • Introduce/demo windowing toolkits
    • GLUT
    • FLTK

Clearing the Screen

glClearColor(0.0, 0.0, 0.0, 0.0) glClearDepth(1.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

To Clear The On-Screen Image And The Z-Buffer:

Our First OpenGL Code

... glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0, 1.0, 1.0); glOrtho(-1.0, 1.0, - 1.0, 1.0, - 1.0, 1.0); glBegin(GL_POLYGON); glVertex2f(-0.5, - 0.5); glVertex2f(-0.5, 0.5); glVertex2f(0.5, 0.5); glVertex2f(0.5, - 0.5); glEnd(); glFlush(); ...

UI Toolkits

  • There are a lot of options to choose from:
    • GLUT
    • FLTK
    • QT
    • wxWindows
    • Cocoa
    • etc.
  • I’m going to demonstrate GLUT today

GLUT

  • OpenGL Utility Toolkit
  • Cross-Platform C++ Drawing/UI Toolkit
  • Provides functions to make starting up and drawing fast and easy
  • Supports only limited user interfaces

Using GLUT

  • Only need to include glut.h
    • #include <GL\glut.h>
      • Automatically includes gl.h and glu.h
  • Lighthouse3D has a good GLUT tutorial
    • http://www.lighthouse3d.com/opengl/glut/inde x.php?

FLTK

  • Fast Light Toolkit
  • Cross-Platform C++ GUI Toolkit
  • Provides more full-featured UI functionality than GLUT - Also supports GLUT code through emulation
  • Download from http://www.fltk.org