예제 #1
0
// Destroy current window if any
//
// Note - glutDestroyWindow results in SIGABRT in freeglut, so
//        instead of closing the window, just hide it.  And
//        before hiding it, make sure there is a window,
//        user could have closed it.
//
void KillWindow() {
   if (win) {
#ifdef __APPLE__
        if (current_graphics_mode == MODE_WINDOW) {
            win_width = glutGet(GLUT_WINDOW_WIDTH);
            win_height = glutGet(GLUT_WINDOW_HEIGHT);
            xpos = glutGet(GLUT_WINDOW_X);
            ypos = glutGet(GLUT_WINDOW_Y);
        } else {
            // If fullscreen, resize now to avoid ugly flash if we subsequently 
            // redisplay as MODE_WINDOW.
            glutPositionWindow(xpos, ypos);
            glutReshapeWindow(win_width, win_height);
        }
        
        // On Intel Macs (but not on PowerPC Macs) GLUT's destuctors often crash when 
        // glutDestroyWindow() is called.  So far, this has only been reported for
        // SETI@home. Since it doesn't occur on PowerPC Macs, we suspect a bug in GLUT.  
        // To work around this, we just hide the window instead.  Though this does not 
        // free up RAM and VM used by the graphics, glutDestroyWindow() doesn't free 
        // them either (surprisingly), so there is no additional penalty for doing it 
        // this way.
        glutHideWindow();
#else
      if (glut_is_freeglut && FREEGLUT_IS_INITIALIZED && GLUT_HAVE_WINDOW) {
         glutHideWindow();
      } else {
         int oldwin = win;
         win = 0;	// set this to 0 FIRST to avoid recursion if the following call fails.
         glutDestroyWindow(oldwin);
      }
#endif
   } 
}
예제 #2
0
void checkDisplayOption()
{
    if(gameState == 0)
    {
        switch(currentIndex)
        {
            case 0:
                showInstructions = true;
                break;
            case 1:
                gameState = 1;
                menuOptions[currentIndex].setSelected(false);
                currentIndex = 0;
                menuDif[0].setSelected(true);
                break;
            case 2:
                exit(0);
                break;
        }
    }else if(gameState == 1)
    {
        switch(currentIndex)
        {
            case 0: //turista
            case 1: //agente
            case 2: //guru
                game = Game(currentIndex);
                menuDif[currentIndex].setSelected(false);
                currentIndex = 0;
                menuContinents[0].setSelected(true);
                gameState = 2;
                gameManagement();
                game.startGame();
                nostart = true;
                glutPostRedisplay();
                break;
            case 3: //back
                gameState = 0;
                menuDif[currentIndex].setSelected(false);
                currentIndex = 0;
                menuOptions[0].setSelected(true);
                break;
        }
        //game.setDifficultyGame(currentIndex);
        //game.startGame();
        
    }else if(gameState == 2)
    {
        game.resetGame();
        gameState = 1;
        menuDif[0].setSelected(true);
        glutSetWindow(subWindowMap);
        glutHideWindow();
        glutSetWindow(subWindowSprite);
        glutHideWindow();
        glutSetWindow(windowID);
    }
    
}
예제 #3
0
파일: window.c 프로젝트: trevorfancher/G4L
static int l_window_hide(lua_State* L)
{
	Window* win = l_checkWindow(L, 1);
	glutSetWindow(win->id);
	glutHideWindow();
	return 0;
}
예제 #4
0
	bool createWindow(Window::Ptr window)
	{
		if (window->getState() != Window::NEW) {
			return false;
		}

		int id = glutCreateWindow(window->getName().c_str());
		windows.insert(WindowsBimap::value_type(id, window));
		windowGraphicsContexts.insert(std::make_pair(window, GraphicsContext()));

		glutDisplayFunc(&display);
		glutReshapeFunc(&reshape);
		glutKeyboardFunc(&keyboard);
		glutKeyboardUpFunc(&keyboardUp);
		glutMouseFunc(&mouse);
		glutMotionFunc(&motion);
		glutPassiveMotionFunc(&passiveMotion);
		glutSpecialFunc(&special);
		glutSpecialUpFunc(&specialUp);

		glutHideWindow();

		window->created();

		return true;
	}
예제 #5
0
/*  polygon(0,3,2,1);
  polygon(2,3,7,6);
  polygon(0,4,7,3);
  polygon(1,2,6,5);
  polygon(4,5,6,7);
  polygon(0,1,5,4);
}*/
void display4()
{ /* display callback, clear frame buffer and z buffer,
   rotate cube and draw, swap buffers */
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glLoadIdentity();
     glColor3f(1.0,1.0,1.0);
   glRasterPos2f(-2.03,-1.57);
   Write("Close");
   glutMouseFunc(OnClick1);
          
     if(xo>24&&xo<54&&yo>64&&yo<85)
          glutHideWindow();
  glRotatef(theta[0], 1.0, 0.0, 0.0);
  glRotatef(theta[1], 0.0, 1.0, 0.0);
  glRotatef(theta[2], 0.0, 0.0, 1.0);
  
  glDrawElements(GL_QUADS,24,GL_UNSIGNED_BYTE,CubeIndices);
  glBegin(GL_LINES);
        glVertex3f(0.0,0.0,0.0);
        glVertex3f(1.0,1.0,1.0);
    glEnd();
//  colorcube();
  glFlush();
  glutSwapBuffers();
}
예제 #6
0
void display7(void)
{
  glClear(GL_COLOR_BUFFER_BIT);
  glColor3f(0.0,0.0,1.0);
   glRasterPos2f(10.03,10.57);
   Write("Close");
   glutMouseFunc(OnClick1);
          
     if(xo>6&&xo<38&&yo>14&&yo<32)
            glutHideWindow();
  glColor3f(1.0,0.0,0.0);
  for(i=0;i<maxx;i++)
  xx[i]=xz1+i*dx;
  for(j=0;j<maxy;j++)
  yy[j]=yz1+j*dy;

  glColor3f(1.0,0.0,0.0);
  for(i=0;i<maxx-1;i++)
  for(j=0;j<maxy-1;j++)
  {
    glColor3f(1.0,0.0,0.0);
    glBegin(GL_LINE_LOOP);
    glVertex2f(xx[i],yy[j]);
    glVertex2f(xx[i],yy[j+1]);
    glVertex2f(xx[i+1],yy[j+1]);
    glVertex2f(xx[i+1],yy[j]);
    glEnd();
    glFlush();
  }
}
예제 #7
0
/*
 * This private function creates a menu and adds it to the menus list
 */
SFG_Menu* fgCreateMenu( FGCBMenu menuCallback )
{
    int x = 100, y = 100, w = 1, h = 1;
    SFG_Window *current_window = fgStructure.CurrentWindow;

    /* Have the menu object created */
    SFG_Menu* menu = (SFG_Menu *)calloc( sizeof(SFG_Menu), 1 );

    menu->ParentWindow = NULL;

    /* Create a window for the menu to reside in. */

    fgCreateWindow( NULL, "freeglut menu", GL_TRUE, x, y, GL_TRUE, w, h,
                    GL_FALSE, GL_TRUE );
    menu->Window = fgStructure.CurrentWindow;
    glutDisplayFunc( fgDisplayMenu );

    glutHideWindow( );  /* Hide the window for now */
    fgSetWindow( current_window );

    /* Initialize the object properties: */
    menu->ID       = ++fgStructure.MenuID;
    menu->Callback = menuCallback;
    menu->ActiveEntry = NULL;

    fgListInit( &menu->Entries );
    fgListAppend( &fgStructure.Menus, &menu->Node );

    /* Newly created menus implicitly become current ones */
    fgStructure.CurrentMenu = menu;

    return menu;
}
예제 #8
0
void display10()
{
     glClear(GL_COLOR_BUFFER_BIT);
     glColor3f(0.0,0.0,1.0);
   glRasterPos2f(10.03,10.57);
   Write("Close");
   
     glColor3f(1.0,0.0,0.0);
     glutMouseFunc(OnClick3); 
     
     if(d1[f2-2]>7&&d1[f2-2]<38&&c1[f2-2]>13&&c1[f2-2]<33)
          glutHideWindow();
     glBegin(GL_LINES);
     glVertex2f(d1[f2-2],c1[f2-2]);
     glVertex2f(d1[f2-1],c1[f2-1]);
     glEnd();
     glColor3f(0.0,0.0,1.0);
     glBegin(GL_LINE_LOOP);
     glVertex2f(xmin,ymin);
     glVertex2f(xmax,ymin);
     glVertex2f(xmax,ymax);
     glVertex2f(xmin,ymax);
     glEnd();
     Liang(d1[f2-2],c1[f2-2],d1[f2-1],c1[f2-1]);
     glFlush();
     glutPostRedisplay();
}
예제 #9
0
/*
 * Deactivates a menu pointed by the function argument.
 */
void fgDeactivateSubMenu( SFG_MenuEntry *menuEntry )
{
    SFG_Window *current_window = fgStructure.Window;
    SFG_MenuEntry *subMenuIter;
    /*
     * Hide the present menu's window
     */
    fgSetWindow( menuEntry->SubMenu->Window );
    glutHideWindow( );

    /*
     * Forget about having that menu active anymore, now:
     */
    menuEntry->SubMenu->Window->ActiveMenu = NULL;
    menuEntry->SubMenu->IsActive = GL_FALSE;

    /*
     * Hide all submenu windows, and the root menu's window.
     */
    for ( subMenuIter = (SFG_MenuEntry *)menuEntry->SubMenu->Entries.First;
          subMenuIter;
          subMenuIter = (SFG_MenuEntry *)subMenuIter->Node.Next )
    {
        /*
         * Is that an active submenu by any case?
         */
        if( subMenuIter->SubMenu )
            fgDeactivateSubMenu( subMenuIter );
    }

    fgSetWindow( current_window );
}
예제 #10
0
파일: v2.cpp 프로젝트: lanaczko/opengl-tut
int main(int argc, char **argv)
{
  char *version = NULL;
  char *vendor = NULL;
  char *renderer = NULL;
  char *extensions = NULL;
  GLuint idWindow = 0;
  int	glutVersion;
 
  glutInit(&argc, argv);
  glutInitWindowSize(1,1);
  glutInitDisplayMode(GLUT_RGBA);
  idWindow = glutCreateWindow(PROGRAM);
  glutHideWindow();
 
  glutVersion = glutGet(0x01FC);
  version =     (char*)glGetString(GL_VERSION);
  vendor =      (char*)glGetString(GL_VENDOR);
  renderer =    (char*)glGetString(GL_RENDERER);
  extensions =  (char*)glGetString(GL_EXTENSIONS);
 
  printf("GLUT=%d\nVERSION=%s\nVENDOR=%s\nRENDERER=%s\nEXTENSIONS=%s\n",
    glutVersion,version,vendor,renderer,extensions);
 
  glutDestroyWindow(idWindow);
  return(0);
}
예제 #11
0
HRESULT CVideoMixerOpenGL::SetViewPortPri(RECT* prPort)
{
	if(prPort==NULL)
		return E_POINTER;

	if((m_rViewPort .left  == prPort->left)&&
		(m_rViewPort .top  == prPort->top) &&
		(m_rViewPort .right  == prPort->right) &&
		(m_rViewPort .bottom  == prPort->bottom))
		return S_OK;

	m_rViewPort  = *prPort;
	
	glutReshapeWindow(prPort->right-prPort->left,prPort->bottom-prPort->top);
	glutPositionWindow(prPort->left,prPort->top );


	if(m_pDMCP)
	{
		HRESULT hr = m_pDMCP->SetTargetRect(&m_rViewPort);
		if(FAILED(hr))
			DP("[GFXPRESENT] SetTargetRect failed :0x%x \n",hr);

		m_bCanDisp = m_pDMCP->CanDisplay(FALSE);

		if(m_bShow && m_bCanDisp)
			glutShowWindow();
		else
			glutHideWindow();

	}

	return S_OK;
}
void showSimulationWindow(bool show)
{
	if (show) 
		glutShowWindow();
	else
		glutHideWindow();
}
예제 #13
0
void GlutViewer::open(int w, int h)
{
  //Call base class open to set width/height
  OpenGLViewer::open(w, h);

  if (!GlutViewer::self)
  {
    GlutViewer::self = this;

    if (visible)
      glutInitWindowSize(width, height);
    else
      glutInitWindowSize(1, 1);

    win = glutCreateWindow("");

    if (!visible) glutHideWindow();

    glutDisplayFunc(glut_display);
    glutReshapeFunc(glut_resize);
    glutKeyboardFunc(glut_keyboard);
    glutSpecialFunc(glut_keyboard_ext);
    glutMouseFunc(glut_mouseclick);
    glutMotionFunc(glut_mousemove);
  }

  //Call OpenGL init
  OpenGLViewer::init();
}
예제 #14
0
void display5()
{
  glClear(GL_COLOR_BUFFER_BIT);

   glColor3f(0.0,0.0,1.0);
   glRasterPos2f(10.03,10.57);
   Write("Close");

  glColor3f(0.0,0.0,1.0);
  glBegin(GL_LINE_LOOP);
    glVertex2f(xmin,ymin);
    glVertex2f(xmax,ymin);
    glVertex2f(xmax,ymax);
    glVertex2f(xmin,ymax);
  glEnd();
 
      glutMouseFunc(OnClick2);
      if(d[f-2]>7&&d[f-2]<38&&c[f-2]>13&&c[f-2]<33)
          glutHideWindow();
    glBegin(GL_LINES);
    glVertex2f(d[f-2],c[f-2]);
    glVertex2f(d[f-1],c[f-1]);
  glEnd();
    cohenclipanddraw(d[f-2],c[f-2],d[f-1],c[f-1]);
  glFlush();
  glutPostRedisplay();
}
예제 #15
0
static void KeyPressFunc(unsigned char Key, int x, int y)
{
	switch (Key) {
	case 'F':
	case 'f': //toggle screenmode
		if (!fullscreen) {
			glutFullScreen();
			fullscreen = true;
		}
		else if (fullscreen) {
			glutReshapeWindow(1500, 1000);
			glutPositionWindow(10, 30);
			fullscreen = false;
		}
		break;
	case 'H':
	case 'h': //toggle screenmode
		glutHideWindow();
		break;
	case 'S':
	case 's': //toggle screenmode
		glutShowWindow();
		break;
	case 27:    // Escape key
		exit(1);
	}
}
예제 #16
0
void display()
{
    try
    {
		if (!disconnected)
		{
			// receive scenegraph and do rendering
	        server->render(ract);
			OSGCompat::clearChangelist();
		}
		else
		{
			SLOG << "Attempting to restart ClusterServer..." << endLog;
			// start server, wait for client to connect
			server->start();
			glutShowWindow();
			disconnected = false;
		}
    }
    catch(std::exception &e)
    {
        SLOG << "ERROR: " << e.what() << endLog;
		disconnected = true;
		// try to restart server
        server->stop();
		//after glutHideWindow() control has to be given back to the glutloop for it to have an effect
		glutHideWindow();
	}
}
예제 #17
0
void keyboard1(unsigned char keys,int x,int y)
{
	keystates[keys]=true;
	if(keys=='c')
		glutHideWindow();
	glClearColor(0,0,0,1);
	glutPostRedisplay();
}
예제 #18
0
void updateWindows(){
	glui3->hide();
	glutHideWindow();
	glui2->set_main_gfx_window( main_window );
	glutShowWindow();
	if(game_option == 1){
		game->player2->cpu = true;
		if(listbox1->get_int_val() == 1)
			game->player2->cpudiff = "easy";
		else if(listbox1->get_int_val() == 2)
			game->player2->cpudiff = "medium";
		else if(listbox1->get_int_val() == 3)
			game->player2->cpudiff = "hard";

	} else if(game_option == 2){
		game->player1->cpu = true;
		if(listbox1->get_int_val() == 1)
			game->player1->cpudiff = "easy";
		else if(listbox1->get_int_val() == 2)
			game->player1->cpudiff = "medium";
		else if(listbox1->get_int_val() == 3)
			game->player1->cpudiff = "hard";

	} else if(game_option == 3){
		game->player1->cpu = true;
		if(listbox1->get_int_val() == 1)
			game->player1->cpudiff = "easy";
		else if(listbox1->get_int_val() == 2)
			game->player1->cpudiff = "medium";
		else if(listbox1->get_int_val() == 3)
			game->player1->cpudiff = "hard";


		game->player2->cpu = true;
		if(listbox2->get_int_val() == 1)
			game->player2->cpudiff = "easy";
		else if(listbox2->get_int_val() == 2)
			game->player2->cpudiff = "medium";
		else if(listbox2->get_int_val() == 3)
			game->player2->cpudiff = "hard";
	}
	
	delete game->gameboard;
	game->addGameboard(new Gameboard(gameboard_size));
	game->initializeSocket(game_option+1);

	//Contador 
	int timeOption = time_box->get_int_val();
	if(timeOption>0){
		if		(timeOption == 1) max_play_time = 60; //60 segundos
		else if (timeOption == 2) max_play_time = 30; //30 segundos
		else if (timeOption == 3) max_play_time = 15; //15 segundos
		if(!game->player1->cpu)
			game->clock->start_count(); 
	}
}
예제 #19
0
void display()
{
    if(!running)
    {
        server->start();
        running=true;
        glutShowWindow();
    }
    /*! ignore rendering in zero sized windows */
    if(!winWidth || !winHeight)
        return;
    try
    {                                                       
        OSG::FrameHandler::the()->frame();
        OSG::commitChanges();
        server->render(ract);
        // clear changelist from prototypes
        OSG::Thread::getCurrentChangeList()->clear();
    } 
    catch(OSG_STDEXCEPTION_NAMESPACE::exception &e)
    {
        if(exitOnError)
        {
            SLOG << e.what() << std::endl;
            printf("Exit on error %s",e.what());
            try
            {
                cleanup();
            }

            catch(...)
            {
            }

            exit(0);
        }
        else
        {
            window->clearPorts();
            // try to restart server
            try
            {
                server->stop();
            }
            catch(...)
            {
            }
            running=false;
            glutHideWindow();
        }
    }
}
예제 #20
0
	void doSetWindowVisible(bool visible)
	{
		Window::Ptr window = getCurrentWindow();
		if (window) {
			if (visible) {
				glutShowWindow();
				window->onShow();
			} else {
				glutHideWindow();
				window->onHide();
			}
		}
	}
예제 #21
0
HRESULT CVideoMixerOpenGL::Show(BOOL bShow)
{
	if(m_bShow==bShow)
		return S_OK;
	m_bShow = bShow;

	if(m_bShow && m_bCanDisp)
		glutShowWindow();
	else
		glutHideWindow();

	return S_OK;
}
예제 #22
0
void display9(void)
{
  glClear(GL_COLOR_BUFFER_BIT);
  glColor3f(0.0,0.0,1.0);
   glRasterPos2f(10.03,10.57);
   Write("Close");
   glutMouseFunc(OnClick1);
          
     if(xo>8&&xo<40&&yo>21&&yo<41)
          glutHideWindow();
  glColor3f(1.0,0.0,0.0);
  cylinderdraw();
  parallelpiped_draw();
  glFlush();
}
예제 #23
0
void display1()
{
  glClear(GL_COLOR_BUFFER_BIT);
  glColor3f(0.0,0.0,1.0);
  glRasterPos2f(30.03,50.77);
  Write("Close");
  glutMouseFunc(OnClick1);

    if(xo>22&&xo<53&&yo>61&&yo<82)
         glutHideWindow();
  dhouse();
  rotate();
  rhouse();
  glFlush();
}
예제 #24
0
/*
 * Deactivates a menu pointed by the function argument.
 */
void fgDeactivateMenu( SFG_Window *window )
{
    SFG_Window *current_window = fgStructure.Window;

    /*
     * Check if there is an active menu attached to this window...
     */
    SFG_Menu* menu = window->ActiveMenu;
    SFG_MenuEntry *menuEntry;

    /*
     * Did we find an active window?
     */
    freeglut_return_if_fail( menu );

    /*
     * Hide the present menu's window
     */
    fgSetWindow( menu->Window );
    glutHideWindow( );

    /*
     * Forget about having that menu active anymore, now:
     */
    menu->Window->ActiveMenu = NULL;
    menu->ParentWindow->ActiveMenu = NULL;
    menu->IsActive = GL_FALSE;

    fgState.ActiveMenus--;

    /*
     * Hide all submenu windows, and the root menu's window.
     */
    for ( menuEntry = ( SFG_MenuEntry * )menu->Entries.First;
          menuEntry;
          menuEntry = ( SFG_MenuEntry * )menuEntry->Node.Next )
    {
        /*
         * Is that an active submenu by any case?
         */
        if( menuEntry->SubMenu )
            fgDeactivateSubMenu( menuEntry );
    }

    fgSetWindow( current_window );
}
예제 #25
0
void display2()
{
  glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
  glColor3f(1.0,0.0,0.0);
    glRasterPos2f(-1.73,1.57);
  Write("Choose no. of divisions : -");
  glRasterPos2f(-1.73,1.37);
  Write("1) One division");
  glRasterPos2f(-1.73,1.17);
  Write("2) Two divisions");
  glRasterPos2f(-1.73,0.97);
  Write("3) Three divisions");
  glRasterPos2f(-1.73,0.77);
  Write("4) Four divisions");
  glRasterPos2f(-1.73,0.57);
  Write("5) Five divisions");
  glRasterPos2f(-1.73,0.37);
  Write("6) Six divisions");
  glColor3f(0.0,0.0,1.0);
  glRasterPos2f(-1.53,-1.37);
  Write("Refresh");
  glColor3f(0.0,0.0,1.0);
  glRasterPos2f(-0.73,-1.37);
  Write("Close");
  glutMouseFunc(OnClick1);
    n=3;
    if(xo>25&&xo<107&&yo>507&&yo<523)
         n=1;
    if(xo>25&&xo<115&&yo>477&&yo<491)
         n=2;
    if(xo>25&&xo<122&&yo>447&&yo<461)
         n=3;
    if(xo>25&&xo<116&&yo>416&&yo<433)
         n=4;
    if(xo>25&&xo<113&&yo>385&&yo<403)
         n=5;
    if(xo>25&&xo<107&&yo>355&&yo<374)
         n=6;
    if(xo>45&&xo<86&&yo>95&&yo<113)
         glutPostRedisplay();
    if(xo>121&&xo<152&&yo>95&&yo<113)
         glutHideWindow();
    glLoadIdentity();
  divide_tetra(v[0],v[1],v[2],v[3],n);
  glFlush();
}
예제 #26
0
파일: main.cpp 프로젝트: qcrist/GameDesign
int main(int argc, char** args)
{
glutInit(&argc,args);
glutInitWindowSize(1,1);
glutInitWindowPosition(-10,-10);
glutCreateWindow("");
glutHideWindow();
glewInit();
int n;
glGetIntegerv(GL_NUM_EXTENSIONS, &n); 
for (int i=0; i<n; i++) 
{ 
  const char* extension = (const char*)glGetStringi(GL_EXTENSIONS, i);
  printf("%s\n", extension); 
}
system("pause");
return 0;
}
int glutmain(int argc, char **argv,int width,int height,const char* title,DemoApplication* demoApp, int posX, int posY, bool showWindow) {
    
	gDemoApplication = demoApp;

	glutInit(&argc, argv);
    //glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STENCIL);
    glutInitWindowPosition(posX, posY);
    glutInitWindowSize(width, height);
    glutCreateWindow(title);
#ifdef BT_USE_FREEGLUT
	glutSetOption (GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
#endif

    gDemoApplication->myinit();

	glutKeyboardFunc(glutKeyboardCallback);
	glutKeyboardUpFunc(glutKeyboardUpCallback);
	glutSpecialFunc(glutSpecialKeyboardCallback);
	glutSpecialUpFunc(glutSpecialKeyboardUpCallback);

	glutReshapeFunc(glutReshapeCallback);
    //createMenu();
	glutIdleFunc(glutMoveAndDisplayCallback);
	glutMouseFunc(glutMouseFuncCallback);
	glutPassiveMotionFunc(glutMotionFuncCallback);
	glutMotionFunc(glutMotionFuncCallback);
	glutDisplayFunc( glutDisplayCallback );

	glutMoveAndDisplayCallback();

//enable vsync to avoid tearing on Apple (todo: for Windows)

#if defined(__APPLE__) && !defined (VMDMESA)
int swap_interval = 1;
CGLContextObj cgl_context = CGLGetCurrentContext();
CGLSetParameter(cgl_context, kCGLCPSwapInterval, &swap_interval);
#endif

	if (!showWindow) 
		glutHideWindow();
	
    glutMainLoop();
    return 0;
}
예제 #28
0
/////////////////////////////////////////////////////////
// dimensionsMess
//
/////////////////////////////////////////////////////////
void gemglutwindow :: dimensionsMess(unsigned int width, unsigned int height)
{
  if (width <= 0) {
    error("width must be greater than 0");
    return;
  }

  if (height <= 0 ) {
    error ("height must be greater than 0");
    return;
  }
  m_width = width;
  m_height = height;
  if(makeCurrent()){
    glutReshapeWindow(width, height);
    glutHideWindow();glutShowWindow();
    glutPositionWindow(m_xoffset, m_yoffset);
    glutMainLoopEvent();
  }
}
예제 #29
0
void display12()
{ /* display callback, clear frame buffer and z buffer,
   rotate cube and draw, swap buffers */
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glLoadIdentity();
  glColor3f(1.0,1.0,1.0);
   glRasterPos2f(-2.03,-1.57);
   Write("Close");
   glutMouseFunc(OnClick1);
          
     if(xo>24&&xo<54&&yo>64&&yo<85)
          glutHideWindow();
    gluLookAt(viewer[0],viewer[1],viewer[2],0.0,0.0,0.0,0.0,1.0,0.0);
  glRotatef(theta[0], 1.0, 0.0, 0.0);
  glRotatef(theta[1], 0.0, 1.0, 0.0);
  glRotatef(theta[2], 0.0, 0.0, 1.0);
  colorcube();
  
  glFlush();
  glutSwapBuffers();
}
예제 #30
0
void display6()
{
    xo1=200.0;yo1=200.0;x2=100.0;y2=300.0;x3=200.0;y3=400.0;x4=300.0;y4=300.0;
  glClear(GL_COLOR_BUFFER_BIT);
    glColor3f(0.0,0.0,1.0);
   glRasterPos2f(50.03,60.57);
   Write("Close");
   glutMouseFunc(OnClick1);

     if(xo>38&&xo<69&&yo>72&&yo<91)
          glutHideWindow(); 
  glColor3f(0.0,0.0,1.0);
  glBegin(GL_LINE_LOOP);
  glVertex2f(xo1,yo1);
  glVertex2f(x2,y2);
  glVertex2f(x3,y3);
  glVertex2f(x4,y4);
  glEnd();
  scanfill(xo1,yo1,x2,y2,x3,y3,x4,y4);
  glFlush();
}