~oem-solutions-group/unity-2d/clutter-1.0

« back to all changes in this revision

Viewing changes to clutter/cogl/cogl/cogl-primitives.h

  • Committer: Bazaar Package Importer
  • Author(s): Emilio Pozuelo Monfort
  • Date: 2010-03-21 13:27:56 UTC
  • mto: (2.1.3 experimental)
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20100321132756-nf8yd30yxo3zzwcm
Tags: upstream-1.2.2
ImportĀ upstreamĀ versionĀ 1.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Cogl
 
3
 *
 
4
 * An object oriented GL/GLES Abstraction/Utility Layer
 
5
 *
 
6
 * Copyright (C) 2007,2008,2009 Intel Corporation.
 
7
 *
 
8
 * This library is free software; you can redistribute it and/or
 
9
 * modify it under the terms of the GNU Lesser General Public
 
10
 * License as published by the Free Software Foundation; either
 
11
 * version 2 of the License, or (at your option) any later version.
 
12
 *
 
13
 * This library is distributed in the hope that it will be useful,
 
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
16
 * Lesser General Public License for more details.
 
17
 *
 
18
 * You should have received a copy of the GNU Lesser General Public
 
19
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 
20
 *
 
21
 *
 
22
 */
 
23
 
 
24
#ifndef __COGL_PRIMITIVES_H
 
25
#define __COGL_PRIMITIVES_H
 
26
 
 
27
/**
 
28
 * SECTION:cogl-primitives
 
29
 * @short_description: Functions that draw various primitive 3D shapes
 
30
 *
 
31
 * The primitives API provides utilities for drawing some
 
32
 * common 3D shapes in a more convenient way than the CoglVertexBuffer
 
33
 * API provides.
 
34
 */
 
35
 
 
36
/**
 
37
 * cogl_rectangle:
 
38
 * @x_1: X coordinate of the top-left corner
 
39
 * @y_1: Y coordinate of the top-left corner
 
40
 * @x_2: X coordinate of the bottom-right corner
 
41
 * @y_2: Y coordinate of the bottom-right corner
 
42
 *
 
43
 * Fills a rectangle at the given coordinates with the current source material
 
44
 **/
 
45
void
 
46
cogl_rectangle (float x_1,
 
47
                float y_1,
 
48
                float x_2,
 
49
                float y_2);
 
50
 
 
51
/**
 
52
 * cogl_rectangle_with_texture_coords:
 
53
 * @x1: x coordinate upper left on screen.
 
54
 * @y1: y coordinate upper left on screen.
 
55
 * @x2: x coordinate lower right on screen.
 
56
 * @y2: y coordinate lower right on screen.
 
57
 * @tx1: x part of texture coordinate to use for upper left pixel
 
58
 * @ty1: y part of texture coordinate to use for upper left pixel
 
59
 * @tx2: x part of texture coordinate to use for lower right pixel
 
60
 * @ty2: y part of texture coordinate to use for left pixel
 
61
 *
 
62
 * Draw a rectangle using the current material and supply texture coordinates
 
63
 * to be used for the first texture layer of the material. To draw the entire
 
64
 * texture pass in @tx1=0.0 @ty1=0.0 @tx2=1.0 @ty2=1.0.
 
65
 *
 
66
 * Since: 1.0
 
67
 */
 
68
void
 
69
cogl_rectangle_with_texture_coords (float  x1,
 
70
                                    float  y1,
 
71
                                    float  x2,
 
72
                                    float  y2,
 
73
                                    float  tx1,
 
74
                                    float  ty1,
 
75
                                    float  tx2,
 
76
                                    float  ty2);
 
77
 
 
78
/**
 
79
 * cogl_rectangle_with_multitexture_coords:
 
80
 * @x1: x coordinate upper left on screen.
 
81
 * @y1: y coordinate upper left on screen.
 
82
 * @x2: x coordinate lower right on screen.
 
83
 * @y2: y coordinate lower right on screen.
 
84
 * @tex_coords: (in) (array) (transfer none): An array containing groups of
 
85
 *   4 float values: [tx1, ty1, tx2, ty2] that are interpreted as two texture
 
86
 *   coordinates; one for the upper left texel, and one for the lower right
 
87
 *   texel. Each value should be between 0.0 and 1.0, where the coordinate
 
88
 *   (0.0, 0.0) represents the top left of the texture, and (1.0, 1.0) the
 
89
 *   bottom right.
 
90
 * @tex_coords_len: The length of the tex_coords array. (e.g. for one layer
 
91
 *   and one group of texture coordinates, this would be 4)
 
92
 *
 
93
 * This function draws a rectangle using the current source material to
 
94
 * texture or fill with. As a material may contain multiple texture layers
 
95
 * this interface lets you supply texture coordinates for each layer of the
 
96
 * material.
 
97
 *
 
98
 * The first pair of coordinates are for the first layer (with the smallest
 
99
 * layer index) and if you supply less texture coordinates than there are
 
100
 * layers in the current source material then default texture coordinates
 
101
 * (0.0, 0.0, 1.0, 1.0) are generated.
 
102
 *
 
103
 * Since: 1.0
 
104
 */
 
105
void
 
106
cogl_rectangle_with_multitexture_coords (float        x1,
 
107
                                         float        y1,
 
108
                                         float        x2,
 
109
                                         float        y2,
 
110
                                         const float *tex_coords,
 
111
                                         int         tex_coords_len);
 
112
 
 
113
/**
 
114
 * cogl_rectangles_with_texture_coords:
 
115
 * @verts: (in) (array) (transfer none): an array of vertices
 
116
 * @n_rects: number of rectangles to draw
 
117
 *
 
118
 * Draws a series of rectangles in the same way that
 
119
 * cogl_rectangle_with_texture_coords() does. In some situations it can give a
 
120
 * significant performance boost to use this function rather than
 
121
 * calling cogl_rectangle_with_texture_coords() separately for each rectangle.
 
122
 *
 
123
 * @verts should point to an array of #float<!-- -->s with
 
124
 * @n_rects * 8 elements. Each group of 8 values corresponds to the
 
125
 * parameters x1, y1, x2, y2, tx1, ty1, tx2 and ty2 and have the same
 
126
 * meaning as in cogl_rectangle_with_texture_coords().
 
127
 *
 
128
 * Since: 0.8.6
 
129
 */
 
130
void
 
131
cogl_rectangles_with_texture_coords (const float *verts,
 
132
                                     unsigned int n_rects);
 
133
 
 
134
/**
 
135
 * cogl_rectangles:
 
136
 * @verts: (in) (array) (transfer none): an array of vertices
 
137
 * @n_rects: number of rectangles to draw
 
138
 *
 
139
 * Draws a series of rectangles in the same way that
 
140
 * cogl_rectangle() does. In some situations it can give a
 
141
 * significant performance boost to use this function rather than
 
142
 * calling cogl_rectangle() separately for each rectangle.
 
143
 *
 
144
 * @verts should point to an array of #float<!-- -->s with
 
145
 * @n_rects * 4 elements. Each group of 4 values corresponds to the
 
146
 * parameters x1, y1, x2, and y2, and have the same
 
147
 * meaning as in cogl_rectangle().
 
148
 *
 
149
 * Since: 1.0
 
150
 */
 
151
void
 
152
cogl_rectangles (const float *verts,
 
153
                 unsigned int n_rects);
 
154
 
 
155
/**
 
156
 * cogl_polygon:
 
157
 * @vertices: An array of #CoglTextureVertex structs
 
158
 * @n_vertices: The length of the vertices array
 
159
 * @use_color: %TRUE if the color member of #CoglTextureVertex should be used
 
160
 *
 
161
 * Draws a convex polygon using the current source material to fill / texture
 
162
 * with according to the texture coordinates passed.
 
163
 *
 
164
 * If @use_color is %TRUE then the color will be changed for each vertex using
 
165
 * the value specified in the color member of #CoglTextureVertex. This can be
 
166
 * used for example to make the texture fade out by setting the alpha value of
 
167
 * the color.
 
168
 *
 
169
 * All of the texture coordinates must be in the range [0,1] and repeating the
 
170
 * texture is not supported.
 
171
 *
 
172
 * Because of the way this function is implemented it will currently
 
173
 * only work if either the texture is not sliced or the backend is not
 
174
 * OpenGL ES and the minifying and magnifying functions are both set
 
175
 * to COGL_MATERIAL_FILTER_NEAREST.
 
176
 *
 
177
 * Since: 1.0
 
178
 */
 
179
void
 
180
cogl_polygon (const CoglTextureVertex  *vertices,
 
181
              unsigned int              n_vertices,
 
182
              gboolean                  use_color);
 
183
 
 
184
#endif /* __COGL_PRIMITIVES_H */