132001f49Smrg/* 232001f49Smrg * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. 332001f49Smrg * 432001f49Smrg * Permission to use, copy, modify, distribute, and sell this software and 532001f49Smrg * its documentation for any purpose is hereby granted without fee, provided 632001f49Smrg * that (i) the above copyright notices and this permission notice appear in 732001f49Smrg * all copies of the software and related documentation, and (ii) the name of 832001f49Smrg * Silicon Graphics may not be used in any advertising or 932001f49Smrg * publicity relating to the software without the specific, prior written 1032001f49Smrg * permission of Silicon Graphics. 1132001f49Smrg * 1232001f49Smrg * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF 1332001f49Smrg * ANY KIND, 1432001f49Smrg * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 1532001f49Smrg * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 1632001f49Smrg * 1732001f49Smrg * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR 1832001f49Smrg * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, 1932001f49Smrg * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 2032001f49Smrg * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 2132001f49Smrg * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 2232001f49Smrg * OF THIS SOFTWARE. 2332001f49Smrg */ 2432001f49Smrg 2532001f49Smrg#include <stdio.h> 2632001f49Smrg#include <string.h> 2732001f49Smrg#include <stdlib.h> 2832001f49Smrg#include <math.h> 2932001f49Smrg#include "glut_wrap.h" 3032001f49Smrg 3132001f49Smrg 3232001f49Smrg#define VORDER 10 3332001f49Smrg#define CORDER 10 3432001f49Smrg#define TORDER 3 3532001f49Smrg 3632001f49Smrg#define VMAJOR_ORDER 2 3732001f49Smrg#define VMINOR_ORDER 3 3832001f49Smrg 3932001f49Smrg#define CMAJOR_ORDER 2 4032001f49Smrg#define CMINOR_ORDER 2 4132001f49Smrg 4232001f49Smrg#define TMAJOR_ORDER 2 4332001f49Smrg#define TMINOR_ORDER 2 4432001f49Smrg 4532001f49Smrg#define VDIM 4 4632001f49Smrg#define CDIM 4 4732001f49Smrg#define TDIM 2 4832001f49Smrg 4932001f49Smrg#define ONE_D 1 5032001f49Smrg#define TWO_D 2 5132001f49Smrg 5232001f49Smrg#define EVAL 3 5332001f49Smrg#define MESH 4 5432001f49Smrg 5532001f49Smrg 5632001f49SmrgGLenum doubleBuffer; 5732001f49Smrg 5832001f49Smrgfloat rotX = 0.0, rotY = 0.0, translateZ = -1.0; 5932001f49Smrg 6032001f49SmrgGLenum arrayType = ONE_D; 6132001f49SmrgGLenum colorType = GL_FALSE; 6232001f49SmrgGLenum textureType = GL_FALSE; 6332001f49SmrgGLenum polygonFilled = GL_FALSE; 6432001f49SmrgGLenum lighting = GL_FALSE; 6532001f49SmrgGLenum mapPoint = GL_FALSE; 6632001f49SmrgGLenum mapType = EVAL; 6732001f49Smrg 6832001f49Smrgdouble point1[10*4] = { 6932001f49Smrg -0.5, 0.0, 0.0, 1.0, 7032001f49Smrg -0.4, 0.5, 0.0, 1.0, 7132001f49Smrg -0.3,-0.5, 0.0, 1.0, 7232001f49Smrg -0.2, 0.5, 0.0, 1.0, 7332001f49Smrg -0.1,-0.5, 0.0, 1.0, 7432001f49Smrg 0.0, 0.5, 0.0, 1.0, 7532001f49Smrg 0.1,-0.5, 0.0, 1.0, 7632001f49Smrg 0.2, 0.5, 0.0, 1.0, 7732001f49Smrg 0.3,-0.5, 0.0, 1.0, 7832001f49Smrg 0.4, 0.0, 0.0, 1.0, 7932001f49Smrg}; 8032001f49Smrgdouble cpoint1[10*4] = { 8132001f49Smrg 0.0, 0.0, 1.0, 1.0, 8232001f49Smrg 0.3, 0.0, 0.7, 1.0, 8332001f49Smrg 0.6, 0.0, 0.3, 1.0, 8432001f49Smrg 1.0, 0.0, 0.0, 1.0, 8532001f49Smrg 1.0, 0.3, 0.0, 1.0, 8632001f49Smrg 1.0, 0.6, 0.0, 1.0, 8732001f49Smrg 1.0, 1.0, 0.0, 1.0, 8832001f49Smrg 1.0, 1.0, 0.5, 1.0, 8932001f49Smrg 1.0, 1.0, 1.0, 1.0, 9032001f49Smrg}; 9132001f49Smrgdouble tpoint1[11*4] = { 9232001f49Smrg 0.0, 0.0, 0.0, 1.0, 9332001f49Smrg 0.0, 0.1, 0.0, 1.0, 9432001f49Smrg 0.0, 0.2, 0.0, 1.0, 9532001f49Smrg 0.0, 0.3, 0.0, 1.0, 9632001f49Smrg 0.0, 0.4, 0.0, 1.0, 9732001f49Smrg 0.0, 0.5, 0.0, 1.0, 9832001f49Smrg 0.0, 0.6, 0.0, 1.0, 9932001f49Smrg 0.0, 0.7, 0.0, 1.0, 10032001f49Smrg 0.0, 0.8, 0.0, 1.0, 10132001f49Smrg 0.0, 0.9, 0.0, 1.0, 10232001f49Smrg}; 10332001f49Smrgdouble point2[2*3*4] = { 10432001f49Smrg -0.5, -0.5, 0.5, 1.0, 10532001f49Smrg 0.0, 1.0, 0.5, 1.0, 10632001f49Smrg 0.5, -0.5, 0.5, 1.0, 10732001f49Smrg -0.5, 0.5, -0.5, 1.0, 10832001f49Smrg 0.0, -1.0, -0.5, 1.0, 10932001f49Smrg 0.5, 0.5, -0.5, 1.0, 11032001f49Smrg}; 11132001f49Smrgdouble cpoint2[2*2*4] = { 11232001f49Smrg 0.0, 0.0, 0.0, 1.0, 11332001f49Smrg 0.0, 0.0, 1.0, 1.0, 11432001f49Smrg 0.0, 1.0, 0.0, 1.0, 11532001f49Smrg 1.0, 1.0, 1.0, 1.0, 11632001f49Smrg}; 11732001f49Smrgdouble tpoint2[2*2*2] = { 11832001f49Smrg 0.0, 0.0, 0.0, 1.0, 11932001f49Smrg 1.0, 0.0, 1.0, 1.0, 12032001f49Smrg}; 12132001f49Smrgfloat textureImage[4*2*4] = { 12232001f49Smrg 1.0, 1.0, 1.0, 1.0, 12332001f49Smrg 1.0, 0.0, 0.0, 1.0, 12432001f49Smrg 1.0, 0.0, 0.0, 1.0, 12532001f49Smrg 1.0, 1.0, 1.0, 1.0, 12632001f49Smrg 1.0, 1.0, 1.0, 1.0, 12732001f49Smrg 1.0, 0.0, 0.0, 1.0, 12832001f49Smrg 1.0, 0.0, 0.0, 1.0, 12932001f49Smrg 1.0, 1.0, 1.0, 1.0, 13032001f49Smrg}; 13132001f49Smrg 13232001f49Smrg 13332001f49Smrgstatic void Init(void) 13432001f49Smrg{ 13532001f49Smrg static float ambient[] = {0.1, 0.1, 0.1, 1.0}; 13632001f49Smrg static float diffuse[] = {1.0, 1.0, 1.0, 1.0}; 13732001f49Smrg static float position[] = {0.0, 0.0, -150.0, 0.0}; 13832001f49Smrg static float front_mat_diffuse[] = {1.0, 0.2, 1.0, 1.0}; 13932001f49Smrg static float back_mat_diffuse[] = {1.0, 1.0, 0.2, 1.0}; 14032001f49Smrg static float lmodel_ambient[] = {1.0, 1.0, 1.0, 1.0}; 14132001f49Smrg static float lmodel_twoside[] = {GL_TRUE}; 14232001f49Smrg static float decal[] = {GL_DECAL}; 14332001f49Smrg static float repeat[] = {GL_REPEAT}; 14432001f49Smrg static float nr[] = {GL_NEAREST}; 14532001f49Smrg 14632001f49Smrg glFrontFace(GL_CCW); 14732001f49Smrg 14832001f49Smrg glEnable(GL_DEPTH_TEST); 14932001f49Smrg 15032001f49Smrg glMap1d(GL_MAP1_VERTEX_4, 0.0, 1.0, VDIM, VORDER, point1); 15132001f49Smrg glMap1d(GL_MAP1_COLOR_4, 0.0, 1.0, CDIM, CORDER, cpoint1); 15232001f49Smrg 15332001f49Smrg glMap2d(GL_MAP2_VERTEX_4, 0.0, 1.0, VMINOR_ORDER*VDIM, VMAJOR_ORDER, 0.0, 15432001f49Smrg 1.0, VDIM, VMINOR_ORDER, point2); 15532001f49Smrg glMap2d(GL_MAP2_COLOR_4, 0.0, 1.0, CMINOR_ORDER*CDIM, CMAJOR_ORDER, 0.0, 15632001f49Smrg 1.0, CDIM, CMINOR_ORDER, cpoint2); 15732001f49Smrg glMap2d(GL_MAP2_TEXTURE_COORD_2, 0.0, 1.0, TMINOR_ORDER*TDIM, 15832001f49Smrg TMAJOR_ORDER, 0.0, 1.0, TDIM, TMINOR_ORDER, tpoint2); 15932001f49Smrg 16032001f49Smrg glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); 16132001f49Smrg glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse); 16232001f49Smrg glLightfv(GL_LIGHT0, GL_POSITION, position); 16332001f49Smrg 16432001f49Smrg glMaterialfv(GL_FRONT, GL_DIFFUSE, front_mat_diffuse); 16532001f49Smrg glMaterialfv(GL_BACK, GL_DIFFUSE, back_mat_diffuse); 16632001f49Smrg 16732001f49Smrg glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); 16832001f49Smrg glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside); 16932001f49Smrg 17032001f49Smrg glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, decal); 17132001f49Smrg glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, repeat); 17232001f49Smrg glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, repeat); 17332001f49Smrg glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, nr); 17432001f49Smrg glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, nr); 17532001f49Smrg glTexImage2D(GL_TEXTURE_2D, 0, 4, 2, 4, 0, GL_RGBA, GL_FLOAT, 17632001f49Smrg (GLvoid *)textureImage); 17732001f49Smrg} 17832001f49Smrg 17932001f49Smrgstatic void DrawPoints1(void) 18032001f49Smrg{ 18132001f49Smrg GLint i; 18232001f49Smrg 18332001f49Smrg glColor3f(0.0, 1.0, 0.0); 18432001f49Smrg glPointSize(2); 18532001f49Smrg glBegin(GL_POINTS); 18632001f49Smrg for (i = 0; i < VORDER; i++) { 18732001f49Smrg glVertex4dv(&point1[i*4]); 18832001f49Smrg } 18932001f49Smrg glEnd(); 19032001f49Smrg} 19132001f49Smrg 19232001f49Smrgstatic void DrawPoints2(void) 19332001f49Smrg{ 19432001f49Smrg GLint i, j; 19532001f49Smrg 19632001f49Smrg glColor3f(1.0, 0.0, 1.0); 19732001f49Smrg glPointSize(2); 19832001f49Smrg glBegin(GL_POINTS); 19932001f49Smrg for (i = 0; i < VMAJOR_ORDER; i++) { 20032001f49Smrg for (j = 0; j < VMINOR_ORDER; j++) { 20132001f49Smrg glVertex4dv(&point2[i*4*VMINOR_ORDER+j*4]); 20232001f49Smrg } 20332001f49Smrg } 20432001f49Smrg glEnd(); 20532001f49Smrg} 20632001f49Smrg 20732001f49Smrgstatic void DrawMapEval1(float du) 20832001f49Smrg{ 20932001f49Smrg float u; 21032001f49Smrg 21132001f49Smrg glColor3f(1.0, 0.0, 0.0); 21232001f49Smrg glBegin(GL_LINE_STRIP); 21332001f49Smrg for (u = 0.0; u < 1.0; u += du) { 21432001f49Smrg glEvalCoord1d(u); 21532001f49Smrg } 21632001f49Smrg glEvalCoord1d(1.0); 21732001f49Smrg glEnd(); 21832001f49Smrg} 21932001f49Smrg 22032001f49Smrgstatic void DrawMapEval2(float du, float dv) 22132001f49Smrg{ 22232001f49Smrg float u, v, tmp; 22332001f49Smrg 22432001f49Smrg glColor3f(1.0, 0.0, 0.0); 22532001f49Smrg for (v = 0.0; v < 1.0; v += dv) { 22632001f49Smrg glBegin(GL_QUAD_STRIP); 22732001f49Smrg for (u = 0.0; u <= 1.0; u += du) { 22832001f49Smrg glEvalCoord2d(u,v); 22932001f49Smrg tmp = (v + dv < 1.0) ? (v + dv) : 1.0; 23032001f49Smrg glEvalCoord2d(u, tmp); 23132001f49Smrg } 23232001f49Smrg glEvalCoord2d(1.0, v); 23332001f49Smrg glEvalCoord2d(1.0, v+dv); 23432001f49Smrg glEnd(); 23532001f49Smrg } 23632001f49Smrg} 23732001f49Smrg 23832001f49Smrgstatic void RenderEval(void) 23932001f49Smrg{ 24032001f49Smrg 24132001f49Smrg if (colorType) { 24232001f49Smrg glEnable(GL_MAP1_COLOR_4); 24332001f49Smrg glEnable(GL_MAP2_COLOR_4); 24432001f49Smrg } else { 24532001f49Smrg glDisable(GL_MAP1_COLOR_4); 24632001f49Smrg glDisable(GL_MAP2_COLOR_4); 24732001f49Smrg } 24832001f49Smrg 24932001f49Smrg if (textureType) { 25032001f49Smrg glEnable(GL_TEXTURE_2D); 25132001f49Smrg glEnable(GL_MAP2_TEXTURE_COORD_2); 25232001f49Smrg } else { 25332001f49Smrg glDisable(GL_TEXTURE_2D); 25432001f49Smrg glDisable(GL_MAP2_TEXTURE_COORD_2); 25532001f49Smrg } 25632001f49Smrg 25732001f49Smrg if (polygonFilled) { 25832001f49Smrg glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); 25932001f49Smrg } else { 26032001f49Smrg glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); 26132001f49Smrg } 26232001f49Smrg 26332001f49Smrg glShadeModel(GL_SMOOTH); 26432001f49Smrg 26532001f49Smrg switch (mapType) { 26632001f49Smrg case EVAL: 26732001f49Smrg switch (arrayType) { 26832001f49Smrg case ONE_D: 26932001f49Smrg glDisable(GL_MAP2_VERTEX_4); 27032001f49Smrg glEnable(GL_MAP1_VERTEX_4); 27132001f49Smrg DrawPoints1(); 27232001f49Smrg DrawMapEval1(0.1/VORDER); 27332001f49Smrg break; 27432001f49Smrg case TWO_D: 27532001f49Smrg glDisable(GL_MAP1_VERTEX_4); 27632001f49Smrg glEnable(GL_MAP2_VERTEX_4); 27732001f49Smrg DrawPoints2(); 27832001f49Smrg DrawMapEval2(0.1/VMAJOR_ORDER,0.1/VMINOR_ORDER); 27932001f49Smrg break; 28032001f49Smrg default: 28132001f49Smrg break; 28232001f49Smrg } 28332001f49Smrg break; 28432001f49Smrg case MESH: 28532001f49Smrg switch (arrayType) { 28632001f49Smrg case ONE_D: 28732001f49Smrg DrawPoints1(); 28832001f49Smrg glDisable(GL_MAP2_VERTEX_4); 28932001f49Smrg glEnable (GL_MAP1_VERTEX_4); 29032001f49Smrg glColor3f(0.0, 0.0, 1.0); 29132001f49Smrg glMapGrid1d(40, 0.0, 1.0); 29232001f49Smrg if (mapPoint) { 29332001f49Smrg glPointSize(2); 29432001f49Smrg glEvalMesh1(GL_POINT, 0, 40); 29532001f49Smrg } else { 29632001f49Smrg glEvalMesh1(GL_LINE, 0, 40); 29732001f49Smrg } 29832001f49Smrg break; 29932001f49Smrg case TWO_D: 30032001f49Smrg DrawPoints2(); 30132001f49Smrg glDisable(GL_MAP1_VERTEX_4); 30232001f49Smrg glEnable(GL_MAP2_VERTEX_4); 30332001f49Smrg glColor3f(0.0, 0.0, 1.0); 30432001f49Smrg glMapGrid2d(20, 0.0, 1.0, 20, 0.0, 1.0); 30532001f49Smrg if (mapPoint) { 30632001f49Smrg glPointSize(2); 30732001f49Smrg glEvalMesh2(GL_POINT, 0, 20, 0, 20); 30832001f49Smrg } else if (polygonFilled) { 30932001f49Smrg glEvalMesh2(GL_FILL, 0, 20, 0, 20); 31032001f49Smrg } else { 31132001f49Smrg glEvalMesh2(GL_LINE, 0, 20, 0, 20); 31232001f49Smrg } 31332001f49Smrg break; 31432001f49Smrg default: 31532001f49Smrg break; 31632001f49Smrg } 31732001f49Smrg break; 31832001f49Smrg default: 31932001f49Smrg break; 32032001f49Smrg } 32132001f49Smrg} 32232001f49Smrg 32332001f49Smrgstatic void Reshape(int width, int height) 32432001f49Smrg{ 32532001f49Smrg 32632001f49Smrg glViewport(0, 0, (GLint)width, (GLint)height); 32732001f49Smrg 32832001f49Smrg glMatrixMode(GL_PROJECTION); 32932001f49Smrg glLoadIdentity(); 33032001f49Smrg glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 10.0); 33132001f49Smrg glMatrixMode(GL_MODELVIEW); 33232001f49Smrg} 33332001f49Smrg 33432001f49Smrgstatic void Key2(int key, int x, int y) 33532001f49Smrg{ 33632001f49Smrg switch (key) { 33732001f49Smrg case GLUT_KEY_LEFT: 33832001f49Smrg rotY -= 30; 33932001f49Smrg break; 34032001f49Smrg case GLUT_KEY_RIGHT: 34132001f49Smrg rotY += 30; 34232001f49Smrg break; 34332001f49Smrg case GLUT_KEY_UP: 34432001f49Smrg rotX -= 30; 34532001f49Smrg break; 34632001f49Smrg case GLUT_KEY_DOWN: 34732001f49Smrg rotX += 30; 34832001f49Smrg break; 34932001f49Smrg default: 35032001f49Smrg return; 35132001f49Smrg } 35232001f49Smrg 35332001f49Smrg glutPostRedisplay(); 35432001f49Smrg} 35532001f49Smrg 35632001f49Smrgstatic void Key(unsigned char key, int x, int y) 35732001f49Smrg{ 35832001f49Smrg switch (key) { 35932001f49Smrg case 27: 36032001f49Smrg exit(1); 36132001f49Smrg case '1': 36232001f49Smrg arrayType = ONE_D; 36332001f49Smrg break; 36432001f49Smrg case '2': 36532001f49Smrg arrayType = TWO_D; 36632001f49Smrg break; 36732001f49Smrg case 'e': 36832001f49Smrg mapType = EVAL; 36932001f49Smrg break; 37032001f49Smrg case 'm': 37132001f49Smrg mapType = MESH; 37232001f49Smrg break; 37332001f49Smrg case 'f': 37432001f49Smrg polygonFilled = !polygonFilled; 37532001f49Smrg break; 37632001f49Smrg case 'p': 37732001f49Smrg mapPoint = !mapPoint; 37832001f49Smrg break; 37932001f49Smrg case 'c': 38032001f49Smrg colorType = !colorType; 38132001f49Smrg break; 38232001f49Smrg case 't': 38332001f49Smrg textureType = !textureType; 38432001f49Smrg break; 38532001f49Smrg case 'l': 38632001f49Smrg lighting =! lighting; 38732001f49Smrg if (lighting) { 38832001f49Smrg glEnable(GL_LIGHTING); 38932001f49Smrg glEnable(GL_LIGHT0); 39032001f49Smrg glEnable(GL_AUTO_NORMAL); 39132001f49Smrg } else { 39232001f49Smrg glDisable(GL_LIGHTING); 39332001f49Smrg glDisable(GL_LIGHT0); 39432001f49Smrg glDisable(GL_AUTO_NORMAL); 39532001f49Smrg } 39632001f49Smrg break; 39732001f49Smrg default: 39832001f49Smrg return; 39932001f49Smrg } 40032001f49Smrg 40132001f49Smrg glutPostRedisplay(); 40232001f49Smrg} 40332001f49Smrg 40432001f49Smrgstatic void Draw(void) 40532001f49Smrg{ 40632001f49Smrg 40732001f49Smrg glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); 40832001f49Smrg 40932001f49Smrg glPushMatrix(); 41032001f49Smrg 41132001f49Smrg glTranslatef(0.0, 0.0 , translateZ); 41232001f49Smrg glRotatef(rotX, 1, 0, 0); 41332001f49Smrg glRotatef(rotY, 0, 1, 0); 41432001f49Smrg RenderEval(); 41532001f49Smrg 41632001f49Smrg glPopMatrix(); 41732001f49Smrg 41832001f49Smrg glFlush(); 41932001f49Smrg 42032001f49Smrg if (doubleBuffer) { 42132001f49Smrg glutSwapBuffers(); 42232001f49Smrg } 42332001f49Smrg} 42432001f49Smrg 42532001f49Smrgstatic GLenum Args(int argc, char **argv) 42632001f49Smrg{ 42732001f49Smrg GLint i; 42832001f49Smrg 42932001f49Smrg doubleBuffer = GL_FALSE; 43032001f49Smrg 43132001f49Smrg for (i = 1; i < argc; i++) { 43232001f49Smrg if (strcmp(argv[i], "-sb") == 0) { 43332001f49Smrg doubleBuffer = GL_FALSE; 43432001f49Smrg } else if (strcmp(argv[i], "-db") == 0) { 43532001f49Smrg doubleBuffer = GL_TRUE; 43632001f49Smrg } else { 43732001f49Smrg printf("%s (Bad option).\n", argv[i]); 43832001f49Smrg return GL_FALSE; 43932001f49Smrg } 44032001f49Smrg } 44132001f49Smrg return GL_TRUE; 44232001f49Smrg} 44332001f49Smrg 44432001f49Smrgint main(int argc, char **argv) 44532001f49Smrg{ 44632001f49Smrg GLenum type; 44732001f49Smrg 44832001f49Smrg glutInit(&argc, argv); 44932001f49Smrg 45032001f49Smrg if (Args(argc, argv) == GL_FALSE) { 45132001f49Smrg exit(1); 45232001f49Smrg } 45332001f49Smrg 45432001f49Smrg glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300); 45532001f49Smrg 45632001f49Smrg type = GLUT_RGB | GLUT_DEPTH; 45732001f49Smrg type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; 45832001f49Smrg glutInitDisplayMode(type); 45932001f49Smrg 46032001f49Smrg if (glutCreateWindow("Evaluator Test") == GL_FALSE) { 46132001f49Smrg exit(1); 46232001f49Smrg } 46332001f49Smrg 46432001f49Smrg Init(); 46532001f49Smrg 46632001f49Smrg glutReshapeFunc(Reshape); 46732001f49Smrg glutKeyboardFunc(Key); 46832001f49Smrg glutSpecialFunc(Key2); 46932001f49Smrg glutDisplayFunc(Draw); 47032001f49Smrg glutMainLoop(); 47132001f49Smrg return 0; 47232001f49Smrg} 473