hi, all
When my application switched between fullscreeen/windowed, looks like the title will disappeared.
This problem occured only on MAC and it works will on Windows.
I've write a sample code below, it will works both on MAC and Windows, i don't know why the title dissappeared on MAC but works well on Windows
USING number-key "1" to switch between windows/fullscreen.
When my application switched between fullscreeen/windowed, looks like the title will disappeared.
This problem occured only on MAC and it works will on Windows.
I've write a sample code below, it will works both on MAC and Windows, i don't know why the title dissappeared on MAC but works well on Windows
USING number-key "1" to switch between windows/fullscreen.
Code:
#include <stdio.h>
#include "GLUT.h"
#include <stdlib.h>
static int fullScr = 0;
static bool windowed = true;
void Update(int para)
{
glutPostRedisplay();
glutTimerFunc(17,Update,0);
}
void exitfunc(int para)
{
exit(0);
}
void key_process(unsigned char key,int x,int y)
{
if(key == '\033')
{
exit(0);
}
if(key == 49/*num key 1*/)
{
windowed = windowed?false:true;
}
if(!windowed)
{
glutFullScreen();
}
else
{
glutReshapeWindow(1024,768);
glutPositionWindow(100,100);
}
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glutSwapBuffers();
}
int main(int argc, char ** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
if(!fullScr)
{
windowed = true;
glutInitWindowSize(1024,768);
}
glutCreateWindow("Xcode Glut Demo");
glutTimerFunc(17, Update,0);
glutDisplayFunc(display);
glutKeyboardFunc(key_process);
if(fullScr)
{
windowed = false;
glutFullScreen();
}
glutMainLoop();
}
Last edited by a moderator: