Realized I didn't send this to the list in general...doh.

---------- Forwarded message ----------
From: Paul Davis <[EMAIL PROTECTED]>
Date: Nov 27, 2006 2:00 PM
Subject: Re: Refresh Rate
To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>


This took me a few more minutes than I expected, but here's a program
that reads an image from disk and throws it on the screen.

I'm getting ~48 fps.

I think the key is to not use a time out really.  I always go the
oppoiste way.  Ie, throw frames on the screen as fast as possible
unelss throttled back by a wait period.  Ie, if the user wants an FPS
faster than what the computer/software can do, they're SOL, but they
can make it as slow as they want.

So basically, just put a queue_draw() in a function and attach it to:

Glib::signal_idle()

HTH.

You can check out the example code at:
http://gooey.ecn.uiowa.edu/throughput.tar.gz

Compile with:
g++ -Wall `pkg-config --cflags --libs gtkmm-2.4 libglademm-2.4` *.cc
-o throughput

Paul Davis



On 11/27/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
>
>
> Hello,
>
> My application is required to draw to an X-window at a rate of at least 25
> times per second.
> I don't need any windows or widgets - I'm just using draw_gray_image() to
> draw some grayscale bitmaps.
> Unfortunately, I have tested a gtkmm program and it seems to take 40ms to
> refresh the screen without me doing any extra work on top.
> If I do some work in my program it becomes 130ms.
>
> I tried to connect the refresh signal at 1ms but that isn't achievable.
> m_RefreshPeriod = 1 ...
>
>     Glib::signal_timeout().connect(sigc::mem_fun(*this,
>
> &MyImageDisplay::refreshTimeoutCallback),
>                                                  m_RefreshPeriod,
> Glib::PRIORITY_HIGH);
>
>
>
> bool MyImageDisplay::refreshTimeoutCallback()
> {
> RESET_GLOBAL_TIMER;
> START_GLOBAL_TIMER;
> //    GetImageArray(m_Image);                   // Transfer image matrix to
> image array
>
>     Glib::RefPtr<Gdk::Window> window = get_window();
>     window->draw_gray_image(m_refGC, 0, 0, m_XRes, m_YRes,
>                             Gdk::RGB_DITHER_NORMAL, (guchar*)m_Image,
> m_XRes);
> STOP_GLOBAL_TIMER;
> DOUT("time taken :" << GET_GLOBAL_TIME_ELAPSED << std::endl);
>
>     // never disconnect callback
>     return true;
> }
>
>
>
> m_Image is declared as char m_Image[1000000] to cope with the expected
> screen resolution (eg: 1024x768).
>
> Have I picked the wrong library to use?  I realise gtkmm is probably
> targeted at applications like Window Managers/GUIs.  Should I drop gtkmm
> and use Xlib instead?
>
> Thanks,
>
> Duncan
>
>
> *******************Internet Email Confidentiality Footer*******************
> The contents of this e-mail message (including any attachments hereto) are
> confidential to and are intended to be conveyed for the use of the
> recipient to whom it is addressed only. If you receive this transmission in
> error, please notify the sender of this immediately and delete the message
> from your system. Any distribution, reproduction or use of this message by
> someone other than recipient is not authorized and may be unlawful.
>
> _______________________________________________
> gtkmm-list mailing list
> [email protected]
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to