Dive 3 Reference Manual
Web site: <http://www.sics.se/dive/manual/render.html>
Olof Hagsand - <olof@sics.se>
The Swedish Institute of Computer Science,
Stockholm, December, 1995
1. Introduction
This document describes the Dive renderer C-interface, independent of graphic libraries, but X11 dependent. We have currently implemented IrisGL, OpenGL and SunXGL renderers with this interface. Hopefully more will folow. It requires some background knowledge about C and Dive.
The renderer draws images from a certain world, view point and viewing orientation into a screen window. The renderer can handle several different windows with associated viewpoints. For each window and viewpoint, there is a graphics context that contains parameters like field of view, viewports, line width etc.
The renderer uses the following information:
The following functions initializes the rendering module, renders a frame, and performs some auxillary functionalities:
http://www.sics.se/dive/manual/cref.r.html#render_init
http://www.sics.se/dive/manual/cref.r.html#render
http://www.sics.se/dive/manual/cref.r.html#render_exit
http://www.sics.se/dive/manual/cref.r.html#render_get_visual
2.1 Movies
Dive movies can be recorded and then saved to file. A movie is created and returned by "render_movie_create" and deleted with "render_movie_delete". One or many recordings, with "render_movie_record" can be made on a created movie. A recorded movie can be saved to file with "render_movie_save" or a single frame can be saved with "render_movie_frame_save". When saving, a format must be given. Different platforms supports different formats. AT the time of writing (january 1996) ppm and rgb formats are suppoirted on IrisGL only.
When saving one frame, ie, a snapshot, a movie is created with length 1, a recording is made and frame 0 is saved to file.
The following pseudo-code example shows a recording of a movie with 10 frames from window described by ctx:
void record(struct gfx_ctx *ctx)
{
struct render_movie *movie;
movie = render_movie_create();
movie->max = 10;
if (render_movie_record_start(ctx, movie, TRUE) < 0){ /* Blocking */
render_movie_erase(movie);
return;
}
render_movie_save(movie, "/tmp/movie/", "ppm");
render_movie_erase(movie);
}
The following functions gives access to the movie functionalities:
http://www.sics.se/dive/manual/cref.r.html#render_movie_create
http://www.sics.se/dive/manual/cref.r.html#render_movie_erase
http://www.sics.se/dive/manual/cref.r.html#render_movie_record_start
http://www.sics.se/dive/manual/cref.r.html#render_movie_record_stop
http://www.sics.se/dive/manual/cref.r.html#render_movie_save
http://www.sics.se/dive/manual/cref.r.html#render_movie_frame_save
3. Terrain
This is actually the "terrain_renderer". There is also a terrain
module which is graphic independent. The terrain_render module is
encapsulated within the rendering module and is not visible to
application programmers. It is included here if renderers for new
graphic libraries are being implemented. The functionalies may be
void if the module does not support terrain.
void terrain_render (world_t *world, point_p eye, point_p direction, float fov)
void terrain_render_init ()
void terrain_render_exit ()
void terrain_render_initVectors ()
void terrain_render_freeVectors ()
4. Textures
The texture module is encapsulated within the rendering module and is
not visible to application programmers. It is included here if
renderers for new graphic libraries are being implemented. The
functionalies may be void if the module does not support textures.
void texture_init(void)
void texture_deselect(dive_obj * obj, struct view *view)
Deselects current texture.
void texture_select(dive_obj * obj, struct view *view)
Selects current texture, i.e the next object drawn will have this texture. The view's texture index determines which texture in the object's texture vector to use.
void texture_delete(dive_obj * obj, struct view *view)
Frees memory used by the specified texture.
References
[1] Dive 3.2 Reference manual, Actors