2009-11-27 13:45:36 -05:00
|
|
|
/*
|
|
|
|
* Cogl
|
|
|
|
*
|
|
|
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009 Intel Corporation.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2010-03-01 07:56:10 -05:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*
|
2009-11-27 13:45:36 -05:00
|
|
|
*/
|
|
|
|
|
2012-07-31 10:12:01 -04:00
|
|
|
#ifndef __COGL_TEXTURE_2D_PRIVATE_H
|
|
|
|
#define __COGL_TEXTURE_2D_PRIVATE_H
|
2009-11-27 13:45:36 -05:00
|
|
|
|
2012-04-16 09:14:10 -04:00
|
|
|
#include "cogl-object-private.h"
|
2010-10-27 13:54:57 -04:00
|
|
|
#include "cogl-pipeline-private.h"
|
2009-11-27 13:45:36 -05:00
|
|
|
#include "cogl-texture-private.h"
|
2012-02-17 20:19:17 -05:00
|
|
|
#include "cogl-texture-2d.h"
|
2009-11-27 13:45:36 -05:00
|
|
|
|
2012-07-31 10:00:12 -04:00
|
|
|
#ifdef COGL_HAS_EGL_SUPPORT
|
|
|
|
#include "cogl-egl-defines.h"
|
|
|
|
#endif
|
|
|
|
|
2009-11-27 13:45:36 -05:00
|
|
|
struct _CoglTexture2D
|
|
|
|
{
|
2012-09-10 15:35:39 -04:00
|
|
|
CoglTexture _parent;
|
2009-11-27 13:45:36 -05:00
|
|
|
|
|
|
|
/* The internal format of the GL texture represented as a
|
|
|
|
CoglPixelFormat */
|
2012-11-22 18:01:08 -05:00
|
|
|
CoglPixelFormat internal_format;
|
2012-09-10 15:35:39 -04:00
|
|
|
|
|
|
|
CoglBool auto_mipmap;
|
|
|
|
CoglBool mipmaps_dirty;
|
|
|
|
CoglBool is_foreign;
|
|
|
|
|
|
|
|
/* TODO: factor out these OpenGL specific members into some form
|
|
|
|
* of driver private state. */
|
|
|
|
|
2009-11-27 13:45:36 -05:00
|
|
|
/* The internal format of the GL texture represented as a GL enum */
|
2012-11-09 12:55:54 -05:00
|
|
|
GLenum gl_internal_format;
|
2009-11-27 13:45:36 -05:00
|
|
|
/* The texture object number */
|
2012-09-10 15:35:39 -04:00
|
|
|
GLuint gl_texture;
|
|
|
|
GLenum gl_legacy_texobj_min_filter;
|
|
|
|
GLenum gl_legacy_texobj_mag_filter;
|
|
|
|
GLint gl_legacy_texobj_wrap_mode_s;
|
|
|
|
GLint gl_legacy_texobj_wrap_mode_t;
|
2010-07-13 13:41:01 -04:00
|
|
|
CoglTexturePixel first_pixel;
|
2009-11-27 13:45:36 -05:00
|
|
|
};
|
|
|
|
|
2013-06-07 19:28:14 -04:00
|
|
|
CoglTexture2D *
|
|
|
|
_cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp,
|
2013-07-01 20:48:54 -04:00
|
|
|
CoglBool can_convert_in_place);
|
2013-06-07 19:28:14 -04:00
|
|
|
|
2011-05-24 17:34:10 -04:00
|
|
|
#if defined (COGL_HAS_EGL_SUPPORT) && defined (EGL_KHR_image_base)
|
|
|
|
/* NB: The reason we require the width, height and format to be passed
|
|
|
|
* even though they may seem redundant is because GLES 1/2 don't
|
|
|
|
* provide a way to query these properties. */
|
|
|
|
CoglTexture2D *
|
|
|
|
_cogl_egl_texture_2d_new_from_image (CoglContext *ctx,
|
|
|
|
int width,
|
|
|
|
int height,
|
|
|
|
CoglPixelFormat format,
|
|
|
|
EGLImageKHR image,
|
2012-08-31 14:28:27 -04:00
|
|
|
CoglError **error);
|
2011-05-24 17:34:10 -04:00
|
|
|
#endif
|
|
|
|
|
2012-09-10 16:45:33 -04:00
|
|
|
CoglTexture2D *
|
|
|
|
_cogl_texture_2d_create_base (CoglContext *ctx,
|
|
|
|
int width,
|
|
|
|
int height,
|
2013-06-23 11:18:18 -04:00
|
|
|
CoglPixelFormat internal_format,
|
|
|
|
CoglTextureLoader *loader);
|
2012-09-10 16:45:33 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
_cogl_texture_2d_set_auto_mipmap (CoglTexture *tex,
|
|
|
|
CoglBool value);
|
|
|
|
|
2010-06-03 10:06:47 -04:00
|
|
|
/*
|
|
|
|
* _cogl_texture_2d_externally_modified:
|
2012-04-16 09:14:10 -04:00
|
|
|
* @texture: A #CoglTexture2D object
|
2010-06-03 10:06:47 -04:00
|
|
|
*
|
|
|
|
* This should be called whenever the texture is modified other than
|
|
|
|
* by using cogl_texture_set_region. It will cause the mipmaps to be
|
|
|
|
* invalidated
|
|
|
|
*/
|
|
|
|
void
|
2012-04-16 09:14:10 -04:00
|
|
|
_cogl_texture_2d_externally_modified (CoglTexture *texture);
|
2010-06-03 10:06:47 -04:00
|
|
|
|
2011-02-10 13:22:27 -05:00
|
|
|
/*
|
|
|
|
* _cogl_texture_2d_copy_from_framebuffer:
|
2012-04-16 09:14:10 -04:00
|
|
|
* @texture: A #CoglTexture2D pointer
|
2011-02-10 13:22:27 -05:00
|
|
|
* @src_x: X-position to within the framebuffer to read from
|
|
|
|
* @src_y: Y-position to within the framebuffer to read from
|
|
|
|
* @width: width of the rectangle to copy
|
|
|
|
* @height: height of the rectangle to copy
|
2012-11-09 12:55:54 -05:00
|
|
|
* @src_fb: A source #CoglFramebuffer to copy from
|
|
|
|
* @dst_x: X-position to store the image within the texture
|
|
|
|
* @dst_y: Y-position to store the image within the texture
|
|
|
|
* @level: The mipmap level of @texture to copy too
|
2011-02-10 13:22:27 -05:00
|
|
|
*
|
2012-11-08 18:35:45 -05:00
|
|
|
* This copies a portion of the given @src_fb into the
|
2011-02-10 13:22:27 -05:00
|
|
|
* texture.
|
|
|
|
*/
|
|
|
|
void
|
2012-04-16 09:14:10 -04:00
|
|
|
_cogl_texture_2d_copy_from_framebuffer (CoglTexture2D *texture,
|
2011-02-10 13:22:27 -05:00
|
|
|
int src_x,
|
|
|
|
int src_y,
|
|
|
|
int width,
|
2012-11-09 12:55:54 -05:00
|
|
|
int height,
|
|
|
|
CoglFramebuffer *src_fb,
|
|
|
|
int dst_x,
|
|
|
|
int dst_y,
|
|
|
|
int level);
|
2011-02-10 13:22:27 -05:00
|
|
|
|
2012-07-31 10:12:01 -04:00
|
|
|
#endif /* __COGL_TEXTURE_2D_PRIVATE_H */
|