Chapter 2. libs3d - The S3D API

Table of Contents

Using the s3d library
Setting s3d up
Getting started
function reference
s3d_usage
s3d_init
s3d_quit
s3d_mainloop
s3d_push_vertex
s3d_push_vertices
s3d_push_material
s3d_pep_material
s3d_push_material_a
s3d_push_materials_a
s3d_pep_material_a
s3d_pep_materials_a
s3d_load_materials_a
s3d_push_polygon
s3d_push_polygons
s3d_push_line
s3d_push_lines
s3d_push_texture
s3d_push_textures
s3d_pop_vertex
s3d_pop_polygon
s3d_pop_material
s3d_pop_texture
s3d_pop_line
s3d_pep_line_normals
s3d_pep_polygon_normals
s3d_pep_polygon_tex_coord
s3d_pep_polygon_tex_coords
s3d_pep_material_texture
s3d_pep_vertex
s3d_pep_vertices
s3d_pep_line
s3d_pep_lines
s3d_load_line_normals
s3d_load_polygon_normals
s3d_load_polygon_tex_coords
s3d_load_texture
s3d_new_object
s3d_del_object
s3d_clone
s3d_clone_target
s3d_link
s3d_unlink
s3d_flags_on
s3d_flags_off
s3d_translate
s3d_rotate
s3d_scale
s3d_import_model_file
s3d_open_file
s3d_select_font
s3d_draw_string
s3d_strlen
s3d_vector_length
s3d_vector_dot_product
s3d_vector_subtract
s3d_vector_angle
s3d_angle_to_cam
s3d_vector_cross_product
s3d_push_event
s3d_pop_event
s3d_find_event
s3d_delete_event
s3d_set_callback
s3d_clear_callback
s3d_ignore_callback
s3d_get_callback
s3d_process_stack
s3d_mcp_focus
s3d_net_check
Data types
struct s3d_evt
struct mcp_object
struct s3d_obj_info
struct s3d_but_info
struct s3d_key_event
typedef s3d_cb
Definitions
S3D events
S3D Object Flags
Additional Notes
About alpha transparency

Using the s3d library

Setting s3d up

Install the lib using the usual usual mechanism:

 cmake .
 make
 make install
 

You might need to have superuser rights in order to do make install. You should now have the server, the library and some applications installed somewhere.

Getting started

After having s3d installed, you can write your own s3d programs (yeah, that is what this guide is about ;)

 #include <s3d.h>
 

should be enough to access the 3d functions. If you want to use keyboard interaction, do

 #include <s3d_keysym.h>
 

for the keycode table. Now you can compile your program with

 bash$  gcc program.c -ls3d -o program 
 That wasn't that hard, wasn't it?