2002-08-20 23:54:17 +00:00
|
|
|
<title>The BOINC graphics API</title>
|
|
|
|
<body bgcolor=ffffff>
|
2002-07-30 18:06:39 +00:00
|
|
|
|
2002-08-20 23:54:17 +00:00
|
|
|
<h2>The BOINC graphics API</h2>
|
2002-04-30 22:22:54 +00:00
|
|
|
<p>
|
2002-07-30 18:06:39 +00:00
|
|
|
Applications can optionally generate graphics,
|
2002-07-31 05:59:43 +00:00
|
|
|
which are displayed either in an application window,
|
|
|
|
or in full-screen mode (screensaver).
|
|
|
|
<p>
|
|
|
|
If an application is able to generate graphics, it should call
|
|
|
|
<pre>
|
|
|
|
void boinc_init_opengl();
|
|
|
|
</pre>
|
|
|
|
at the start and
|
2002-07-30 18:06:39 +00:00
|
|
|
<pre>
|
2002-07-31 05:59:43 +00:00
|
|
|
void boinc_finish_opengl();
|
2002-07-30 18:06:39 +00:00
|
|
|
</pre>
|
2002-07-31 05:59:43 +00:00
|
|
|
at the end.
|
|
|
|
It must also supply a function
|
2002-07-30 18:06:39 +00:00
|
|
|
<pre>
|
2002-07-31 05:59:43 +00:00
|
|
|
bool app_render(int xs, ys, double time_of_day);
|
2002-07-30 18:06:39 +00:00
|
|
|
</pre>
|
2002-07-31 05:59:43 +00:00
|
|
|
which will be called periodically.
|
|
|
|
This should make openGL calls to generate the current graphic.
|
|
|
|
<tt>xs</tt> and <tt>ys</tt> are the X and Y sizes of the window,
|
|
|
|
and <tt>time_of_day</tt> 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
|
|
|
|
<tt>boinc_init()</tt>.
|
|
|
|
<p>
|
|
|
|
<b>Give example here</b>
|
|
|
|
<p>
|
|
|
|
Applications that don't do graphics must also supply a
|
|
|
|
dummy <tt>app_render</tt> to link with the API.
|
2002-08-23 19:22:17 +00:00
|
|
|
<tt>boinc_draw_gl</tt> is called to draw graphics
|
2002-07-31 05:59:43 +00:00
|
|
|
|
|
|
|
<hr>
|
|
|
|
<h3>Implementation</h3>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
The graphics API uses a file <b>graphics.xml</b>
|
|
|
|
that is created and occasionally modified by the
|
|
|
|
core client or screensaver.
|
|
|
|
This file has the format
|
|
|
|
<pre>
|
|
|
|
<graphics_info>
|
|
|
|
<do_graphics/>
|
|
|
|
<xsize>500</xsize>
|
|
|
|
<ysize>400</ysize>
|
|
|
|
<full_screen/>
|
|
|
|
</graphics_info>
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
The graphics API implementation uses a 60 Hz timer.
|
2002-08-20 23:54:17 +00:00
|
|
|
Every 0.5 sec, it sees if graphics.xml has been modified, and if so parses it.
|
2002-07-31 05:59:43 +00:00
|
|
|
Every 1/60 sec, it sees if it's time for a new frame,
|
|
|
|
and if so calls <tt>app_render()</tt>.
|