Macros | Functions | Variables
scube.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <GL/glut.h>
Include dependency graph for scube.c:

Go to the source code of this file.

Macros

#define BLACK   7
 
#define BLUE   3
 
#define CYAN   4
 
#define EXIT_FAILURE   1
 
#define GREEN   2
 
#define GREY   0
 
#define MAGENTA   5
 
#define RED   1
 
#define YELLOW   6
 

Functions

void buildColormap (void)
 
void display (void)
 
static void drawCheck (int w, int h, int evenColor, int oddColor)
 
static void drawCube (int color)
 
void fog_select (int fog)
 
void idle (void)
 
void keyboard (unsigned char ch, int x, int y)
 
int main (int argc, char **argv)
 
void menu_select (int mode)
 
static void myShadowMatrix (float ground[4], float light[4])
 
static void setColor (int c)
 
static void usage (void)
 
void visible (int state)
 

Variables

static float backPlane [4]
 
static float cube_normals [6][4]
 
static float cube_vertexes [6][4][4]
 
static float fogColor [4]
 
static float fogIndex [1]
 
static float groundPlane [4]
 
static float lightAmb [4]
 
static float lightDiff [4]
 
static float lightPos [4]
 
static float lightSpec [4]
 
static float materialColor [8][4]
 
static int moving = 1
 
static unsigned char sgiPattern [128]
 
static unsigned char shadowPattern [128]
 
static int tick = -1
 
static int useDB = 1
 
static int useFog = 0
 
static int useLighting = 1
 
static int useLogo = 0
 
static int useQuads = 1
 
static int useRGB = 1
 
static char * windowNameIndex = "shadow cube (OpenGL Index)"
 
static char * windowNameIndexDB = "shadow cube (OpenGL Index DB)"
 
static char * windowNameRGB = "shadow cube (OpenGL RGB)"
 
static char * windowNameRGBDB = "shadow cube (OpenGL RGB DB)"
 

Macro Definition Documentation

◆ BLACK

#define BLACK   7

Definition at line 68 of file scube.c.

◆ BLUE

#define BLUE   3

Definition at line 64 of file scube.c.

◆ CYAN

#define CYAN   4

Definition at line 65 of file scube.c.

◆ EXIT_FAILURE

#define EXIT_FAILURE   1

◆ GREEN

#define GREEN   2

Definition at line 63 of file scube.c.

◆ GREY

#define GREY   0

Definition at line 61 of file scube.c.

◆ MAGENTA

#define MAGENTA   5

Definition at line 66 of file scube.c.

◆ RED

#define RED   1

Definition at line 62 of file scube.c.

◆ YELLOW

#define YELLOW   6

Definition at line 67 of file scube.c.

Function Documentation

◆ buildColormap()

void buildColormap ( void  )

Definition at line 219 of file scube.c.

◆ display()

void display ( void  )

Definition at line 456 of file scube.c.

◆ drawCheck()

static void drawCheck ( int  w,
int  h,
int  evenColor,
int  oddColor 
)
static

Definition at line 291 of file scube.c.

◆ drawCube()

static void drawCube ( int  color)
static

Definition at line 273 of file scube.c.

◆ fog_select()

void fog_select ( int  fog)

Definition at line 531 of file scube.c.

◆ idle()

void idle ( void  )

Definition at line 405 of file scube.c.

◆ keyboard()

void keyboard ( unsigned char  ch,
int  x,
int  y 
)

Definition at line 416 of file scube.c.

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 579 of file scube.c.

◆ menu_select()

void menu_select ( int  mode)

Definition at line 538 of file scube.c.

◆ myShadowMatrix()

static void myShadowMatrix ( float  ground[4],
float  light[4] 
)
static

Definition at line 366 of file scube.c.

◆ setColor()

static void setColor ( int  c)
static

Definition at line 253 of file scube.c.

◆ usage()

static void usage ( void  )
static

Definition at line 195 of file scube.c.

◆ visible()

void visible ( int  state)

Definition at line 567 of file scube.c.

Variable Documentation

◆ backPlane

float backPlane[4]
static
Initial value:
=
{0.0, 0.0, 1.0, 0.899}

Definition at line 97 of file scube.c.

◆ cube_normals

float cube_normals[6][4]
static
Initial value:
=
{
{-1.0, 0.0, 0.0, 0.0},
{1.0, 0.0, 0.0, 0.0},
{0.0, -1.0, 0.0, 0.0},
{0.0, 1.0, 0.0, 0.0},
{0.0, 0.0, -1.0, 0.0},
{0.0, 0.0, 1.0, 0.0}
}

Definition at line 184 of file scube.c.

◆ cube_vertexes

float cube_vertexes[6][4][4]
static

Definition at line 145 of file scube.c.

◆ fogColor

float fogColor[4]
static
Initial value:
=
{0.0, 0.0, 0.0, 0.0}

Definition at line 100 of file scube.c.

◆ fogIndex

float fogIndex[1]
static
Initial value:
=
{0.0}

Definition at line 102 of file scube.c.

◆ groundPlane

float groundPlane[4]
static
Initial value:
=
{0.0, 1.0, 0.0, 1.499}

Definition at line 95 of file scube.c.

◆ lightAmb

float lightAmb[4]
static
Initial value:
=
{0.2, 0.2, 0.2, 1.0}

Definition at line 88 of file scube.c.

◆ lightDiff

float lightDiff[4]
static
Initial value:
=
{0.8, 0.8, 0.8, 1.0}

Definition at line 90 of file scube.c.

◆ lightPos

float lightPos[4]
static
Initial value:
=
{2.0, 4.0, 2.0, 1.0}

Definition at line 82 of file scube.c.

◆ lightSpec

float lightSpec[4]
static
Initial value:
=
{0.4, 0.4, 0.4, 1.0}

Definition at line 92 of file scube.c.

◆ materialColor

float materialColor[8][4]
static
Initial value:
=
{
{0.8, 0.8, 0.8, 1.0},
{0.8, 0.0, 0.0, 1.0},
{0.0, 0.8, 0.0, 1.0},
{0.0, 0.0, 0.8, 1.0},
{0.0, 0.8, 0.8, 1.0},
{0.8, 0.0, 0.8, 1.0},
{0.8, 0.8, 0.0, 1.0},
{0.0, 0.0, 0.0, 0.6},
}

Definition at line 70 of file scube.c.

◆ moving

int moving = 1
static

Definition at line 59 of file scube.c.

◆ sgiPattern

unsigned char sgiPattern[128]
static
Initial value:
=
{
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xbd, 0xff, 0x83, 0xff, 0x5a, 0xff, 0xef,
0xfe, 0xdb, 0x7f, 0xef, 0xfd, 0xdb, 0xbf, 0xef,
0xfb, 0xdb, 0xdf, 0xef, 0xf7, 0xdb, 0xef, 0xef,
0xfb, 0xdb, 0xdf, 0xef, 0xfd, 0xdb, 0xbf, 0x83,
0xce, 0xdb, 0x73, 0xff, 0xb7, 0x5a, 0xed, 0xff,
0xbb, 0xdb, 0xdd, 0xc7, 0xbd, 0xdb, 0xbd, 0xbb,
0xbe, 0xbd, 0x7d, 0xbb, 0xbf, 0x7e, 0xfd, 0xb3,
0xbe, 0xe7, 0x7d, 0xbf, 0xbd, 0xdb, 0xbd, 0xbf,
0xbb, 0xbd, 0xdd, 0xbb, 0xb7, 0x7e, 0xed, 0xc7,
0xce, 0xdb, 0x73, 0xff, 0xfd, 0xdb, 0xbf, 0xff,
0xfb, 0xdb, 0xdf, 0x87, 0xf7, 0xdb, 0xef, 0xfb,
0xf7, 0xdb, 0xef, 0xfb, 0xfb, 0xdb, 0xdf, 0xfb,
0xfd, 0xdb, 0xbf, 0xc7, 0xfe, 0xdb, 0x7f, 0xbf,
0xff, 0x5a, 0xff, 0xbf, 0xff, 0xbd, 0xff, 0xc3,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
}

Definition at line 125 of file scube.c.

◆ shadowPattern

unsigned char shadowPattern[128]
static
Initial value:
=
{
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55
}

Definition at line 105 of file scube.c.

◆ tick

int tick = -1
static

Definition at line 58 of file scube.c.

◆ useDB

int useDB = 1
static

Definition at line 54 of file scube.c.

◆ useFog

int useFog = 0
static

Definition at line 53 of file scube.c.

◆ useLighting

int useLighting = 1
static

Definition at line 52 of file scube.c.

◆ useLogo

int useLogo = 0
static

Definition at line 55 of file scube.c.

◆ useQuads

int useQuads = 1
static

Definition at line 56 of file scube.c.

◆ useRGB

int useRGB = 1
static

(c) Copyright 1993, 1994, Silicon Graphics, Inc. ALL RIGHTS RESERVED Permission to use, copy, modify, and distribute this software for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both the copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics, Inc. not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission.

THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.

US Government Users Restricted Rights Use, duplication, or disclosure by the Government is subject to restrictions set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or in similar or successor clauses in the FAR or the DOD or NASA FAR Supplement. Unpublished– rights reserved under the copyright laws of the United States. Contractor/manufacturer is Silicon Graphics, Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.

OpenGL(TM) is a trademark of Silicon Graphics, Inc.

Definition at line 51 of file scube.c.

◆ windowNameIndex

char* windowNameIndex = "shadow cube (OpenGL Index)"
static

Definition at line 402 of file scube.c.

◆ windowNameIndexDB

char* windowNameIndexDB = "shadow cube (OpenGL Index DB)"
static

Definition at line 401 of file scube.c.

◆ windowNameRGB

char* windowNameRGB = "shadow cube (OpenGL RGB)"
static

Definition at line 400 of file scube.c.

◆ windowNameRGBDB

char* windowNameRGBDB = "shadow cube (OpenGL RGB DB)"
static

Definition at line 399 of file scube.c.



euslisp
Author(s): Toshihiro Matsui
autogenerated on Thu Jun 15 2023 02:06:43