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:

CAUSTIC_OPENGL, a C++ program which computes a caustic curve and displays it using OpenGL.

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.

LISSAJOUS_OPENGL, a C++ program which computes a Lissajous figure and displays it using OpenGL.

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

POLYGONAL_SURFACE_DISPLAY_OPENGL, a C++ program which displays a surface in 3D described as a set of polygons, using OpenGL.

XY_DISPLAY_OPENGL, a C++ program which reads an XY file of 2D point coordinates, and displays an image of those points using OpenGL.

XYZ_DISPLAY_OPENGL, a C++ program which reads an XYZ file of 3D point coordinates, and displays an image of those points using OpenGL.

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.