CAUSTIC_OPENGL is a C++ program which computes a caustic curve based on user input, and uses OpenGL to display it.
The user specifies a value Q, the number of points, a value P which controls which points will be connected, and values A and B which determine the curve on which the points lie.
The program then plots Q points along the curve
x(I) = cos ( A * 2 * i * pi / Q )and connects each point I to point I+P, using modular arithmetic where necessary.
y(I) = sin ( B * 2 * i * pi / Q )
caustic_opengl q p a bwhere
OpenGL ships with OSX for the Macintosh. You can obtain the latest software version on the Apple OpenGL web site.
Note that this source code and compilation script have been adapted for use on a Macintosh running OSX.
For that reason, the include file references have been changed from:
# include <GL/glut.h>
to:
# include <GLUT/glut.h>
The compilation statement, which might ordinarily be
g++ caustic_opengl.C -m -lGL -lGLU -lglut
was modified to:
g++ caustic_opengl.C -m -framework OpenGL -framework GLUT
The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.
CAUSTIC_OPENGL is available in a C++ version.
FERN_OPENGL, a C++ program which uses OpenGL to display the Barnsley fractal fern.
LIFE_OPENGL, a C++ program which simulates a version of John Conway's "Game of Life", displaying the results using OpenGL.
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 illustrate the use of the OpenGL graphics library;
OBJ2OPENGL, a PERL script which converts OBJ files of 3D data into C include files, which can then be used in an OpenGL program to display the object.
POLYGONAL_SURFACE_DISPLAY_OPENGL, a C++ program which displays a surface in 3D described as a set of polygons, using OpenGL.
ROTATING_CUBE_DISPLAY_OPENGL, a C++ program which displays a rotating color cube in 3D, using OpenGL;
PPMA, a data directory which describes the ASCII Portable Pixelmap format, which is a possible means of storing the graphics information displayed by OpenGL. One of the example programs shows how this can be done.
SCREENSHOT_OPENGL, a C++ program which shows how a program using the OpenGL graphics library can save a screenshot of the graphics being displayed.
SPHERE_XYZ_DISPLAY_OPENGL, a C++ program which reads XYZ information defining points in 3D, and displays a unit sphere and the points, using OpenGL.
TET_MESH_DISPLAY_OPENGL, a C++ program which reads a pair of files defining a tetrahedral mesh and displays an image using OpenGL.
TRI_SURFACE_DISPLAY_OPENGL, a C++ program which displays the 3D graphics information in a TRI_SURFACE file using OpenGL.
TRIANGULATION_DISPLAY_OPENGL, a C++ program which reads a pair of files defining a triangulation and displays an image 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.
XYL_DISPLAY_OPENGL, a C++ program which reads XYL information defining points and lines in 2D, and displays an image 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.
You can go up one level to the C++ source codes.