idle function
- From: "samuel.berthelot" <samuel berthelot voila fr>
- To: gtk-app-devel-list gnome org
- Subject: idle function
- Date: Tue, 2 Dec 2003 12:07:41 +0100 (CET)
Hi,
I have 3 glarea in my gtk window. They all display the same thing under
different view angle. They must be updated when required so I wrote this set
of idle functions:
gtk_idle_add_priority (GTK_PRIORITY_REDRAW,glarea_draw, glarea1);
gtk_idle_add_priority (GTK_PRIORITY_REDRAW,glarea_draw, glarea2);
gtk_idle_add_priority (GTK_PRIORITY_REDRAW,glarea_draw, glarea3);
where glarea_draw is as follow :
int glarea_draw (GtkWidget* widget, GdkEventExpose* event)
{
if (event->count > 0)
{
return(TRUE);
}
if (gtk_gl_area_make_current(GTK_GL_AREA(widget)))
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
switch (GPOINTER_TO_INT(gtk_object_get_data(widget, "id"))){
case 1: gluLookAt(0.0, 0.0, distance1,
0.0, 0.0, 0.0,
0.0, 1.0, 0.0);
glRotatef(xrot1,1.0,0.0,0.0);
glRotatef(yrot1,0.0,1.0,0.0);
break;
case 2: gluLookAt(0.0, 0.0, distance2,
0.0, 0.0, 0.0,
0.0, 1.0, 0.0);
glRotatef(xrot2,1.0,0.0,0.0);
glRotatef(yrot2,0.0,1.0,0.0);
break;
case 3: gluLookAt(0.0, 0.0, distance3,
0.0, 0.0, 0.0,
0.0, 1.0, 0.0);
glRotatef(xrot3,1.0,0.0,0.0);
glRotatef(yrot3,0.0,1.0,0.0);
break;
default: ;;
}
etc etc
}
Now my problem is that when the areas need to be updated, there is a laps of
time. I mean they are not updated right at the same time.
Does anybody know why ?
(I know glarea are not part of gtk, but it's the same as any other widget
anyway)
cheers,
Sam
------------------------------------------
Faites un voeu et puis Voila ! www.voila.fr
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]