4
* An object oriented GL/GLES Abstraction/Utility Layer
6
* Copyright (C) 2007,2008,2009 Intel Corporation.
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.
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.
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/>.
24
#ifndef __COGL_PRIMITIVES_H
25
#define __COGL_PRIMITIVES_H
28
* SECTION:cogl-primitives
29
* @short_description: Functions that draw various primitive 3D shapes
31
* The primitives API provides utilities for drawing some
32
* common 3D shapes in a more convenient way than the CoglVertexBuffer
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
43
* Fills a rectangle at the given coordinates with the current source material
46
cogl_rectangle (float x_1,
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
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.
69
cogl_rectangle_with_texture_coords (float x1,
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
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)
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
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.
106
cogl_rectangle_with_multitexture_coords (float x1,
110
const float *tex_coords,
114
* cogl_rectangles_with_texture_coords:
115
* @verts: (in) (array) (transfer none): an array of vertices
116
* @n_rects: number of rectangles to draw
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.
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().
131
cogl_rectangles_with_texture_coords (const float *verts,
132
unsigned int n_rects);
136
* @verts: (in) (array) (transfer none): an array of vertices
137
* @n_rects: number of rectangles to draw
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.
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().
152
cogl_rectangles (const float *verts,
153
unsigned int n_rects);
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
161
* Draws a convex polygon using the current source material to fill / texture
162
* with according to the texture coordinates passed.
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
169
* All of the texture coordinates must be in the range [0,1] and repeating the
170
* texture is not supported.
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.
180
cogl_polygon (const CoglTextureVertex *vertices,
181
unsigned int n_vertices,
184
#endif /* __COGL_PRIMITIVES_H */