fps throttle / window decoration

fps throttle / window decoration

Post by Leander Seig » Thu, 20 Dec 2001 04:21:24



Hi NG,

two questions:

1) how can determine the size of the window decoration of
a glut window? my window is slightly displaced when i re-init it....

2) i want to put a fps-throttle in my program so i added the following
code to the end of my display func which is registered via
glutDisplayFunc():

...
        ltime.tv_sec=ttime.tv_sec;
        ltime.tv_usec=ttime.tv_usec;
        gettimeofday(&ttime,NULL);
        if (ttime.tv_sec-ltime.tv_sec)
sec=(1000000-ltime.tv_usec)+ttime.tv_usec;
        else                            sec=ttime.tv_usec-ltime.tv_usec;

        if(sec<40000)
        {       sec=((40000-sec)*1000);
                wtime.tv_sec=0; wtime.tv_nsec=sec;
                nanosleep(&wtime,NULL);
        }
        glutSwapBuffers();

Quote:}

while

        struct timeval ltime,ttime;
        struct timespec wtime;
        long sec;

and a
        gettimeofday(&ttime,NULL);

is done in the normal init of the program so the time struct is not
empty

but it differs about 7 milliseconds (31fps instead of 25 fps)
i tried usleep() and select(0,NULL,NULL,NULL,&timeout) too.. same
effect
i also tried to do it via a glut timer callback but its too slow then
(20fps)

gettimeofday seems to give me correct values (~15000microsecs/frame)

i have no idea what i could do ...

thanks in advance

 
 
 

fps throttle / window decoration

Post by aka The O » Thu, 20 Dec 2001 18:47:11


For greater accuracy I would recommend using timeGetTime() or the high
performance counters (QueryPerformanceCounter(), QueryPerformanceFreq()).
Also - I haven't checked whether this is relevant - but unsure your maths is
entirely float or integer as necessary or you may experience rounding
errors.

Hope that helps
Ian


Quote:> Hi NG,

> two questions:

> 1) how can determine the size of the window decoration of
> a glut window? my window is slightly displaced when i re-init it....

> 2) i want to put a fps-throttle in my program so i added the following
> code to the end of my display func which is registered via
> glutDisplayFunc():

> ...
>         ltime.tv_sec=ttime.tv_sec;
>         ltime.tv_usec=ttime.tv_usec;
>         gettimeofday(&ttime,NULL);
>         if (ttime.tv_sec-ltime.tv_sec)
> sec=(1000000-ltime.tv_usec)+ttime.tv_usec;
>         else                            sec=ttime.tv_usec-ltime.tv_usec;

>         if(sec<40000)
>         {       sec=((40000-sec)*1000);
>                 wtime.tv_sec=0; wtime.tv_nsec=sec;
>                 nanosleep(&wtime,NULL);
>         }
>         glutSwapBuffers();
> }

> while

>         struct timeval ltime,ttime;
>         struct timespec wtime;
>         long sec;

> and a
>         gettimeofday(&ttime,NULL);

> is done in the normal init of the program so the time struct is not
> empty

> but it differs about 7 milliseconds (31fps instead of 25 fps)
> i tried usleep() and select(0,NULL,NULL,NULL,&timeout) too.. same
> effect
> i also tried to do it via a glut timer callback but its too slow then
> (20fps)

> gettimeofday seems to give me correct values (~15000microsecs/frame)

> i have no idea what i could do ...

> thanks in advance

---
This email has been checked for viruses
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.265 / Virus Database: 137 - Release Date: 18/07/2001

 
 
 

fps throttle / window decoration

Post by Leander Seig » Fri, 21 Dec 2001 19:21:11


sorry, i forgot to mention that i'm running linux so these routines are
not available i think
i found a way to make it work by realtime-adjusting ( (un-)correcting the
wait-time) ...
greetings
leander

(i'm still interested if someone knows a better way or can tell me something
about the window decoration)


Quote:> For greater accuracy I would recommend using timeGetTime() or the high
> performance counters (QueryPerformanceCounter(), QueryPerformanceFreq()).
> Also - I haven't checked whether this is relevant - but unsure your maths is
> entirely float or integer as necessary or you may experience rounding
> errors.

 
 
 

1. how to XCreateWindow() with no window manager decorations?

Is it possible, from an XLib program, to tell the window manager not to
put any decorations around your top level window?

The Xt manual talks about a _MOTIF_WM_HINTS property, but I cant find any
information on using it in an XLib program.

I know how to do it from my .Xdefaults:  4Dwm*myprog.clientDecoration: none.

What I want to know is how to hardcode it, for a program whose whole purpose in
life is to play fullscreen videos.  The old version of this program used IrisGL's
noborders() function, but this is no longer an option.


Numerical Aerodynamic Simulation
NASA Ames Research Center

2. NTSC-VGA conversion

3. Suppressing window decoration with 4DWm

4. wglChoosePixelFormatARB returned non matching formats

5. Q: X Window Decorations

6. Double sided polygons?

7. GLUT and Window decorations

8. gluUnProject()

9. FPS decrease when window size becomes lager ?

10. Relativity, Polk: throttle type expression?

11. Hallowen Web & COmputer Decorations

12. wall with 'decoration'

13. Inventor - SoXtFullViewer decorations