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, see <http://www.gnu.org/licenses/>.
24 * Damien Lespiau <damien.lespiau@intel.com>
25 * Robert Bragg <robert@linux.intel.com>
28 /* For an overview of the functionality implemented here, please see
29 * cogl-buffer-array.h, which contains the gtk-doc section overview for the
41 #include "cogl-private.h"
42 #include "cogl-util.h"
43 #include "cogl-context-private.h"
44 #include "cogl-object.h"
45 #include "cogl-pixel-buffer-private.h"
46 #include "cogl-pixel-buffer.h"
49 * GL/GLES compatibility defines for the buffer API:
52 #if defined (HAVE_COGL_GL)
54 #ifndef GL_PIXEL_UNPACK_BUFFER
55 #define GL_PIXEL_UNPACK_BUFFER GL_PIXEL_UNPACK_BUFFER_ARB
58 #ifndef GL_PIXEL_PACK_BUFFER
59 #define GL_PIXEL_PACK_BUFFER GL_PIXEL_PACK_BUFFER_ARB
65 _cogl_pixel_buffer_free (CoglPixelBuffer *buffer);
67 COGL_BUFFER_DEFINE (PixelBuffer, pixel_buffer)
70 cogl_pixel_buffer_new (CoglContext *context,
74 CoglPixelBuffer *pixel_buffer = g_slice_new0 (CoglPixelBuffer);
75 CoglBuffer *buffer = COGL_BUFFER (pixel_buffer);
78 if (!(context->private_feature_flags & COGL_PRIVATE_FEATURE_PBOS))
83 /* parent's constructor */
84 _cogl_buffer_initialize (buffer,
88 COGL_BUFFER_BIND_TARGET_PIXEL_UNPACK,
89 COGL_BUFFER_USAGE_HINT_TEXTURE,
90 COGL_BUFFER_UPDATE_HINT_STATIC);
92 _cogl_pixel_buffer_object_new (pixel_buffer);
95 cogl_buffer_set_data (COGL_BUFFER (pixel_buffer),
104 _cogl_pixel_buffer_free (CoglPixelBuffer *buffer)
106 /* parent's destructor */
107 _cogl_buffer_fini (COGL_BUFFER (buffer));
109 g_slice_free (CoglPixelBuffer, buffer);