diff options
author | Neil Roberts <neil@linux.intel.com> | 2010-01-18 09:22:04 +0000 |
---|---|---|
committer | Neil Roberts <neil@linux.intel.com> | 2010-01-18 09:22:04 +0000 |
commit | ae7825275e0b67a2cdab3d3208e16b2b3c11498c (patch) | |
tree | 7a0966eb16ee4ddead3c64e41963bdd2e5d63cfe /cogl/cogl-sub-texture-private.h | |
parent | 963afa88c51ba69820e570560fffc5c1650d16a6 (diff) | |
download | cogl-ae7825275e0b67a2cdab3d3208e16b2b3c11498c.tar.gz |
cogl: Make CoglSubTexture only work for quad rendering
The sub texture backend doesn't work well as a completely general
texture backend because for example when rendering with cogl_polygon
it needs to be able to tranform arbitrary texture coordinates without
reference to the other coordintes. This can't be done when the texture
coordinates are a multiple of one because sometimes the coordinate
should represent the left or top edge and sometimes it should
represent the bottom or top edge. For example if the s coordinates are
0 and 1 then 1 represents the right edge but if they are 1 and 2 then
1 represents the left edge.
Instead the sub-textures are now documented not to support coordinates
outside the range [0,1]. The coordinates for the sub-region are now
represented as integers as this helps avoid rounding issues. The
region can no longer be a super-region of the texture as this
simplifies the code quite a lot.
There are two new texture virtual functions:
transform_quad_coords_to_gl - This transforms two pairs of coordinates
representing a quad. It will return FALSE if the coordinates can
not be transformed. The sub texture backend uses this to detect
coordinates that require repeating which causes cogl-primitives
to use manual repeating.
ensure_non_quad_rendering - This is used in cogl_polygon and
cogl_vertex_buffer to inform the texture backend that
transform_quad_to_gl is going to be used. The atlas backend
migrates the texture out of the atlas when it hits this.
Diffstat (limited to 'cogl/cogl-sub-texture-private.h')
-rw-r--r-- | cogl/cogl-sub-texture-private.h | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/cogl/cogl-sub-texture-private.h b/cogl/cogl-sub-texture-private.h index 899f61e8..c8fa4bbc 100644 --- a/cogl/cogl-sub-texture-private.h +++ b/cogl/cogl-sub-texture-private.h @@ -37,12 +37,11 @@ struct _CoglSubTexture CoglHandle full_texture; - /* The texture coordinates of the subregion of full_texture */ - gfloat tx1, ty1; - gfloat tx2, ty2; - - /* Are all of the texture coordinates a multiple of one? */ - gboolean tex_coords_are_a_multiple; + /* The region represented by this sub-texture */ + gint sub_x; + gint sub_y; + gint sub_width; + gint sub_height; }; GQuark @@ -50,7 +49,7 @@ _cogl_handle_sub_texture_get_type (void); CoglHandle _cogl_sub_texture_new (CoglHandle full_texture, - gfloat tx1, gfloat ty1, - gfloat tx2, gfloat ty2); + gint sub_x, gint sub_y, + gint sub_width, gint sub_height); #endif /* __COGL_SUB_TEXTURE_H */ |