Exemple #1
0
static int l_window_iconify(lua_State* L)
{
	Window* win = l_checkWindow(L, 1);
	glutSetWindow(win->id);
	glutIconifyWindow();
	return 0;
}
Exemple #2
0
static void
move_on(void)
{
  display_count++;
  if (display_count == 2) {
    damage_expectation = 1;
    glutIconifyWindow();
    glutTimerFunc(500, timer, 777);
  }
  if (display_count == 4) {
    printf("display_count == 4\n");
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
    glutCreateSubWindow(main_win, 10, 10, 150, 150);
    glClearColor(0.5, 0.5, 0.5, 0.0);
    glutDisplayFunc(render_sub);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_INDEX);
    glutEstablishOverlay();
    glutCopyColormap(main_win);
    glutSetColor((transP + 1) % 2, 0.0, 1.0, 1.0);
    glutRemoveOverlay();
    glutEstablishOverlay();
    glutCopyColormap(main_win);
    glutCopyColormap(main_win);
    glutSetColor((transP + 1) % 2, 1.0, 1.0, 1.0);
    glClearIndex(transP);
    glIndexf((transP + 1) % 2);
    glutSetWindow(main_win);
    glutRemoveOverlay();
    glutTimerFunc(500, time2, 888);
  }
}
Exemple #3
0
int main(int argc, char** argv)
{
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
	glutCreateWindow("GL interop");
	glutIconifyWindow();
	glutDisplayFunc(computeVBO);
	glutIdleFunc(computeVBO);

	initVBO();

	CreateContext();
	if(!context)
	{
		std::cerr << "Failed to create OpenCL context." << std::endl;
		return EXIT_FAILURE;
	}

	CreateCommandQueue();
	if(!commandQueue)
	{
		Cleanup();
		return EXIT_FAILURE;
	}

	CreateProgram();
	if(!program)
	{
		Cleanup();
		return EXIT_FAILURE;
	}

	kernel = clCreateKernel(program, "init_vbo_kernel", NULL);
	if(!kernel)
	{
		std::cerr << "Failed to create kernel" << std::endl;
		Cleanup();
		return EXIT_FAILURE;
	}

	if (!CreateMemObjects())
	{
		Cleanup();
		return EXIT_FAILURE;
	}

	glutMainLoop();

	std::cout << std::endl;
	std::cout << "Executed program succesfully." << std::endl;
	Cleanup();
}
Exemple #4
0
void sub_screenicon () {
	while (!window_exists){Sleep(100);}
	glutIconifyWindow();
	return;
}
Exemple #5
0
void SampleKeyboard( unsigned char cChar, int nMouseX, int nMouseY )
{
    switch (cChar)
    {
    case 27:
        glutLeaveMainLoop();

        break;


    case 'f':
    case 'F':
        printf("main window toggle fullscreen\n");
        glutFullScreenToggle();

        break;


    case 'r':
    case 'R':
        if (nChildWindow!=-1 && cChar=='r') /* Capital R always resizes the main window*/
        {
            glutSetWindow(nChildWindow);
            printf("child window resize\n");
            if (!bChildSizeDone)
                glutReshapeWindow(glutGet(GLUT_WINDOW_WIDTH)+50,glutGet(GLUT_WINDOW_HEIGHT)+50);
            else
                glutReshapeWindow(glutGet(GLUT_WINDOW_WIDTH)-50,glutGet(GLUT_WINDOW_HEIGHT)-50);
            bChildSizeDone = !bChildSizeDone;
        }
        else
        {
            glutSetWindow(nWindow);
            printf("main window resize\n");
            if (glutGet(GLUT_WINDOW_WIDTH)<400)
                glutReshapeWindow(600,300);
            else
                glutReshapeWindow(300,300);
        }

        break;


    case 'm':
    case 'M':
        if (nChildWindow!=-1 && cChar=='m') /* Capital M always moves the main window*/
        {
            glutSetWindow(nChildWindow);
            /* The window position you request is relative to the top-left
             * corner of the client area of the parent window.
             */
            if (!bChildPosDone)
                glutPositionWindow(glutGet(GLUT_WINDOW_X)+50,glutGet(GLUT_WINDOW_Y)+50);
            else
                glutPositionWindow(glutGet(GLUT_WINDOW_X)-50,glutGet(GLUT_WINDOW_Y)-50);
            bChildPosDone = !bChildPosDone;
        }
        else
        {
            glutSetWindow(nWindow);
            printf("main window position\n");
            /* The window position you request is the outer top-left of the window,
             * the client area is at a different position if the window has borders
             * and/or a title bar.
             */
            if (glutGet(GLUT_WINDOW_X)<400)
                glutPositionWindow(600,300);
            else
                glutPositionWindow(300,300);
        }

        break;


    case 'd':
    case 'D':
        if (nChildWindow!=-1 && cChar=='d') /* Capital D always moves+resizes the main window*/
        {
            glutSetWindow(nChildWindow);
            if (!bChildPosDone)
                glutPositionWindow(glutGet(GLUT_WINDOW_X)+50,glutGet(GLUT_WINDOW_Y)+50);
            else
                glutPositionWindow(glutGet(GLUT_WINDOW_X)-50,glutGet(GLUT_WINDOW_Y)-50);
            bChildPosDone = !bChildPosDone;
            if (!bChildSizeDone)
                glutReshapeWindow(glutGet(GLUT_WINDOW_WIDTH)+50,glutGet(GLUT_WINDOW_HEIGHT)+50);
            else
                glutReshapeWindow(glutGet(GLUT_WINDOW_WIDTH)-50,glutGet(GLUT_WINDOW_HEIGHT)-50);
            bChildSizeDone = !bChildSizeDone;
        }
        else
        {
            if (glutGet(GLUT_WINDOW_X)<400)
                glutPositionWindow(600,300);
            else
                glutPositionWindow(300,300);
            if (glutGet(GLUT_WINDOW_WIDTH)<400)
                glutReshapeWindow(600,300);
            else
                glutReshapeWindow(300,300);
        }
        break;


    case 'c':
    case 'C':
        if (nChildWindow==-1)
        {
            int width  = glutGet(GLUT_WINDOW_WIDTH);
            int height = glutGet(GLUT_WINDOW_HEIGHT);

            /* open child window */
            printf("open child window\n");

            nChildWindow = glutCreateSubWindow(nWindow,(int)(width*.35),(int)(height*.35),(int)(width*.3),(int)(height*.3));
            glutKeyboardFunc( SampleKeyboard );
            glutDisplayFunc( Redisplay );
            glutReshapeFunc( Reshape );
            glutPositionFunc( Position );
            glutWindowStatusFunc( WindowStatus );
        }
        else
        {
            /* close child window */
            printf("close child window\n");
            glutSetWindow(nWindow);
            glutDestroyWindow(nChildWindow);
            nChildWindow = -1;
            bChildSizeDone = GL_FALSE;
            bChildPosDone  = GL_FALSE;
        }
        break;


    case 'i':
    case 'I':
        glutIconifyWindow();
        glutTimerFunc(1500, ChangeTitleTimer, 0);
        break;


    case 'h':
    case 'H':
        if (nChildWindow!=-1 && cChar=='h') /* Capital H always hides the main window*/
        {
            glutSetWindow(nChildWindow);
            glutTimerFunc(2000, UnhideTimer, nChildWindow);
        }
        else
        {
            glutSetWindow(nWindow);
            glutTimerFunc(2000, UnhideTimer, nWindow);
        }
        glutHideWindow();
        break;

    case 'p':
    case 'P':
        if (nChildWindow!=-1 && cChar=='p') /* Capital P always changes pointer for the main window*/
        {
            glutSetWindow(nChildWindow);
            if (glutGet(GLUT_WINDOW_CURSOR)==GLUT_CURSOR_TOP_SIDE)
                glutSetCursor(GLUT_CURSOR_RIGHT_ARROW);
            else
                glutSetCursor(GLUT_CURSOR_TOP_SIDE);
        }
        else
        {
            glutSetWindow(nWindow);
            if (glutGet(GLUT_WINDOW_CURSOR)==GLUT_CURSOR_CYCLE)
                glutSetCursor(GLUT_CURSOR_RIGHT_ARROW);
            else
                glutSetCursor(GLUT_CURSOR_CYCLE);
        }
        break;

    default:
        break;
    }
}
/*
 * Class:     gruenewa_opengl_GLUT__
 * Method:    glutIconifyWindow
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_gruenewa_opengl_GLUT_00024_glutIconifyWindow
  (JNIEnv * jenv, jobject jobj) {
   glutIconifyWindow(); 
}
Exemple #7
0
static void hugsprim_glutIconifyWindow_15(HugsStackPtr hugs_root)
{
    glutIconifyWindow();
    
    hugs->returnIO(hugs_root,0);
}