diff options
author | Neil Roberts <neil@linux.intel.com> | 2009-12-02 13:41:49 +0000 |
---|---|---|
committer | Neil Roberts <neil@linux.intel.com> | 2009-12-02 22:03:08 +0000 |
commit | 6bc3319c86be6b74e7e0701e11e34d4acfb56017 (patch) | |
tree | 983bff5ee464aaead58aaf1e48fbb3bdfb4e826f /cogl/cogl-texture-private.h | |
parent | 28e37e9f57275887ae47b83bc87375b91926c534 (diff) | |
download | cogl-6bc3319c86be6b74e7e0701e11e34d4acfb56017.tar.gz |
cogl: Add a texture utility function for manually repeating
Given a region of texture coordinates this utility invokes a callback
enough times to cover the region with a subregion that spans the
texture at most once. Eg, if called with tx1 and tx2 as 0.5 and 3.0 it
it would invoke the callback with:
0.5,1.0 1.0,2.0 2.0,3.0
Manual repeating is needed by all texture backends regardless of
whether they can support hardware repeating because when Cogl calls
the foreach_sub_texture_in_region method then it sets the wrap mode to
GL_CLAMP_TO_EDGE and no hardware repeating is possible.
Diffstat (limited to 'cogl/cogl-texture-private.h')
-rw-r--r-- | cogl/cogl-texture-private.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cogl/cogl-texture-private.h b/cogl/cogl-texture-private.h index d8edb286..9ea5fbfb 100644 --- a/cogl/cogl-texture-private.h +++ b/cogl/cogl-texture-private.h @@ -41,6 +41,9 @@ typedef void (*CoglTextureSliceCallback) (CoglHandle handle, float *virtual_coords, void *user_data); +typedef void (* CoglTextureManualRepeatCallback) (const float *coords, + void *user_data); + struct _CoglTextureVtable { /* Virtual functions that must be implemented for a texture @@ -169,6 +172,17 @@ _cogl_texture_prep_gl_alignment_for_pixels_upload (int pixels_rowstride); void _cogl_texture_prep_gl_alignment_for_pixels_download (int pixels_rowstride); +/* Utility function for implementing manual repeating. Even texture + backends that always support hardware repeating need this because + when foreach_sub_texture_in_region is invoked Cogl will set the + wrap mode to GL_CLAMP_TO_EDGE so hardware repeating can't be + done */ +void +_cogl_texture_iterate_manual_repeats (CoglTextureManualRepeatCallback callback, + float tx_1, float ty_1, + float tx_2, float ty_2, + void *user_data); + /* Utility function to use as a fallback for getting the data of any texture via the framebuffer */ |