1DTK_CREATE_COMPLEX_SHAPE(3)   Draw Toolkit manual  DTK_CREATE_COMPLEX_SHAPE(3)
2
3
4

NAME

6       dtk_create_complex_shape  - Creates or modify a shape to display custom
7       and evolving content
8

SYNOPSIS

10       #include <drawtk.h>
11
12       dtk_hshape dtk_create_complex_shape(dtk_hshape shp,
13                           unsigned int nvert, const float *vertpos,
14                           const float *vertcolor, const float *texcoords,
15                           unsigned int nind, const unsigned int *ind,
16                           unsigned int type, dtk_htex tex);
17

DESCRIPTION

19       dtk_create_complex_shape() creates a shape displaying a complex, custom
20       and  possibly  evolving  content  described by vertex attribute buffers
21       (vertpos, vertcolor and texcoords) and  an  array  ind  containing  the
22       indices  of  vertices whose order describes how to connect the vertices
23       altogether in order to form primitives (controlled by type). tex can be
24       used to specify a texture to be mapped onto the shape.
25
26       vertpos  should point to an array of nvert pairs of float values corre‐
27       sponding of the position (x,y) of each vertex. vertcolor  should  point
28       to  an  array  of  nvert quatuples of float values corresponding of the
29       color (R,G,B,A) of each vertex. texcoords can be  either  NULL  or  can
30       point  to  an array of nvert pairs of float values corresponding to the
31       texture coordinates (u,v) of the vertex. If texcoords is NULL, no  tex‐
32       ture will be used even if tex is not null.
33
34       ind  should  point  to  an array of nind indices of the vertices in the
35       vertex attribute buffers. This list of indices determines how the  ver‐
36       tices  form  the  primitives and depends on type zhich can take one the
37       following value (See OpenGL manual to have detail):
38
39       DTK_TRIANGLE_STRIP
40              The first three vertices defines the first triangle  (and  their
41              order is significant). Each subsequent vertex defines a new tri‐
42              angle using that point along with two vertices from the previous
43              triangle.
44
45       DTK_TRIANGLE_FAN
46              A  triangle  fan is the same as a triangle strip with one excep‐
47              tion: the first vertex of the list is always the first vertex of
48              each triangle.
49
50       DTK_TRIANGLES
51              Separate triangles are specified. Every 3 indices defines in the
52              order a triangle. If nind is not a multiple of 3, the excedent 1
53              or 2 indices are ignored.
54
55       DTK_LINE_STRIP
56              A  series of one or more connected line segments is specified by
57              enclosing a series of two or more endpoints. In this  case,  the
58              ith  index  specifies the end point of the i-1st segment and the
59              start point of the ith segment.
60
61       DTK_LINES
62              Individual line segments, each specified by a pair of  vertices.
63              If nind is odd, then the last index is ignored.
64
65       shp  can  be  used  to modify a previously created shape. If it is non-
66       null, the handle will be used to modify the shape referenced by shp: no
67       new  shape  is  created  and the returned value is ensured to be shp in
68       case of success, NULL otherwise. If shp  is  NULL,  the  function  will
69       attempt to create a new shape.
70
71       The  arrays  vertpos,  vertcolor, texcoords and ind are not copied into
72       internal structures of the created shape. This allows  one  to  dynami‐
73       cally  change  any aspect of the shape. However, in return it forces to
74       keep the buffers allocated during the whole life time of the shape.
75

RETURN VALUE

77       In case of success the function returns the handle to the newly created
78       or modified shape. If the shp argument is non-null, the handle returned
79       is the same value. In case of error, NULL is returned.
80

THREAD SAFETY

82       The data contained into the buffers are accessed only during  the  cre‐
83       ation and the draw of the shape. So if the data is updated in a differ‐
84       ent thread than the one used for drawing, some locking is needed.
85

SEE ALSO

87       dtk_create_shape(3)
88
89
90
91
92
93EPFL                                 2010          DTK_CREATE_COMPLEX_SHAPE(3)
Impressum