


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An introduction to opengl programming, covering global state, primitives, attributes, matrix stacks, events, and various drawing modes. Opengl uses a global state organized as a tree-like stack, with attributes and primitives defined through various functions. The document also discusses the use of glut for interaction with x windows and input devices.
Typology: Study notes
1 / 4
This page cannot be seen from the preview
Don't miss anything!



OpenGL is not object oriented! It has a global state organized as a tree-like stack via ‘push’ and ‘pop’ separators.
image = GlobState(attributes; objects)
Example:
glClear() glColor3f() glBegin (GL_POINTS) glVertex2fv() glEnd (GL_POINTS) glFlush()
OPENGL/1bufftst
Clipping and viewing volume
z 5 0 z
x
y
Viewing rectangle
(a) (b)
GLUT organizes interaction with X windows, input devices (Xlib,Xtk) see glut.h
xy w
h Viewport Graphics window
Clipping window
h
w
avoid distortion: glViewport( ll x, ll y, width, height ) in pixels part of state – hence interactive change possible
Primitives glBegin(GL SOMETHING)... glEnd(); GL POINTS, GL LINES (segments 1-2, 3-4) vs GL LINE STRIP (poly-line) Polygon: simple, convex, flat (triangles will do!)
Blue
Red
Green
Yellow
Cyan
Magenta (a) (b)
Magenta
Cyan
Yellow
White
Green
Red
Blue
Black
Cyan
Blue
Green Yellow
Red
Magenta
White
Black R
G
B
glColor (r,g,b), glClearColor(r,g,b,α): 2^24 colors 1280 × 1024 pixels with 24 bits (RGB) + α > 4 · 220 bytes = 4MB. Color gamut Hue, Saturation, Intensity model
lookup table (old)