FLOOD_OPENGL
An OpenGL Demonstration of "Flooding"


FLOOD_OPENGL is a C program which demonstrates the idea of "flooding", that is, filling one region of an image with a color, using OpenGL.

The program begins by displaying an image of a white background upon which are a series of wavy black lines. If the user clicks the mouse in a given region, a random color is chosen, and the entire region is filled with that color. That's it!

OpenGL on Macintosh OS X

OpenGL ships with OS9 and OSX for the Macintosh. You can obtain the latest software version on the Apple OpenGL web site.

Note that the source code and compilation script have been adapted for use on a Macintosh running OS X.

For that reason, the include file references have been changed from:


        # include <GL/gl.h>
        # include <GL/glu.h>
        # include <GL/glut.h>
      
to:

        # include <OpenGL/gl.h>
        # include <OpenGL/glu.h>
        # include <GLUT/glut.h>
      

The compilation statement, which might ordinarily be


        gcc flood_opengl.c -lGL -lGLU -lglut 
      
was modified to:

        gcc flood_opengl.c -framework OpenGL -framework GLUT
      

Languages:

FLOOD_OPENGL is available in a C version.

Related Data and Programs:

FERN_OPENGL, a C program which uses OpenGL to display the Barnsley fractal fern.

LIFE_OPENGL, a C program which plays John Conway's "Game of Life", using OpenGL to display the results.

LIGHTS_OUT_OPENGL, a C program which sets up a "Lights Out" game and allows the user to solve it, using the OpenGL graphics window.

OPENGL, C programs which demonstrate the use of OpenGL for graphics applications.

SCREENSHOT_OPENGL, a C program which shows how a program using the OpenGL graphics library can save a screenshot of the graphics being displayed.

Author:

Art Wetzel

Reference:

Source Code:

List of Routines:

You can go up one level to the C source codes.


Last revised on 24 March 2008.