示例#1
0
void myinit(void)
{
	auxInitDisplayMode(AUX_DOUBLE|AUX_RGBA);
	auxInitPosition(100,100,800,600);

	auxInitWindow((LPCWSTR)"Solar System");

	GLfloat light_ambient[]={0.3,0.5,0.3};
	GLfloat light_diffuse[]={1.0,1.0,1.0};
	GLfloat light_specular[]={0.8,0.8,0.0};
	GLfloat light_position[]={0.0,0.0,0.0};

	glLightfv(GL_LIGHT0,GL_AMBIENT,light_ambient);
	glLightfv(GL_LIGHT0,GL_DIFFUSE,light_diffuse);
	glLightfv(GL_LIGHT0,GL_SPECULAR,light_specular);
	glLightfv(GL_LIGHT0,GL_POSITION, light_position);
	glEnable(GL_LIGHTING);
	glEnable(GL_LIGHT0);

	glClearColor(0, 0, 0, 0);
	glShadeModel(GL_SMOOTH);

	glEnable(GL_TEXTURE_GEN_S);
	glEnable(GL_TEXTURE_2D);
	glEnable(GL_DEPTH_TEST);
	glEnable(GL_LIGHTING);
	glEnable(GL_CULL_FACE);
	LoadTextures(texture_id);

	for(int i = 0;i<8;i++){
		year[i]=(rand()%360);
		day[i]=0;
	}
		
}
示例#2
0
void main(int argc,char** argv)
{
	if(Args(argc,argv)==GL_FALSE)
		auxQuit();

	windW=600;
	windH=300;
	auxInitPosition(0,0,windW,windH);

	windType=AUX_DEPTH16;
	windType|=(rgb)?AUX_RGB:AUX_INDEX;
	windType|=(doubleBuffer)?AUX_DOUBLE:AUX_SINGLE;

	auxInitDisplayMode(windType);

	if(auxInitWindow("速度测试")==GL_FALSE)
		auxQuit();

	auxExposeFunc((AUXEXPOSEPROC)Resize);
	auxReshapeFunc((AUXRESHAPEPROC)Resize);
	auxKeyFunc(AUX_a,Key_a);
	auxKeyFunc(AUX_d,Key_d);
	auxKeyFunc(AUX_f,Key_f);
	auxKeyFunc(AUX_F,Key_F);
	auxKeyFunc(AUX_s,Key_s);
	auxKeyFunc(AUX_t,Key_t);
	auxMainLoop(Paint);
}
示例#3
0
文件: main.cpp 项目: AlexeyMz/gormel
int main()
{
	float pos[4] = {300, 300, 300, 1};
	float dir[3] = {-1, -1, -1};

	GLfloat mat_specular[] = { 1, 1, 1, 1 };
	GLfloat mat_diffuse[] = { 1, 1, 1, 1 };
	GLfloat mat_ambient[] = { 0.5, 0.5, 0.5, 1 };

	auxInitPosition( 50, 10, 800, 600);
	auxInitDisplayMode( AUX_RGBA | AUX_DEPTH24 | AUX_DOUBLE );
	auxInitWindow( "Graphics" );
	auxIdleFunc(display);
	auxReshapeFunc(resize);
	glEnable(GL_DEPTH_TEST);
	glEnable(GL_COLOR_MATERIAL);

	glEnable(GL_LIGHTING);
	glEnable(GL_LIGHT0);
	glEnable(GL_AUTO_NORMAL);
	glEnable(GL_NORMALIZE);
	glLightfv(GL_LIGHT0, GL_POSITION, pos);
	glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, dir);

	glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
	//glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
	//glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
	glMaterialf(GL_FRONT, GL_SHININESS, 127);

	auxMainLoop(display);
	return 0;
}
int main(int ac,char *av[])
{
	png.Decode(av[1]);
	png.Flip();   // Need to flip upside down because glDrawPixels draws y=0 bottom.

	auxInitDisplayMode(AUX_DOUBLE|AUX_RGB);
	auxInitPosition(0,0,png.wid+2,png.hei+2);
	auxInitWindow(NULL);

	winWid=png.wid;
	winHei=png.hei;


	glViewport(0,0,png.wid,png.hei);

	int viewport[4];
	glGetIntegerv(GL_VIEWPORT,viewport);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glOrtho(0.0,(double)viewport[2],(double)viewport[3],0.0,-1.0,1.0);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

	glDisable(GL_DEPTH_TEST);

	auxReshapeFunc(ReshapeFunc);
	auxMainLoop(DisplayFunc);

	return 0;
}
示例#5
0
文件: simple.cpp 项目: crupib/Source
int _tmain(int argc, _TCHAR* argv[])
{
	auxInitDisplayMode(AUX_SINGLE | AUX_RGBA);
	auxInitPosition(0, 0, 500, 500);
	auxInitWindow(argv[0]);
	glClearColor(0.0, 0.0, 0.0, 0.0);
	glClear(GL_COLOR_BUFFER_BIT);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
	
	glBegin(GL_POLYGON);
		glVertex2f(-0.5, -0.5 );
		glVertex2f(-0.5, 0.5);
		glVertex2f(0.5, 0.5);
		glVertex2f(0.5, -0.5);
	glEnd();
	
	//auxWireCube(0.5);
	glFlush();
	Sleep(6000);


	return 0;
}
示例#6
0
/*  Main Loop
 *  Open window with initial window size, title bar, 
 *  RGBA display mode, and handle input events.
 */
int main(int argc, char** argv)
{
    auxInitDisplayMode (AUX_SINGLE | AUX_RGB);
    auxInitPosition (0, 0, 400, 150);
    auxInitWindow (argv[0]);
    myinit ();
    auxMainLoop(display);
}
示例#7
0
文件: cube1.cpp 项目: quocnam/NQN
int main(int argc, char *argv[])
{
	auxInitPosition(200,100,512,512);
	auxInitDisplayMode(AUX_RGBA);
	auxInitWindow(argv[0]);
	auxReshapeFunc(resize);
	auxMainLoop(draw);
	return 0;
}
示例#8
0
/*  Main Loop
 *  Open window with initial window size, title bar, 
 *  color index display mode, depth buffer, 
 *  and handle input events.
 */
int main(int argc, char** argv)
{
    auxInitDisplayMode (AUX_SINGLE | AUX_INDEX | AUX_DEPTH);
    auxInitPosition (0, 0, 400, 400);
    auxInitWindow (argv[0]);
    myinit();
    auxReshapeFunc (myReshape);
    auxMainLoop(display);
}
示例#9
0
void btgGLInit3D(CView *pView)
{
	oldRect = drawRect;

	pView->GetClientRect(&drawRect);

	if (oldRect != drawRect)
	{
		if (hGLDeviceContext != NULL)
		{
			wglMakeCurrent(NULL, NULL);
			wglDeleteContext(hGLRenderContext);
			hGLRenderContext = 0;
		}
	}

	hGLDeviceContext = wglGetCurrentDC();
	if (hGLDeviceContext == NULL || hGLRenderContext == 0)
	{
		hGLDeviceContext = ::GetDC(pView->GetSafeHwnd());

		setupPixelFormat(hGLDeviceContext);
		setupPalette(hGLDeviceContext);
		hGLRenderContext = wglCreateContext(hGLDeviceContext);
		wglMakeCurrent(hGLDeviceContext, hGLRenderContext);

		auxInitPosition(0, 0, drawRect.right - drawRect.left, drawRect.bottom - drawRect.top);
		auxInitDisplayMode(AUX_RGB);
	}
	else
	{
		//wglMakeCurrent(hGLDeviceContext, hGLRenderContext);
	}

	CBTGDoc* pDoc = (CBTGDoc*)pView->GetDocument();
	glClearColor((GLfloat)pDoc->mBGRed / 255.0f,
				 (GLfloat)pDoc->mBGGreen / 255.0f,
				 (GLfloat)pDoc->mBGBlue / 255.0f,
				 1.0f);
	glClear(GL_COLOR_BUFFER_BIT);

	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluPerspective(50.0, (float)(drawRect.right - drawRect.left) / (float)(drawRect.bottom - drawRect.top), 1.0, 2000.0);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	btgGLRecalc3DCamera();
	gluLookAt(eye[0], eye[1], eye[2],
			  look[0], look[1], look[2],
			  0.0, 0.0, 1.0);

	glDisable(GL_LIGHTING);
	glDisable(GL_CULL_FACE);
	glDisable(GL_DEPTH_TEST);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE);
}
示例#10
0
/*  Main Loop
 *  Open window with initial window size, title bar, 
 *  RGBA display mode, and handle input events.
 */
int main(int argc, char** argv)
{
    auxInitDisplayMode (AUX_SINGLE | AUX_RGB | AUX_DEPTH);
    auxInitPosition (0, 0, 500, 500);
    auxInitWindow (argv[0]);
    auxMouseFunc (AUX_LEFTBUTTON, AUX_MOUSEDOWN, toggleEye);
    myinit();
    auxReshapeFunc (myReshape);
    auxMainLoop(display);
}
示例#11
0
int main(int argc,char** argv)
{
	auxInitDisplayMode(AUX_SINGLE|AUX_RGB);
	auxInitPosition(0,0,500,500);
	auxInitWindow("光滑明暗处理");
	Init();
	auxReshapeFunc(Resize);
	auxMainLoop(Paint);
	return(0);
}
示例#12
0
int main(int argc, char *argv[])
{
	auxInitPosition(200,100,640,480);
	auxInitDisplayMode(AUX_RGBA);
	auxInitWindow(argv[0]);
	auxReshapeFunc(resize);
	auxMouseFunc(AUX_LEFTBUTTON,AUX_MOUSEDOWN,left);
	auxMainLoop(draw);
	return 0;
}
示例#13
0
int main(int argc,char** argv)
{
	auxInitDisplayMode(AUX_SINGLE|AUX_RGB|AUX_DEPTH16);
	auxInitPosition(0,0,500,500);
	auxInitWindow("¼òµ¥¹âÕÕʾÀý");
	Init();
	auxReshapeFunc(Resize);
	auxMainLoop(Paint);
	return(0);
}
示例#14
0
void main()
{
	auxInitDisplayMode(AUX_SINGLE | AUX_RGBA);
	auxInitPosition(0, 0, 400, 150);
	auxInitWindow("Синус");
	auxReshapeFunc(resize);
	glClearColor(0.0, 0.0, 0.0, 0.0);
	glShadeModel(GL_FLAT);
	auxMainLoop(display);
}
示例#15
0
void main(void)
{
	auxInitDisplayMode(AUX_DOUBLE|AUX_RGB|AUX_ACCUM|AUX_DEPTH16);
	auxInitPosition(0,0,400,400);
	auxInitWindow("¾°Éî");

	Init();

	auxReshapeFunc(Resize);
	auxMainLoop(Paint);
}
示例#16
0
文件: light1.cpp 项目: quocnam/NQN
int main(int argc, char *argv[])
{
	auxInitPosition(200,100,512,512);
	auxInitDisplayMode(AUX_RGBA|AUX_DOUBLE|AUX_DEPTH);
	auxInitWindow(argv[0]);
	auxReshapeFunc(resize);
	auxIdleFunc(draw);
	glCullFace(GL_BACK);
	auxMainLoop(none);
	return 0;
}
示例#17
0
void btgGLInit(CView *pView)
{
	oldRect = drawRect;

	pView->GetClientRect(&drawRect);

	if(oldRect != drawRect)
	{
		if (hGLDeviceContext != NULL)
		{
			wglMakeCurrent(NULL, NULL);
			wglDeleteContext(hGLRenderContext);
			hGLRenderContext = 0;
		}
	}

	hGLDeviceContext = wglGetCurrentDC();
	if (hGLDeviceContext == NULL || hGLRenderContext == 0)
	{
		hGLDeviceContext = ::GetDC(pView->GetSafeHwnd());

		setupPixelFormat(hGLDeviceContext);
		setupPalette(hGLDeviceContext);
		hGLRenderContext = wglCreateContext(hGLDeviceContext);  //create GL render context and select into window
		wglMakeCurrent(hGLDeviceContext, hGLRenderContext);

		//create the viewport for rendering
		auxInitPosition(0, 0, drawRect.right - drawRect.left, drawRect.bottom - drawRect.top);
		//set mode (direct color)
		auxInitDisplayMode(AUX_RGB);
	}
	else
	{
		//wglMakeCurrent(hGLDeviceContext, hGLRenderContext);
	}

	CBTGDoc* pDoc = (CBTGDoc*)pView->GetDocument();
	glClearColor((GLfloat)pDoc->mBGRed / 255.0f,
				 (GLfloat)pDoc->mBGGreen / 255.0f,
				 (GLfloat)pDoc->mBGBlue / 255.0f,
				 1.0f);
	glClear(GL_COLOR_BUFFER_BIT);

	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	gluOrtho2D(0, drawRect.right - drawRect.left, 0, drawRect.bottom - drawRect.top);
	glDisable(GL_LIGHTING);
	glDisable(GL_CULL_FACE);
	glDisable(GL_DEPTH_TEST);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE);
}
示例#18
0
void main(void)
{
    auxInitDisplayMode(AUX_SINGLE|AUX_RGB|AUX_DEPTH16);
    auxInitPosition(0,0,500,500);
    auxInitWindow("¹âÔ´Òƶ¯");

    Init();

    auxMouseFunc(AUX_LEFTBUTTON,AUX_MOUSEDOWN,MoveLight);
    auxReshapeFunc(Resize);
    auxMainLoop(Paint);
}
示例#19
0
int main(int argc,char** argv)
{
	auxInitDisplayMode(AUX_SINGLE|AUX_RGB|AUX_ACCUM|AUX_DEPTH16);
	auxInitPosition(20,20,320,320);
	auxInitWindow("OpenGL ¸¨ÖúÓ¦Óÿâ");

	Init();

	auxReshapeFunc(Resize);
	auxMainLoop(Paint);

	return(0);
}
示例#20
0
void InitWindow (void)
{
#ifdef NO_LIB_GLAUX
	glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
	glutInitWindowPosition(0, 0);
	glutInitWindowSize(WIN_SIZE, WIN_SIZE);
	glutInitDisplayString("qcsg");
#else
	auxInitDisplayMode (AUX_SINGLE | AUX_RGB);
	auxInitPosition(0, 0, WIN_SIZE, WIN_SIZE);
	auxInitWindow("qcsg");
#endif
}
示例#21
0
void InitWindow (void)
{
#if 0// gl
    auxInitDisplayMode (AUX_SINGLE | AUX_RGB);
    auxInitPosition (0, 0, WIN_SIZE, WIN_SIZE);
    auxInitWindow ("qcsg");
#else //glut

	glutinitdisplaymode(GLUT_SINGLE | GLUT_RGB);
	glutInitWindowPosition(WIN_SIZE, WIN_SIZE);
	glutInit("win", "qcsg");

#endif
}
示例#22
0
文件: simple.cpp 项目: crupib/Source
int _tmain(int argc, _TCHAR* argv[])
{
	auxInitDisplayMode(AUX_DOUBLE | AUX_RGBA);
	auxInitPosition(0, 0, 600, 600);
	auxInitWindow(argv[0]);
	myinit();
	auxReshapeFunc(myReshape);
	auxIdleFunc(spinDisplay);
	auxMouseFunc(AUX_LEFTBUTTON, AUX_MOUSEDOWN, startIdleFunc);
	auxMouseFunc(AUX_MIDDLEBUTTON, AUX_MOUSEDOWN, stopIdleFunc);
	auxMainLoop(display);

	return 0;
}
示例#23
0
int main(int argc,char** argv)
{
	auxInitDisplayMode(AUX_SINGLE|AUX_RGB|AUX_DEPTH16);
	auxInitPosition(0,0,450,150);
	auxInitWindow("Он(RGBA ДЈКЅ)");
	auxMouseFunc(AUX_LEFTBUTTON,AUX_MOUSEDOWN,FogCycle);

	Init();

	auxReshapeFunc(Resize);
	auxMainLoop(Paint);

	return(0);
}
示例#24
0
int main(int argc,char** argv)
{
	auxInitDisplayMode(AUX_SINGLE|AUX_RGB);
	auxInitPosition(0,0,400,400);
	auxInitWindow("Composite Modeling Transformations");

	Init();

	auxKeyFunc(AUX_LEFT,shoulderSubtract);
	auxKeyFunc(AUX_RIGHT,shoulderAdd);
	auxKeyFunc(AUX_UP,elbowAdd);
	auxKeyFunc(AUX_DOWN,elbowSubtract);
	auxReshapeFunc(Resize);
	auxMainLoop(Paint);
	return(0);
}
示例#25
0
int main(int argc, char* argv[])
{
	lua_State*	L = luaL_newstate();
	luaL_openlibs(L);
	gLuaLibOpenGL.Initialize(L);

	auxInitDisplayMode(AUX_SINGLE | AUX_RGBA);
	auxInitPosition(1366 - 550, 50, 500, 500);
	auxInitWindow("Lua bind OpenGL");
	OnInitialize();
	auxReshapeFunc(OnWindowSize);
  auxMainLoop(OnRend);

	lua_close(L);
	return 0;
}
示例#26
0
/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////MAIN ///////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
int APIENTRY WinMain(HINSTANCE hInst,HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow)
{
float pos[4] = {1,1,10,1};
float dir[3] = {-1,-1,-1};
float lposSt[4] = {0,0,0,1};
float dir2[3] = {1,1,1};
int val = 180;

    GLfloat mat_specular[] = {3,3,3,10};

    auxInitPosition( 250, 110, WIDTH, HEIGHT);
    auxInitDisplayMode( AUX_RGB | AUX_DEPTH24 | AUX_DOUBLE);    
	auxInitWindow("OpenGL Laba Project!");
    auxIdleFunc(oGl_Render);
    auxReshapeFunc(resize);	
    
	glEnable(GL_DEPTH_TEST);	
    glEnable(GL_COLOR_MATERIAL);
    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);
	glEnable(GL_LIGHT1);
	glEnable(GL_ALPHA);
	glEnable(GL_BLEND);
	glShadeModel(GL_FLAT);
	
    glLightfv(GL_LIGHT0, GL_POSITION, pos);
	glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, dir);	

	glLightfv(GL_LIGHT1, GL_POSITION, lposSt);
	glLightfv(GL_LIGHT1, GL_SPOT_DIRECTION, dir2);
	glLightiv(GL_LIGHT1, GL_SPOT_CUTOFF, &val);



    glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
    glMaterialf(GL_FRONT, GL_SHININESS, 128.0);    
	
	auxKeyFunc(AUX_LEFT, Proc_Left);
	auxKeyFunc(AUX_RIGHT, Proc_Right);
	auxKeyFunc(AUX_UP, Proc_Up);
	auxKeyFunc(AUX_DOWN, Proc_Down);	
	auxKeyFunc(AUX_ESCAPE, Proc_Quit);	
	auxMouseFunc(AUX_LEFTBUTTON, AUX_MOUSELOC, Mouse_Proc);	

    auxMainLoop(oGl_Render);
	return 0;
}
示例#27
0
void SetMode(long w, long h) {
  auxInitDisplayMode(AUX_SINGLE | AUX_RGBA);
  auxInitPosition(0, 0, w, h);
  auxInitWindow("Backlight Preview");

  glOrtho(0.0f, (float)w, 0.0f, (float)h, 1.0f, -1.0f);

  glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
  glClear(GL_COLOR_BUFFER_BIT);

  glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
  glBegin(GL_LINES);
  glVertex2i(0, 0);
  glVertex2i(w, h);
  glVertex2i(w, 0);
  glVertex2i(0, h);
  glEnd();

  glFlush();

  glBegin(GL_POINTS);
}
示例#28
0
void main()
{
	float pos[4] = { 3, 3, 3, 1 };
	float dir[3] = { -1, -1, -1 };
	GLfloat mat_specular[] = { 1, 1, 1, 1 };

	srand(time(0));

	for (int i = 0; i < 50; i++)
	{
		initialize(x[i], y[i]);
	}

	auxInitPosition(50, 10, 400, 400);
	auxInitDisplayMode(AUX_RGB | AUX_DEPTH | AUX_DOUBLE);
	auxInitWindow("Controls");
	auxIdleFunc(display);
	auxReshapeFunc(resize);

	glEnable(GL_DEPTH_TEST);
	glEnable(GL_COLOR_MATERIAL);
	glEnable(GL_LIGHTING);
	glEnable(GL_LIGHT0);

	glLightfv(GL_LIGHT0, GL_POSITION, pos);
	glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, dir);

	glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
	glMaterialf(GL_FRONT, GL_SHININESS, 128.0);

	auxKeyFunc(AUX_LEFT, Key_LEFT);
	auxKeyFunc(AUX_RIGHT, Key_RIGHT);
	auxKeyFunc(AUX_UP, Key_UP);
	auxKeyFunc(AUX_DOWN, Key_DOWN);
	auxMouseFunc(AUX_LEFTBUTTON, AUX_MOUSELOC, mouse);

	auxMainLoop(display);
}
示例#29
0
void main(int argc,char **argv) 
{
	if(Args(argc,argv)==GL_FALSE)auxQuit();

	windW=600;
	windH=300;
	auxInitPosition(0,0,windW,windH);
	
	windType|=(rgb)?AUX_RGB:AUX_INDEX;
	windType|=(doubleBuffer)?AUX_DOUBLE:AUX_SINGLE;

	auxInitDisplayMode(windType);

	if(auxInitWindow("Primitive Test")==GL_FALSE)auxQuit();

	Init();
	auxExposeFunc((AUXEXPOSEPROC)Resize);
	auxReshapeFunc((AUXRESHAPEPROC)Resize);
	auxKeyFunc(AUX_1,KeyPress1);
	auxKeyFunc(AUX_2,KeyPress2);
	auxKeyFunc(AUX_3,KeyPress3);
	auxMainLoop(Paint);
}
示例#30
0
int main( int argc, const char *argv[] )
{
  // reads model into global glb_model;
  ON::Begin();

  ON_TextLog error_log;

  ON_BOOL32 bOK;
  int window_width  = 500;
  int window_height = 500;
  //double port_aspect = ((double)window_width)/((double)window_height);

  // read the file into model
  if ( argc != 2 ) {
    printf("Syntax: %s filename.3dm\n",argv[0] );
    return 0;
  }
  const char* sFileName = argv[1];
  printf("\nFile:  %s\n", sFileName );

  // read the file
  CModel model;
  if ( !model.Read( sFileName, &error_log ) )
  {
    // read failed
    error_log.Print("Unable to read file %s\n",sFileName);
    return 1;
  }

  glb_model = &model;

  // set bbox = world bounding box of all the objects
  model.m_bbox = model.BoundingBox();
  if ( !model.m_bbox.IsValid() )
  {
    // nothing to look at in this model
    return 2;
  }

  // set model.m_view
  if ( model.m_settings.m_views.Count() > 0 )
  {
    // use first viewport projection in file
    double angle;
    model.m_view.m_vp = model.m_settings.m_views[0].m_vp;
    model.m_view.m_target = model.m_settings.m_views[0].m_target;
    model.m_view.m_vp.GetCameraAngle( &angle );
    model.m_view.m_vp.Extents( angle, model.m_bbox );
  }
  else 
  {
    GetDefaultView( model.m_bbox, model.m_view );
  }

  // If needed, enlarge frustum so its aspect matches the window's aspect.
  // Since the Rhino file does not store the far frustum distance in the
  // file, viewports read from a Rhil file need to have the frustum's far
  // value set by inspecting the bounding box of the geometry to be
  // displayed.

  
  ///////////////////////////////////////////////////////////////////
  //
  // GL stuff starts here
  //
  for(;;) {  
    
#if defined(ON_EXAMPLE_GL_USE_GLAUX)
    wchar_t sWindowTitleString[256];
#endif
#if defined(ON_EXAMPLE_GL_USE_GLUT)
    char sWindowTitleString[256];
#endif
    sWindowTitleString[255] = 0;
    if ( argv[0] && argv[0][0] )
    {
      int i;
      for ( i = 0; i < 254 && argv[0][i]; i++ )
        sWindowTitleString[i] = argv[0][i];
      sWindowTitleString[i] = 0;
    }

#if defined(ON_EXAMPLE_GL_USE_GLAUX)
    auxInitPosition( 0, 0, window_width, window_height );
    auxInitDisplayMode( AUX_SINGLE | AUX_RGB | AUX_DEPTH );
    auxInitWindow( sWindowTitleString );

    // register event handler functions
    auxIdleFunc( 0 );
    auxReshapeFunc( myGLAUX_Reshape );
    auxMouseFunc( AUX_LEFTBUTTON,   AUX_MOUSEDOWN, myGLAUX_MouseLeftEvent );
    auxMouseFunc( AUX_LEFTBUTTON,   AUX_MOUSEUP,   myGLAUX_MouseLeftEvent );
    auxMouseFunc( AUX_MIDDLEBUTTON, AUX_MOUSEDOWN, myGLAUX_MouseMiddleEvent );
    auxMouseFunc( AUX_MIDDLEBUTTON, AUX_MOUSEUP,   myGLAUX_MouseMiddleEvent );
    auxMouseFunc( AUX_RIGHTBUTTON,  AUX_MOUSEDOWN, myGLAUX_MouseRightEvent );
    auxMouseFunc( AUX_RIGHTBUTTON,  AUX_MOUSEUP,   myGLAUX_MouseRightEvent );
    auxKeyFunc( AUX_LEFT,  myKeyLeftArrowEvent );
    auxKeyFunc( AUX_RIGHT, myKeyRightArrowEvent );
    auxKeyFunc( AUX_UP,    myKeyUpArrowEvent );
    auxKeyFunc( AUX_DOWN,  myKeyDownArrowEvent );
    auxKeyFunc( AUX_E,  myKeyViewExtents );
    auxKeyFunc( AUX_e,  myKeyViewExtents );
    auxKeyFunc( AUX_Z,  myKeyViewExtents );
    auxKeyFunc( AUX_z,  myKeyViewExtents );
#endif

#if defined(ON_EXAMPLE_GL_USE_GLUT)
    glutInit(&argc,(char**)argv);
    glutInitWindowPosition( 0, 0);
    glutInitWindowSize( window_width, window_height );
    glutInitDisplayMode( GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH );
    glutCreateWindow( sWindowTitleString );

    // register event handler functions
    glutIdleFunc( 0 );
    glutReshapeFunc( myGLUT_Reshape );
    glutMouseFunc( myGLUT_MouseEvent );
    glutKeyboardFunc( myGLUT_KeyboardEvent );
    glutSpecialFunc( myGLUT_SpecialKeyEvent );
    glutDisplayFunc( myDisplay );
#endif

    // setup model view matrix, GL defaults, and the GL NURBS renderer
    GLUnurbsObj* pTheGLNURBSRender = NULL; // OpenGL NURBS rendering context
    bOK = myInitGL( model.m_view.m_vp, pTheGLNURBSRender );

    if ( bOK ) {
      // build display list
      myBuildDisplayList( glb_display_list_number,
                          pTheGLNURBSRender,
                          model );

      // look at it
#if defined(ON_EXAMPLE_GL_USE_GLAUX)
      auxMainLoop( myDisplay );
#endif

#if defined(ON_EXAMPLE_GL_USE_GLUT)
      glutMainLoop(  );
#endif

    }

    gluDeleteNurbsRenderer( pTheGLNURBSRender );

    break;
  }

  //
  // GL stuff ends here
  //
  ///////////////////////////////////////////////////////////////////

  ON::End();

  return 0;
}