summaryrefslogtreecommitdiff
path: root/cogl/cogl-texture.h
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2014-01-14 15:52:45 +0000
committerNeil Roberts <neil@linux.intel.com>2014-01-20 14:40:45 +0000
commiteb7ef457cb281d5ed75863a269da2a94c427bd7b (patch)
tree015044b69d5a42491b78441b92469b8763849807 /cogl/cogl-texture.h
parent06c75ea2e7cdbf9631478620bad469548ace6baa (diff)
downloadcogl-eb7ef457cb281d5ed75863a269da2a94c427bd7b.tar.gz
Add support for RG textures
This adds COGL_PIXEL_FORMAT_RG_88 and COGL_TEXTURE_COMPONENTS_RG in order to support two-component textures. The RG components for a texture is only supported if COGL_FEATURE_ID_TEXTURE_RG is advertised. This is only available on GL 3, GL 2 with the GL_ARB_texture_rg extension or GLES with the GL_EXT_texture_rg extension. The RG pixel format is always supported for images because Cogl can easily do the conversion if an application uses this format to upload to a texture with a different format. If an application tries to create an RG texture when the feature isn't supported then it will raise an error when the texture is allocated. https://bugzilla.gnome.org/show_bug.cgi?id=712830 Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 568677ab3bcb62ababad1623be0d6b9b117d0a26) Conflicts: cogl/cogl-bitmap-packing.h cogl/cogl-types.h cogl/driver/gl/gl/cogl-driver-gl.c tests/conform/test-read-texture-formats.c tests/conform/test-write-texture-formats.c
Diffstat (limited to 'cogl/cogl-texture.h')
-rw-r--r--cogl/cogl-texture.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/cogl/cogl-texture.h b/cogl/cogl-texture.h
index 08fa0857..d4e40c5b 100644
--- a/cogl/cogl-texture.h
+++ b/cogl/cogl-texture.h
@@ -127,6 +127,9 @@ cogl_is_texture (void *object);
/**
* CoglTextureComponents:
* @COGL_TEXTURE_COMPONENTS_A: Only the alpha component
+ * @COGL_TEXTURE_COMPONENTS_RG: Red and green components. Note that
+ * this can only be used if the %COGL_FEATURE_ID_TEXTURE_RG feature
+ * is advertised.
* @COGL_TEXTURE_COMPONENTS_RGB: Red, green and blue components
* @COGL_TEXTURE_COMPONENTS_RGBA: Red, green, blue and alpha components
* @COGL_TEXTURE_COMPONENTS_DEPTH: Only a depth component
@@ -138,6 +141,7 @@ cogl_is_texture (void *object);
typedef enum _CoglTextureComponents
{
COGL_TEXTURE_COMPONENTS_A = 1,
+ COGL_TEXTURE_COMPONENTS_RG,
COGL_TEXTURE_COMPONENTS_RGB,
COGL_TEXTURE_COMPONENTS_RGBA,
COGL_TEXTURE_COMPONENTS_DEPTH
@@ -158,6 +162,15 @@ typedef enum _CoglTextureComponents
* a %CoglBitmap or a data pointer default to the same components as
* the pixel format of the data.
*
+ * Note that the %COGL_TEXTURE_COMPONENTS_RG format is not available
+ * on all drivers. The availability can be determined by checking for
+ * the %COGL_FEATURE_ID_TEXTURE_RG feature. If this format is used on
+ * a driver where it is not available then %COGL_TEXTURE_ERROR_FORMAT
+ * will be raised when the texture is allocated. Even if the feature
+ * is not available then %COGL_PIXEL_FORMAT_RG_88 can still be used as
+ * an image format as long as %COGL_TEXTURE_COMPONENTS_RG isn't used
+ * as the texture's components.
+ *
* Since: 1.18
*/
void