4 * An object oriented GL/GLES Abstraction/Utility Layer
6 * Copyright (C) 2010 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, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
24 * Neil Roberts <neil@linux.intel.com>
27 #if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
28 #error "Only <cogl/cogl.h> can be included directly."
31 #ifndef __COGL_TEXTURE_3D_H
32 #define __COGL_TEXTURE_3D_H
39 * SECTION:cogl-texture-3d
40 * @short_description: Fuctions for creating and manipulating 3D textures
42 * These functions allow 3D textures to be used. 3D textures can be
43 * thought of as layers of 2D images arranged into a cuboid
44 * shape. When choosing a texel from the texture, Cogl will take into
45 * account the 'r' texture coordinate to select one of the images.
48 typedef struct _CoglTexture3D CoglTexture3D;
50 #define COGL_TEXTURE_3D(X) ((CoglTexture3D *)X)
53 * cogl_texture_3d_new_with_size:
54 * @context: a #CoglContext
55 * @width: width of the texture in pixels.
56 * @height: height of the texture in pixels.
57 * @depth: depth of the texture in pixels.
58 * @internal_format: the #CoglPixelFormat to use for the GPU
59 * storage of the texture.
60 * @error: A GError return location.
62 * Creates a new Cogl 3D texture with the specified dimensions and
65 * Note that this function will throw a #GError if
66 * %COGL_FEATURE_TEXTURE_3D is not advertised. It can also fail if the
67 * requested dimensions are not supported by the GPU.
69 * Return value: a new #CoglTexture3D object or
70 * %NULL on failure and an exception will be returned
76 cogl_texture_3d_new_with_size (CoglContext *context,
80 CoglPixelFormat internal_format,
84 * cogl_texture_3d_new_from_data:
85 * @context: a #CoglContext
86 * @width: width of the texture in pixels.
87 * @height: height of the texture in pixels.
88 * @depth: depth of the texture in pixels.
89 * @format: the #CoglPixelFormat the buffer is stored in in RAM
90 * @internal_format: the #CoglPixelFormat that will be used for storing
91 * the buffer on the GPU. If COGL_PIXEL_FORMAT_ANY is given then a
92 * premultiplied format similar to the format of the source data will
93 * be used. The default blending equations of Cogl expect premultiplied
94 * color data; the main use of passing a non-premultiplied format here
95 * is if you have non-premultiplied source data and are going to adjust
96 * the blend mode (see cogl_material_set_blend()) or use the data for
97 * something other than straight blending.
98 * @rowstride: the memory offset in bytes between the starts of
99 * scanlines in @data or 0 to infer it from the width and format
100 * @image_stride: the number of bytes from one image to the next. This
101 * can be used to add padding between the images in a similar way
102 * that the rowstride can be used to add padding between
103 * rows. Alternatively 0 can be passed to infer the @image_stride
105 * @data: pointer the memory region where the source buffer resides
106 * @error: A GError return location.
108 * Creates a new 3D texture and initializes it with @data. The data is
109 * assumed to be packed array of @depth images. There can be padding
110 * between the images using @image_stride.
112 * Note that this function will throw a #GError if
113 * %COGL_FEATURE_TEXTURE_3D is not advertised. It can also fail if the
114 * requested dimensions are not supported by the GPU.
116 * Return value: the newly created #CoglTexture3D or %NULL if
117 * there was an error an an exception will be returned
120 * Stability: Unstable
123 cogl_texture_3d_new_from_data (CoglContext *context,
127 CoglPixelFormat format,
128 CoglPixelFormat internal_format,
135 * cogl_is_texture_3d:
136 * @object: a #CoglObject
138 * Checks whether the given object references a #CoglTexture3D
140 * Return value: %TRUE if the passed object represents a 3D texture
141 * and %FALSE otherwise
144 * Stability: Unstable
147 cogl_is_texture_3d (void *object);
151 #endif /* __COGL_TEXTURE_3D_H */