* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include <GL/freeglut.h>
#include "freeglut_internal.h"
{
double size = dSize * 0.5;
+ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutWireCube" );
+
# define V(a,b,c) glVertex3d( a size, b size, c size );
# define N(a,b,c) glNormal3d( a, b, c );
{
double size = dSize * 0.5;
+ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSolidCube" );
+
# define V(a,b,c) glVertex3d( a size, b size, c size );
# define N(a,b,c) glNormal3d( a, b, c );
double *sint1,*cost1;
double *sint2,*cost2;
+
+ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSolidSphere" );
+
fghCircleTable(&sint1,&cost1,-slices);
fghCircleTable(&sint2,&cost2,stacks*2);
double *sint1,*cost1;
double *sint2,*cost2;
+
+ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutWireSphere" );
+
fghCircleTable(&sint1,&cost1,-slices );
fghCircleTable(&sint2,&cost2, stacks*2);
/* Pre-computed circle */
double *sint,*cost;
+
+ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSolidCone" );
+
fghCircleTable(&sint,&cost,-slices);
/* Cover the circular base with a triangle fan... */
/* Pre-computed circle */
double *sint,*cost;
+
+ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutWireCone" );
+
fghCircleTable(&sint,&cost,-slices);
/* Draw the stacks... */
/* Pre-computed circle */
double *sint,*cost;
+
+ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSolidCylinder" );
+
fghCircleTable(&sint,&cost,-slices);
/* Cover the base and top */
/* Pre-computed circle */
double *sint,*cost;
+
+ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutWireCylinder" );
+
fghCircleTable(&sint,&cost,-slices);
/* Draw the stacks... */
double *vertex, *normal;
int i, j;
double spsi, cpsi, sphi, cphi ;
+
+ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutWireTorus" );
+
if ( nSides < 1 ) nSides = 1;
if ( nRings < 1 ) nRings = 1;
double *vertex, *normal;
int i, j;
double spsi, cpsi, sphi, cphi ;
+
+ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSolidTorus" );
+
if ( nSides < 1 ) nSides = 1;
if ( nRings < 1 ) nRings = 1;
*/
void FGAPIENTRY glutWireDodecahedron( void )
{
+ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutWireDodecahedron" );
+
/* Magic Numbers: It is possible to create a dodecahedron by attaching two pentagons to each face of
* of a cube. The coordinates of the points are:
* (+-x,0, z); (+-1, 1, 1); (0, z, x )
*/
void FGAPIENTRY glutSolidDodecahedron( void )
{
+ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSolidDodecahedron" );
+
/* Magic Numbers: It is possible to create a dodecahedron by attaching two pentagons to each face of
* of a cube. The coordinates of the points are:
* (+-x,0, z); (+-1, 1, 1); (0, z, x )
*/
void FGAPIENTRY glutWireOctahedron( void )
{
+ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutWireOctahedron" );
+
#define RADIUS 1.0f
glBegin( GL_LINE_LOOP );
glNormal3d( 0.577350269189, 0.577350269189, 0.577350269189); glVertex3d( RADIUS, 0.0, 0.0 ); glVertex3d( 0.0, RADIUS, 0.0 ); glVertex3d( 0.0, 0.0, RADIUS );
*/
void FGAPIENTRY glutSolidOctahedron( void )
{
+ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSolidOctahedron" );
+
#define RADIUS 1.0f
glBegin( GL_TRIANGLES );
glNormal3d( 0.577350269189, 0.577350269189, 0.577350269189); glVertex3d( RADIUS, 0.0, 0.0 ); glVertex3d( 0.0, RADIUS, 0.0 ); glVertex3d( 0.0, 0.0, RADIUS );
*/
void FGAPIENTRY glutWireTetrahedron( void )
{
+ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutWireTetrahedron" );
+
glBegin( GL_LINE_LOOP ) ;
glNormal3d ( -tet_r[0][0], -tet_r[0][1], -tet_r[0][2] ) ; glVertex3dv ( tet_r[1] ) ; glVertex3dv ( tet_r[3] ) ; glVertex3dv ( tet_r[2] ) ;
glNormal3d ( -tet_r[1][0], -tet_r[1][1], -tet_r[1][2] ) ; glVertex3dv ( tet_r[0] ) ; glVertex3dv ( tet_r[2] ) ; glVertex3dv ( tet_r[3] ) ;
*/
void FGAPIENTRY glutSolidTetrahedron( void )
{
+ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSolidTetrahedron" );
+
glBegin( GL_TRIANGLES ) ;
glNormal3d ( -tet_r[0][0], -tet_r[0][1], -tet_r[0][2] ) ; glVertex3dv ( tet_r[1] ) ; glVertex3dv ( tet_r[3] ) ; glVertex3dv ( tet_r[2] ) ;
glNormal3d ( -tet_r[1][0], -tet_r[1][1], -tet_r[1][2] ) ; glVertex3dv ( tet_r[0] ) ; glVertex3dv ( tet_r[2] ) ; glVertex3dv ( tet_r[3] ) ;
/*
*
*/
-double icos_r[12][3] = { { 1.0, 0.0, 0.0 },
- { 0.447213595500, 0.894427191000, 0.0 }, { 0.447213595500, 0.276393202252, 0.850650808354 }, { 0.447213595500, -0.723606797748, 0.525731112119 }, { 0.447213595500, -0.723606797748, -0.525731112119 }, { 0.447213595500, 0.276393202252, -0.850650808354 },
- { -0.447213595500, -0.894427191000, 0.0 }, { -0.447213595500, -0.276393202252, 0.850650808354 }, { -0.447213595500, 0.723606797748, 0.525731112119 }, { -0.447213595500, 0.723606797748, -0.525731112119 }, { -0.447213595500, -0.276393202252, -0.850650808354 },
- { -1.0, 0.0, 0.0 } } ;
-int icos_v [20][3] = { { 0, 1, 2 }, { 0, 2, 3 }, { 0, 3, 4 }, { 0, 4, 5 }, { 0, 5, 1 },
- { 1, 8, 2 }, { 2, 7, 3 }, { 3, 6, 4 }, { 4, 10, 5 }, { 5, 9, 1 },
- { 1, 9, 8 }, { 2, 8, 7 }, { 3, 7, 6 }, { 4, 6, 10 }, { 5, 10, 9 },
- { 11, 9, 10 }, { 11, 8, 9 }, { 11, 7, 8 }, { 11, 6, 7 }, { 11, 10, 6 } } ;
+static double icos_r[12][3] = {
+ { 1.0, 0.0, 0.0 },
+ { 0.447213595500, 0.894427191000, 0.0 },
+ { 0.447213595500, 0.276393202252, 0.850650808354 },
+ { 0.447213595500, -0.723606797748, 0.525731112119 },
+ { 0.447213595500, -0.723606797748, -0.525731112119 },
+ { 0.447213595500, 0.276393202252, -0.850650808354 },
+ { -0.447213595500, -0.894427191000, 0.0 },
+ { -0.447213595500, -0.276393202252, 0.850650808354 },
+ { -0.447213595500, 0.723606797748, 0.525731112119 },
+ { -0.447213595500, 0.723606797748, -0.525731112119 },
+ { -0.447213595500, -0.276393202252, -0.850650808354 },
+ { -1.0, 0.0, 0.0 }
+};
+
+static int icos_v [20][3] = {
+ { 0, 1, 2 },
+ { 0, 2, 3 },
+ { 0, 3, 4 },
+ { 0, 4, 5 },
+ { 0, 5, 1 },
+ { 1, 8, 2 },
+ { 2, 7, 3 },
+ { 3, 6, 4 },
+ { 4, 10, 5 },
+ { 5, 9, 1 },
+ { 1, 9, 8 },
+ { 2, 8, 7 },
+ { 3, 7, 6 },
+ { 4, 6, 10 },
+ { 5, 10, 9 },
+ { 11, 9, 10 },
+ { 11, 8, 9 },
+ { 11, 7, 8 },
+ { 11, 6, 7 },
+ { 11, 10, 6 }
+};
void FGAPIENTRY glutWireIcosahedron( void )
{
int i ;
+
+ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutWireIcosahedron" );
+
for ( i = 0; i < 20; i++ )
{
double normal[3] ;
{
int i ;
+ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSolidIcosahedron" );
+
glBegin ( GL_TRIANGLES ) ;
for ( i = 0; i < 20; i++ )
{
/*
*
*/
-double rdod_r[14][3] = { { 0.0, 0.0, 1.0 },
- { 0.707106781187, 0.000000000000, 0.5 }, { 0.000000000000, 0.707106781187, 0.5 }, { -0.707106781187, 0.000000000000, 0.5 }, { 0.000000000000, -0.707106781187, 0.5 },
- { 0.707106781187, 0.707106781187, 0.0 }, { -0.707106781187, 0.707106781187, 0.0 }, { -0.707106781187, -0.707106781187, 0.0 }, { 0.707106781187, -0.707106781187, 0.0 },
- { 0.707106781187, 0.000000000000, -0.5 }, { 0.000000000000, 0.707106781187, -0.5 }, { -0.707106781187, 0.000000000000, -0.5 }, { 0.000000000000, -0.707106781187, -0.5 },
- { 0.0, 0.0, -1.0 } } ;
-int rdod_v [12][4] = { { 0, 1, 5, 2 }, { 0, 2, 6, 3 }, { 0, 3, 7, 4 }, { 0, 4, 8, 1 },
- { 5, 10, 6, 2 }, { 6, 11, 7, 3 }, { 7, 12, 8, 4 }, { 8, 9, 5, 1 },
- { 5, 9, 13, 10 }, { 6, 10, 13, 11 }, { 7, 11, 13, 12 }, { 8, 12, 13, 9 } } ;
-double rdod_n[12][3] = {
- { 0.353553390594, 0.353553390594, 0.5 }, { -0.353553390594, 0.353553390594, 0.5 }, { -0.353553390594, -0.353553390594, 0.5 }, { 0.353553390594, -0.353553390594, 0.5 },
- { 0.000000000000, 1.000000000000, 0.0 }, { -1.000000000000, 0.000000000000, 0.0 }, { 0.000000000000, -1.000000000000, 0.0 }, { 1.000000000000, 0.000000000000, 0.0 },
- { 0.353553390594, 0.353553390594, -0.5 }, { -0.353553390594, 0.353553390594, -0.5 }, { -0.353553390594, -0.353553390594, -0.5 }, { 0.353553390594, -0.353553390594, -0.5 }
- } ;
+static double rdod_r[14][3] = {
+ { 0.0, 0.0, 1.0 },
+ { 0.707106781187, 0.000000000000, 0.5 },
+ { 0.000000000000, 0.707106781187, 0.5 },
+ { -0.707106781187, 0.000000000000, 0.5 },
+ { 0.000000000000, -0.707106781187, 0.5 },
+ { 0.707106781187, 0.707106781187, 0.0 },
+ { -0.707106781187, 0.707106781187, 0.0 },
+ { -0.707106781187, -0.707106781187, 0.0 },
+ { 0.707106781187, -0.707106781187, 0.0 },
+ { 0.707106781187, 0.000000000000, -0.5 },
+ { 0.000000000000, 0.707106781187, -0.5 },
+ { -0.707106781187, 0.000000000000, -0.5 },
+ { 0.000000000000, -0.707106781187, -0.5 },
+ { 0.0, 0.0, -1.0 }
+} ;
+
+static int rdod_v [12][4] = {
+ { 0, 1, 5, 2 },
+ { 0, 2, 6, 3 },
+ { 0, 3, 7, 4 },
+ { 0, 4, 8, 1 },
+ { 5, 10, 6, 2 },
+ { 6, 11, 7, 3 },
+ { 7, 12, 8, 4 },
+ { 8, 9, 5, 1 },
+ { 5, 9, 13, 10 },
+ { 6, 10, 13, 11 },
+ { 7, 11, 13, 12 },
+ { 8, 12, 13, 9 }
+};
+
+static double rdod_n[12][3] = {
+ { 0.353553390594, 0.353553390594, 0.5 },
+ { -0.353553390594, 0.353553390594, 0.5 },
+ { -0.353553390594, -0.353553390594, 0.5 },
+ { 0.353553390594, -0.353553390594, 0.5 },
+ { 0.000000000000, 1.000000000000, 0.0 },
+ { -1.000000000000, 0.000000000000, 0.0 },
+ { 0.000000000000, -1.000000000000, 0.0 },
+ { 1.000000000000, 0.000000000000, 0.0 },
+ { 0.353553390594, 0.353553390594, -0.5 },
+ { -0.353553390594, 0.353553390594, -0.5 },
+ { -0.353553390594, -0.353553390594, -0.5 },
+ { 0.353553390594, -0.353553390594, -0.5 }
+};
void FGAPIENTRY glutWireRhombicDodecahedron( void )
{
int i ;
+
+ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutWireRhombicDodecahedron" );
+
for ( i = 0; i < 12; i++ )
{
glBegin ( GL_LINE_LOOP ) ;
{
int i ;
+ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSolidRhombicDodecahedron" );
+
glBegin ( GL_QUADS ) ;
for ( i = 0; i < 12; i++ )
{
{
int i, j ;
+ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutWireSierpinskiSponge" );
+
if ( num_levels == 0 )
{
glEnd () ;
}
}
- else
+ else if ( num_levels > 0 )
{
GLdouble local_offset[3] ; /* Use a local variable to avoid buildup of roundoff errors */
num_levels -- ;
{
int i, j ;
+ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSolidSierpinskiSponge" );
+
if ( num_levels == 0 )
{
glBegin ( GL_TRIANGLES ) ;
glEnd () ;
}
- else
+ else if ( num_levels > 0 )
{
GLdouble local_offset[3] ; /* Use a local variable to avoid buildup of roundoff errors */
num_levels -- ;