void culooks::drawing::displayFunc()
{
culooks::window *Win = getWin();
-
- glClearColor(0,0,0,0);
+
+ glClearColor(Win->bgcolor[0], Win->bgcolor[1], Win->bgcolor[2], Win->bgcolor[3]);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
void culooks::drawing::initWindow(int winid)
{
+
+ glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGBA|GLUT_DEPTH);
glutInitWindowSize(culooks::Windows[winid].second->w, culooks::Windows[winid].second->h);
glutInitWindowPosition(winid*100,winid*100);
glutCreateWindow( ("culooks / " + culooks::Windows[winid].second->name).c_str() );
-
+
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
+ glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
+ glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
+
glutDisplayFunc(&drawing::displayFunc);
glutReshapeFunc(&drawing::reshapeFunc);
glutMotionFunc(&drawing::motionFunc);
glutMouseFunc(&drawing::mouseFunc);
-
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable( GL_BLEND );
+ glutIdleFunc(&drawing::idleFunc);
culooks::Windows[winid].first = glutGetWindow();
-
culooks::Windows[winid].second->initialized = true;
+ culooks::Windows[winid].second->redisplay = true;
}
-void culooks::drawing::idleFunc_master()
+void culooks::drawing::idleFunc()
{
- for (int iwin=0; iwin < culooks::Windows.size(); iwin++)
+ int activeWindow = glutGetWindow();
+
+ for (int iwin=0; iwin < culooks::Windows.size(); iwin++) {
if (!culooks::Windows[iwin].second->initialized)
initWindow(iwin);
+ if (culooks::Windows[iwin].second->redisplay) {
+ glutSetWindow(culooks::Windows[iwin].first);
+ glutPostRedisplay();
+ culooks::Windows[iwin].second->redisplay = false;
+ }
+ }
+
+ glutSetWindow(activeWindow);
}
-void* culooks::drawing::glutThread(void *leer)
+void* culooks::drawing::glutThread(void *_comArg)
{
+ comarg *comArg = (comarg*)_comArg;
+ glutInit(comArg->argc, comArg->argv);
initWindow(0);
- glutIdleFunc(&idleFunc_master);
glutMainLoop();
}