glPixelStoref(GL_UNPACK_ALIGNMENT, 1)
Necessary if image width is not a multiple of 4
See corrected drawimage.py
glPixelZoom(xzoom, yzoom)
Zooms subsequent images that are drawn - replicates pixels (blocky zoom)
xzoom & yzoom can be different
xzoom & yzoom can be fractional (e.g. 1.5)
xzoom & yzoom can be less than 1 to shrink image
xzoom & yzoom can be negative
Example: zoomimage.py
glPixelTransfer(operation, value)
Provides scale and bias functions for each color channel
e.g. glPixelTransfer(GL_RED_SCALE, 2.0)
Example: pixeltransfer.py
data = glReadPixels(x, y, width, height, format, type)C:
glReadPixels(x, y, width, height, format, type, databuffer)
Reads pixel data from frame buffer and stores in system memory
Data can then be written to a file, for a screen-dump
glViewport(x, y, width, height)
Defines region of window to draw into - area covered by orthographic projection
Without a ReshapeFunc, GLUT automatically takes care of it. With a ReshapeFunc, your program must call glViewport() itself.
glScissor(x, y, width, height) glEnable(GL_SCISSOR_TEST)
Defines region of window to limit drawing to - pixels outside scissor region will be untouched
Typically set the same as the glViewport()
Example: scissor.py
GLUT provides functions to draw two types of text:
Both functions draw just a single character
Example: glutText0.py
Strings are handled by calling them in a loop
Example: glutText1.py
Characters are bitmaps - arrays of pixel data
Starting position set by glRasterPos2f or glRasterPos3f
Size never changes (unaffected by scaling or perspective)
Always screen-aligned
If starting point is off screen, nothing is drawn
Characters are series of GL lines
Position, size, and orientation affected by normal GL transformations
glutStrokeCharacter() includes transformation to make next character follow current one
Frame rate = how many frames are drawn in one second
Good framerate: 30 fps or higher
Programs can check current frame rate and reduce complexity if it drops too low
Example: framerate.py