コード例 #1
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;
}
コード例 #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
ファイル: 1.cpp プロジェクト: SysMa/msq-summer-project
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;
	}
		
}
コード例 #4
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
ファイル: 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;
}
コード例 #6
0
ファイル: lines.c プロジェクト: jsj2008/MAC-and-IPhone-src
/*  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
ファイル: alpha3D.c プロジェクト: jsj2008/MAC-and-IPhone-src
/*  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);
}
コード例 #10
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);
}
コード例 #11
0
ファイル: 光照模型.cpp プロジェクト: alannet/example
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);
}
コード例 #12
0
ファイル: connectlines1.cpp プロジェクト: quocnam/NQN
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
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);
}
コード例 #14
0
ファイル: 景深.cpp プロジェクト: alannet/example
void main(void)
{
	auxInitDisplayMode(AUX_DOUBLE|AUX_RGB|AUX_ACCUM|AUX_DEPTH16);
	auxInitPosition(0,0,400,400);
	auxInitWindow("¾°Éî");

	Init();

	auxReshapeFunc(Resize);
	auxMainLoop(Paint);
}
コード例 #15
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;
}
コード例 #16
0
ファイル: 光源移动1.cpp プロジェクト: alannet/example
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);
}
コード例 #17
0
ファイル: 绘图.cpp プロジェクト: alannet/example
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);
}
コード例 #18
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
}
コード例 #19
0
ファイル: gldraw.c プロジェクト: hypov8/quake2_texture_fix
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
}
コード例 #20
0
ファイル: 雾化效果.cpp プロジェクト: alannet/example
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);
}
コード例 #21
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;
}
コード例 #22
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);
}
コード例 #23
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;
}
コード例 #24
0
ファイル: Main.cpp プロジェクト: maxya/old_sources
/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////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;
}
コード例 #25
0
ファイル: Display.cpp プロジェクト: acsearle/backlight
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);
}
コード例 #26
0
ファイル: main.cpp プロジェクト: AmberWish/LuckyPets
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);
}
コード例 #27
0
ファイル: 处理流水线1.cpp プロジェクト: alannet/example
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);
}
コード例 #28
0
ファイル: example_gl.cpp プロジェクト: Arecius/opennurbs
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;
}
コード例 #29
0
ファイル: gldraw.c プロジェクト: AEonZR/GtkRadiant
void InitWindow (void)
{
    auxInitDisplayMode (AUX_SINGLE | AUX_RGB);
    auxInitPosition (0, 0, WIN_SIZE, WIN_SIZE);
    auxInitWindow ("qcsg");
}
コード例 #30
0
ファイル: BZPhase.c プロジェクト: RedAndr/BZPhase
int main(int pn, char **ps){
  int i,j,pxc,c;
  double sx,second[4];
  FILE *ic;
  char ss[60];

  puts(" ###############################################################################");
  puts(" # BZPhaseFlow -  Phase Portraits Builder of the Belousov-Zhabotinsky reaction #");
  puts(" # Copyright (C) Andrew B. Ryzhkov and Arcady V. Antipin, 1997-2006. Ver. 2.00 #");
  puts(" # Ufa,      Institute of Organic Chemistry,   Laboratory of Chemical Kinetics #");
  puts(" # Montreal, McGill University, Department of Oceanic and Atmospheric Sciences #");
  puts(" # E-Mail: [email protected]                         WWW: http://RedAndr.ca/bz #");
  puts(" ###############################################################################");
                                                                                      
  SetConsoleTitle("BZPhaseFlow 2.00");                                                    
                                                                                      
  /* for Borland */
//  _clear87();
//  _control87(MCW_EM, MCW_EM);  /* defined in float.h */

  if(pn<2) {                                                                          
    ic=fopen("BZPhase.dat","rt");                                                     
    if(ic!=NULL) {
ReadData:
      do fgets(ss,80,ic); while(ss[0]==';'); sscanf(ss,"%le",&BegRange);
      do fgets(ss,80,ic); while(ss[0]==';'); sscanf(ss,"%d" ,&NumPoints);
      do fgets(ss,80,ic); while(ss[0]==';'); sscanf(ss,"%le",&DeltaSolve);
      do fgets(ss,80,ic); while(ss[0]==';'); sscanf(ss,"%le",&ep); tor=ep;

      for(i=0;i<nk;i++) { do fgets(ss,80,ic); while(ss[0]==';'); sscanf(ss,"%le",&k[i]);}
      for(i=0;i<n ;i++) { do fgets(ss,80,ic); while(ss[0]==';'); sscanf(ss,"%le",&x[i]);}
      for(i=0;i<n ;i++) { do fgets(ss,80,ic); while(ss[0]==';'); sscanf(ss,"%le",&flowc0[i]);}

      printf("BegRange = %5.0f, NumPoints = %6d, DeltaSolve = %2.2f, Precision = %9.2E\n",  BegRange,NumPoints,DeltaSolve,ep);
      for(i=0;i<n ;i++) printf("k[%2d] = %E, c0[%2d] = %E, flowc0[%2d] = %E\n", i+1, k[i], i+1, x[i], i+1, flowc0[i]);
      for(i=n;i<nk;i++) printf("k[%2d] = %E\n", i+1, k[i]);

      do fgets(ss,80,ic); while(ss[0]==';'); sscanf(ss,"%le",&xflow);                           // flow parametr
      printf("Flow parameter = %14.8E\n", xflow);

      fclose(ic);
    } else if(errno==2) {
      help();
      return 1;
    } else {
      printf("Error opening file 'bzphase.dat' #%d\n",errno);
      return 2;
    }
  } else {
    if(pn>2) {
      puts("Opening file");
      ic=fopen(ps[1],"rt");
      if(ic==NULL) { printf("Error opening file '%s' #%d",ps[1],errno); return 2; }
      pm=malloc(pmax*sizeof(float)*4);
      if( pm == NULL ) {
        puts( "Unable to allocate memory\n" );
        return -1;
      }
      puts("Reading file");
      j=0;
      do {
        fscanf(ic,"%le %le %le %le",&t,&p(j,0),&p(j,1),&p(j,2));
        j++;
        if (j%100==0) printf("\r %d",j);
        fflush(stdout);
        if (j==pmax) break;
      } while (!feof(ic));
      fclose(ic);
      printf("\n%d points is readout\n",j-1);
      goto Show;
    } else {
      ic=fopen(ps[1],"rt");
      if(ic!=NULL) goto ReadData;
      printf("Error opening file '%s' #%d\n",ps[1],errno);
      return 2;
    }
  }

  tor=ep;
  for(i=0;i<n;i++) yy[i]=x[i];          // begin concs

  printf("Calculate begining range: %10.2f",BegRange);  fflush(stdout);
  Delta=BegRange;
  second[0]=(double)(GetTickCount())/1000;
  stepx();
  second[1]=(double)(GetTickCount())/1000;
  printf("\n");

  for(i=0;i<n ;i++) printf("c[%2d] = %20.12E\n",i+1,yy[i]);

  i=NumPoints*sizeof(float)*4;
  printf("Allocate %d bytes memory for %d points\n",i,NumPoints);
  pm=malloc(i);
  if( pm == NULL ) {
    puts( "Unable to allocate memory\n" );
    return -1;
  }

  Delta=DeltaSolve;  mj=NumPoints;  mmj=(int)(t+mj*Delta);
  printf("Calculate until %d \n",mmj);
  second[2]=(double)(GetTickCount())/1000;
  for (j=0;j<mj;j++) {
        p(j,0)= (float)yy[2];                // Br-  2
        p(j,1)= (float)yy[5];                // Me   5
        p(j,2)= (float)yy[7];                // Br2  7
        p(j,3)= (float)yy[9];                // Br'  9
//printf("%e %e %e %e\n",t,yy[2],yy[5],yy[7],yy[9]);
    if (j%1000==0) {printf("\r %6.2f %%",t*100/mmj); fflush(stdout);}
    stepx();
  }
  second[3]=(double)(GetTickCount())/1000;
  printf("\nCalculation complete, elapsed time: %10.3f and %10.3f seconds\n",second[1]-second[0],second[3]-second[2]);
  stp=ms[6];  fun=ms[7];  jac=ms[8];  lum=ms[9];  slt=ms[10];
  printf("Funs: %d Jacs: %d LUm: %d Slt: %d Steps: %d\n",fun,jac,lum,slt,stp);

Show:
   pixcount=j-1;
   pxc=pixcount;

   puts("Search Max&Min");
   maxpx=minpx=p(0,0);
   maxpy=minpy=p(0,1);
   maxpz=minpz=p(0,2);
   maxpw=minpw=p(0,3);
   for(c=1;c<pxc;c++) {
           sx=p(c,0); if(sx>maxpx) maxpx=sx; else if(sx<minpx) minpx=sx;
           sx=p(c,1); if(sx>maxpy) maxpy=sx; else if(sx<minpy) minpy=sx;
           sx=p(c,2); if(sx>maxpz) maxpz=sx; else if(sx<minpz) minpz=sx;
           sx=p(c,3); if(sx>maxpw) maxpw=sx; else if(sx<minpw) minpw=sx;
   }
   printf("Min[2]=%E Max[2]=%E\n",minpx,maxpx);
   printf("Min[5]=%E Max[5]=%E\n",minpy,maxpy);
   printf("Min[7]=%E Max[7]=%E\n",minpz,maxpz);
   printf("Min[9]=%E Max[9]=%E\n",minpw,maxpw);
   
   if(fabs(maxpx-minpx)<1e-10 && fabs(maxpy-minpy)<1e-10 && fabs(maxpz-minpz)<1e-10) {
     puts("I am sorry, but you have the attracting point only.");
     return 1;
   }

   puts("Stretching");
   for(c=0;c<pxc;c++) {
     p(c,0)=(p(c,0)-minpx)/(maxpx-minpx)-0.5;
     p(c,1)=(p(c,1)-minpy)/(maxpy-minpy)-0.5;
     p(c,2)=(p(c,2)-minpz)/(maxpz-minpz)-0.5;
     p(c,3)=(p(c,3)-minpw)/(maxpw-minpw);
   }

   maxcor=1;

   puts("Go to graph");
   help();
   printf("Flow parameter = %14.8E\n", xflow);
   fflush(stdout);
   
   auxInitDisplayMode (AUX_DOUBLE | AUX_RGB | AUX_ACCUM | AUX_DEPTH24);
   auxInitPosition (0, 0, 700, 700);
   auxInitWindow ("BZPhase");

   if (myinit()!=0) {
     puts("Error OpenGL initialization.");
     return 2;
   };

  auxReshapeFunc (myReshape);
  auxKeyFunc (AUX_UP,      rotx1);
  auxKeyFunc (AUX_DOWN,    rotx2);
  auxKeyFunc (AUX_LEFT,    roty1);
  auxKeyFunc (AUX_RIGHT,   roty2);
  auxKeyFunc (AUX_SPACE,   move0);
  auxKeyFunc (AUX_x,       rotz1);
  auxKeyFunc (AUX_z,       rotz2);
  auxKeyFunc (AUX_1,        dis1);
  auxKeyFunc (AUX_2,        dis2);
  auxKeyFunc (AUX_3,        dis3);
  auxKeyFunc (AUX_4,    glmodesw);
  auxKeyFunc (AUX_v,      psize1);
  auxKeyFunc (AUX_c,      psize2);

  auxKeyFunc (AUX_d,      movex1);
  auxKeyFunc (AUX_a,      movex2);
  auxKeyFunc (AUX_w,      movey1);
  auxKeyFunc (AUX_s,      movey2);
  auxKeyFunc (AUX_q,      movez1);
  auxKeyFunc (AUX_e,      movez2);

  auxKeyFunc (AUX_m,      scale);
  auxKeyFunc (AUX_p,      print);

  auxKeyFunc (AUX_r,      par1);
  auxKeyFunc (AUX_t,      par2);
  auxKeyFunc (AUX_y,      par3);
  auxKeyFunc (AUX_u,      par4);
  auxKeyFunc (AUX_i,      par5);
  auxKeyFunc (AUX_o,      par6);

  auxKeyFunc (AUX_f,      par7);
  auxKeyFunc (AUX_g,      par8);
  auxKeyFunc (AUX_h,      par9);
  auxKeyFunc (AUX_j,      para);
  auxKeyFunc (AUX_k,      parb);
  auxKeyFunc (AUX_l,      parc);

  auxMouseFunc (AUX_LEFTBUTTON , AUX_MOUSEUP,   Mouse_leftup);
  auxMouseFunc (AUX_LEFTBUTTON , AUX_MOUSELOC,  Mouse_move);
  auxIdleFunc  (Calc);

  auxMainLoop(display);

  return(0);
}