The graphics API

Applications can optionally generate graphics, which are displayed either in an application window, or in full-screen mode (screensaver).

If an application is able to generate graphics, it should call

    void boinc_init_opengl();
at the start and
    void boinc_finish_opengl();
at the end. It must also supply a function
    bool app_render(int xs, ys, double time_of_day);
which will be called periodically. This should make openGL calls to generate the current graphic. xs and ys are the X and Y sizes of the window, and time_of_day is the relative time. The function should return true if it actually drew anything. It can refer to the user name, CPU time etc. obtained from boinc_init().

Give example here

Applications that don't do graphics must also supply a dummy app_render to link with the API. boinc_draw_gl is called to draw grpahics


Implementation

The graphics API uses a file graphics.xml that is created and occasionally modified by the core client or screensaver. This file has the format

    <graphics_info>
        <do_graphics/>
        <xsize>500</xsize>
        <ysize>400</ysize>
        <full_screen/>
    </graphics_info>

The graphics API implementation uses a 60 Hz timer. Every 0.5 sec, it sees if graphics.xml has been modified, and if so parses it. Every 1/60 sec, it sees if it's time for a new frame, and if so calls app_render().