"Initial commit to Gerrit"
[profile/ivi/cogl.git] / cogl / cogl-attribute-buffer.h
1 /*
2  * Cogl
3  *
4  * An object oriented GL/GLES Abstraction/Utility Layer
5  *
6  * Copyright (C) 2010 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 License
19  * along with this library. If not, see <http://www.gnu.org/licenses/>.
20  *
21  *
22  *
23  * Authors:
24  *   Robert Bragg <robert@linux.intel.com>
25  */
26
27 #if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
28 #error "Only <cogl/cogl.h> can be included directly."
29 #endif
30
31 #ifndef __COGL_ATTRIBUTE_BUFFER_H__
32 #define __COGL_ATTRIBUTE_BUFFER_H__
33
34 /* We forward declare the CoglAttributeBuffer type here to avoid some circular
35  * dependency issues with the following headers.
36  */
37 typedef struct _CoglAttributeBuffer CoglAttributeBuffer;
38
39 #include <cogl/cogl-context.h>
40
41 G_BEGIN_DECLS
42
43 /**
44  * SECTION:cogl-attribute-buffer
45  * @short_description: Functions for creating and manipulating attribute
46  *   buffers
47  *
48  * FIXME
49  */
50
51 #define COGL_ATTRIBUTE_BUFFER(buffer) ((CoglAttributeBuffer *)(buffer))
52
53 /**
54  * cogl_attribute_buffer_new:
55  * @context: A #CoglContext
56  * @bytes: The number of bytes to allocate for vertex attribute data.
57  * @data: An optional pointer to vertex data to upload immediately.
58  *
59  * Declares a new #CoglAttributeBuffer of @size bytes to contain arrays of vertex
60  * attribute data. Once declared, data can be set using cogl_buffer_set_data()
61  * or by mapping it into the application's address space using cogl_buffer_map().
62  *
63  * If @data isn't %NULL then @size bytes will be read from @data and
64  * immediately copied into the new buffer.
65  *
66  * Since: 1.4
67  * Stability: Unstable
68  */
69 CoglAttributeBuffer *
70 cogl_attribute_buffer_new (CoglContext *context,
71                            gsize bytes,
72                            const void *data);
73
74 /**
75  * cogl_is_attribute_buffer:
76  * @object: A #CoglObject
77  *
78  * Gets whether the given object references a #CoglAttributeBuffer.
79  *
80  * Returns: %TRUE if the handle references a #CoglAttributeBuffer,
81  *   %FALSE otherwise
82  *
83  * Since: 1.4
84  * Stability: Unstable
85  */
86 gboolean
87 cogl_is_attribute_buffer (void *object);
88
89 G_END_DECLS
90
91 #endif /* __COGL_ATTRIBUTE_BUFFER_H__ */
92