LISSAJOUS_OPENGL, a C++ program which computes a Lissajous figure based on user input, and uses OpenGL to display it.
The user specifies information about the number of points, and the form of the two sine curves involved. Depending on these parameters, the resulting shape may or may not be a closed curve. The user also specifies a range for the underlying T parameter. Again, depending on the parameters, this value may result in a closed curve being drawn several times, or a closed curve being only partially drawn.
The program plots N points along the curve
t(i) = i * T2 / ( N - 1 )for 0 <= I <= N - 1.
x(i) = R1 * sin ( ( A1 * t(i) + B1 ) * 2 * pi )
y(i) = R2 * sin ( ( A2 * t(i) + B2 ) * 2 * pi )
The user specifies N, T2, A1, B1, A2 and B2. The parameters R1 and R2 are currently fixed at 1.
lissajous_opengl n t2 a1 b1 a2 b2where
OpenGL ships with OS X 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 OS X.
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++ lissajous_opengl.C -m -lGL -lGLU -lglut
was modified to:
g++ lissajous_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.
LISSAJOUS_OPENGL is available in a C++ version.
CAUSTIC_OPENGL, a C++ program which computes a caustic curve and displays it using OpenGL.
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.
opengl_test, C++ codes 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 Pixel Map (PPM) 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.