OpenGL

plainspecialSoftware and s/w Development

Dec 14, 2013 (3 years and 9 months ago)

92 views

OpenGL

Brian Farrimond

Robina Hetherington

What is OpenGL


A
specification

of a set of functions for
drawing graphics


Names of functions


What information these use to do their job


Description of what they do


Software companies create
implementations


We shall use Microsoft .NET implementation


What OpenGL does


Can create 2D and 3D
objects

made from
lines, curves and polygons


Can create a controllable
virtual camera

to view the objects


Can generate
realistic images

of the
objects as viewed through the camera


Can enhance
realism

using lighting,
materials, blending and fog


etc

Making OpenGL easier to use


OpenGL only deals in points, lines, curves
and polygons


Additional libraries are available


GLU library provides more complex shapes
e.g. spheres, boxes


GLUT library provides straightforward
windowing capability


OpenGL function names


Begin with
gl
e.g.

glClearColor();


An OpenGL function can have different
types of arguments. This is achieved by
amending the name e.g.

glVertex2i(7, 3);

glVertex3f(1.0, 3.0, 7.5);

2 integers

3 floating
point
numbers

Installing the GLUT library


GLUT already installed in Room FML 400


You need to install GLUT on your home
machine


See instructions on page 7.


Example OpenGL Programs


Cubes


Texture Filters


Loading and moving through a 3D world


Flag waving

Brief intro to Computer Graphics


Computer monitor


2D array of picture elements


Cathode Ray Tube (CRT)


Liquid Crystal Display (LCD)

OpenGL use of hardware


Data structure
corresponding to
the array of pixels
in the monitor


Stored in main
memory or video
adapter


Scans the frame
buffer


Activates
corresponding
pixels on monitor

Scanning the display


Full screen scan
every 10 milliseconds


(Refresh rate)

First OpenGL Program