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, write to the
20
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21
* Boston, MA 02111-1307, USA.
24
#ifndef __COGL_TEXTURE_H
25
#define __COGL_TEXTURE_H
27
#include "cogl-bitmap-private.h"
28
#include "cogl-handle.h"
29
#include "cogl-material-private.h"
31
typedef struct _CoglTexture CoglTexture;
32
typedef struct _CoglTexSliceSpan CoglTexSliceSpan;
33
typedef struct _CoglSpanIter CoglSpanIter;
34
typedef struct _CoglTexturePixel CoglTexturePixel;
36
struct _CoglTexSliceSpan
47
CoglTexSliceSpan *span;
53
float intersect_start;
55
float intersect_start_local;
56
float intersect_end_local;
60
/* This is used to store the first pixel of each slice. This is only
61
used when glGenerateMipmap is not available */
62
struct _CoglTexturePixel
64
/* We need to store the format of the pixel because we store the
65
data in the source format which might end up being different for
66
each slice if a subregion is updated with a different format */
74
CoglHandleObject _parent;
76
gboolean bitmap_owner;
81
GArray *slice_x_spans;
82
GArray *slice_y_spans;
83
GArray *slice_gl_handles;
90
gboolean mipmaps_dirty;
92
/* This holds a copy of the first pixel in each slice. It is only
93
used to force an automatic update of the mipmaps when
94
glGenerateMipmap is not available. */
95
CoglTexturePixel *first_pixels;
98
/* To improve batching of geometry when submitting vertices to OpenGL we
99
* log the texture rectangles we want to draw to a journal, so when we
100
* later flush the journal we aim to batch data, and gl draw calls. */
101
typedef struct _CoglJournalEntry
105
CoglMaterialFlushOptions flush_options;
106
CoglMatrix model_view;
107
/* XXX: These entries are pretty big now considering the padding in
108
* CoglMaterialFlushOptions and CoglMatrix, so we might need to optimize this
113
_cogl_texture_pointer_from_handle (CoglHandle handle);
116
_cogl_texture_set_wrap_mode_parameter (CoglTexture *tex,
120
_cogl_texture_set_filters (CoglHandle handle,
125
_cogl_texture_ensure_mipmaps (CoglHandle handle);
128
_cogl_texture_span_has_waste (CoglTexture *tex,
133
_cogl_span_iter_begin (CoglSpanIter *iter,
140
_cogl_span_iter_end (CoglSpanIter *iter);
143
_cogl_span_iter_next (CoglSpanIter *iter);
145
#endif /* __COGL_TEXTURE_H */