Geometric Object Rendering

Geometric Object Rendering — Functions for generating easily recognizable 3D geometric objects

Synopsis


#include <gdk/gdkgl.h>


void                gdk_gl_draw_cube                    (gboolean solid,
                                                         double size);
void                gdk_gl_draw_sphere                  (gboolean solid,
                                                         double radius,
                                                         int slices,
                                                         int stacks);
void                gdk_gl_draw_cone                    (gboolean solid,
                                                         double base,
                                                         double height,
                                                         int slices,
                                                         int stacks);
void                gdk_gl_draw_torus                   (gboolean solid,
                                                         double inner_radius,
                                                         double outer_radius,
                                                         int nsides,
                                                         int rings);
void                gdk_gl_draw_tetrahedron             (gboolean solid);
void                gdk_gl_draw_octahedron              (gboolean solid);
void                gdk_gl_draw_dodecahedron            (gboolean solid);
void                gdk_gl_draw_icosahedron             (gboolean solid);
void                gdk_gl_draw_teapot                  (gboolean solid,
                                                         double scale);

Description

Details

gdk_gl_draw_cube ()

void                gdk_gl_draw_cube                    (gboolean solid,
                                                         double size);

Renders a cube. The cube is centered at the modeling coordinates origin with sides of length size.

solid : TRUE if the cube should be solid.
size : length of cube sides.

gdk_gl_draw_sphere ()

void                gdk_gl_draw_sphere                  (gboolean solid,
                                                         double radius,
                                                         int slices,
                                                         int stacks);

Renders a sphere centered at the modeling coordinates origin of the specified radius. The sphere is subdivided around the Z axis into slices and along the Z axis into stacks.

solid : TRUE if the sphere should be solid.
radius : the radius of the sphere.
slices : the number of subdivisions around the Z axis (similar to lines of longitude).
stacks : the number of subdivisions along the Z axis (similar to lines of latitude).

gdk_gl_draw_cone ()

void                gdk_gl_draw_cone                    (gboolean solid,
                                                         double base,
                                                         double height,
                                                         int slices,
                                                         int stacks);

Renders a cone oriented along the Z axis. The base of the cone is placed at Z = 0, and the top at Z = height. The cone is subdivided around the Z axis into slices, and along the Z axis into stacks.

solid : TRUE if the cone should be solid.
base : the radius of the base of the cone.
height : the height of the cone.
slices : the number of subdivisions around the Z axis.
stacks : the number of subdivisions along the Z axis.

gdk_gl_draw_torus ()

void                gdk_gl_draw_torus                   (gboolean solid,
                                                         double inner_radius,
                                                         double outer_radius,
                                                         int nsides,
                                                         int rings);

Renders a torus (doughnut) centered at the modeling coordinates origin whose axis is aligned with the Z axis.

solid : TRUE if the torus should be solid.
inner_radius : inner radius of the torus.
outer_radius : outer radius of the torus.
nsides : number of sides for each radial section.
rings : number of radial divisions for the torus.

gdk_gl_draw_tetrahedron ()

void                gdk_gl_draw_tetrahedron             (gboolean solid);

Renders a tetrahedron centered at the modeling coordinates origin with a radius of the square root of 3.

solid : TRUE if the tetrahedron should be solid.

gdk_gl_draw_octahedron ()

void                gdk_gl_draw_octahedron              (gboolean solid);

Renders a octahedron centered at the modeling coordinates origin with a radius of 1.0.

solid : TRUE if the octahedron should be solid.

gdk_gl_draw_dodecahedron ()

void                gdk_gl_draw_dodecahedron            (gboolean solid);

Renders a dodecahedron centered at the modeling coordinates origin with a radius of the square root of 3.

solid : TRUE if the dodecahedron should be solid.

gdk_gl_draw_icosahedron ()

void                gdk_gl_draw_icosahedron             (gboolean solid);

Renders a icosahedron. The icosahedron is centered at the modeling coordinates origin and has a radius of 1.0.

solid : TRUE if the icosahedron should be solid.

gdk_gl_draw_teapot ()

void                gdk_gl_draw_teapot                  (gboolean solid,
                                                         double scale);

Renders a teapot. Both surface normals and texture coordinates for the teapot are generated. The teapot is generated with OpenGL evaluators.

solid : TRUE if the teapot should be solid.
scale : relative size of the teapot.