Rename the third texure coordinate from 'r' to 'p'
Using 'r' to name the third component is problematic because that is commonly used to represent the red component of a vector representing a color. Under GLSL this is awkward because the texture swizzling for a vector uses a single letter for each component and the names for colors, textures and positions are synonymous. GLSL works around this by naming the components of the texture s, t, p and q. Cogl already effectively already exposes this naming because it exposes GLSL so it makes sense to use that naming consistently. Another alternative could be u, v and w. This is what Blender and Direct3D use. However the w component conflicts with the w component of a position vertex.
This commit is contained in:
parent
5288f6d88d
commit
ec718d4ca4
@ -234,7 +234,7 @@ static void
|
|||||||
_cogl_atlas_texture_set_wrap_mode_parameters (CoglTexture *tex,
|
_cogl_atlas_texture_set_wrap_mode_parameters (CoglTexture *tex,
|
||||||
GLenum wrap_mode_s,
|
GLenum wrap_mode_s,
|
||||||
GLenum wrap_mode_t,
|
GLenum wrap_mode_t,
|
||||||
GLenum wrap_mode_r)
|
GLenum wrap_mode_p)
|
||||||
{
|
{
|
||||||
CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex);
|
CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex);
|
||||||
|
|
||||||
@ -242,7 +242,7 @@ _cogl_atlas_texture_set_wrap_mode_parameters (CoglTexture *tex,
|
|||||||
_cogl_texture_set_wrap_mode_parameters (atlas_tex->sub_texture,
|
_cogl_texture_set_wrap_mode_parameters (atlas_tex->sub_texture,
|
||||||
wrap_mode_s,
|
wrap_mode_s,
|
||||||
wrap_mode_t,
|
wrap_mode_t,
|
||||||
wrap_mode_r);
|
wrap_mode_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -337,7 +337,7 @@ struct _CoglMaterialLayer
|
|||||||
|
|
||||||
CoglMaterialWrapMode wrap_mode_s;
|
CoglMaterialWrapMode wrap_mode_s;
|
||||||
CoglMaterialWrapMode wrap_mode_t;
|
CoglMaterialWrapMode wrap_mode_t;
|
||||||
CoglMaterialWrapMode wrap_mode_r;
|
CoglMaterialWrapMode wrap_mode_p;
|
||||||
|
|
||||||
/* Infrequent differences aren't currently tracked in
|
/* Infrequent differences aren't currently tracked in
|
||||||
* a separate, dynamically allocated structure as they are
|
* a separate, dynamically allocated structure as they are
|
||||||
@ -756,7 +756,7 @@ typedef struct _CoglMaterialWrapModeOverrides
|
|||||||
{
|
{
|
||||||
CoglMaterialWrapModeOverride s;
|
CoglMaterialWrapModeOverride s;
|
||||||
CoglMaterialWrapModeOverride t;
|
CoglMaterialWrapModeOverride t;
|
||||||
CoglMaterialWrapModeOverride r;
|
CoglMaterialWrapModeOverride p;
|
||||||
} values[COGL_MATERIAL_MAX_LAYERS];
|
} values[COGL_MATERIAL_MAX_LAYERS];
|
||||||
} CoglMaterialWrapModeOverrides;
|
} CoglMaterialWrapModeOverrides;
|
||||||
|
|
||||||
@ -817,12 +817,12 @@ _cogl_material_journal_unref (CoglMaterial *material);
|
|||||||
/* TODO: These should be made public once we add support for 3D
|
/* TODO: These should be made public once we add support for 3D
|
||||||
textures in Cogl */
|
textures in Cogl */
|
||||||
void
|
void
|
||||||
_cogl_material_set_layer_wrap_mode_r (CoglMaterial *material,
|
_cogl_material_set_layer_wrap_mode_p (CoglMaterial *material,
|
||||||
int layer_index,
|
int layer_index,
|
||||||
CoglMaterialWrapMode mode);
|
CoglMaterialWrapMode mode);
|
||||||
|
|
||||||
CoglMaterialWrapMode
|
CoglMaterialWrapMode
|
||||||
_cogl_material_layer_get_wrap_mode_r (CoglMaterialLayer *layer);
|
_cogl_material_layer_get_wrap_mode_p (CoglMaterialLayer *layer);
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_material_set_user_program (CoglMaterial *material,
|
_cogl_material_set_user_program (CoglMaterial *material,
|
||||||
|
@ -1544,7 +1544,7 @@ _cogl_material_layer_initialize_state (CoglMaterialLayer *dest,
|
|||||||
{
|
{
|
||||||
dest->wrap_mode_s = src->wrap_mode_s;
|
dest->wrap_mode_s = src->wrap_mode_s;
|
||||||
dest->wrap_mode_t = src->wrap_mode_t;
|
dest->wrap_mode_t = src->wrap_mode_t;
|
||||||
dest->wrap_mode_r = src->wrap_mode_r;
|
dest->wrap_mode_p = src->wrap_mode_p;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (differences & COGL_MATERIAL_LAYER_STATE_NEEDS_BIG_STATE)
|
if (differences & COGL_MATERIAL_LAYER_STATE_NEEDS_BIG_STATE)
|
||||||
@ -2223,14 +2223,14 @@ _cogl_material_set_layer_wrap_modes (CoglMaterial *material,
|
|||||||
CoglMaterialLayer *authority,
|
CoglMaterialLayer *authority,
|
||||||
CoglMaterialWrapModeInternal wrap_mode_s,
|
CoglMaterialWrapModeInternal wrap_mode_s,
|
||||||
CoglMaterialWrapModeInternal wrap_mode_t,
|
CoglMaterialWrapModeInternal wrap_mode_t,
|
||||||
CoglMaterialWrapModeInternal wrap_mode_r)
|
CoglMaterialWrapModeInternal wrap_mode_p)
|
||||||
{
|
{
|
||||||
CoglMaterialLayer *new;
|
CoglMaterialLayer *new;
|
||||||
CoglMaterialLayerState change = COGL_MATERIAL_LAYER_STATE_WRAP_MODES;
|
CoglMaterialLayerState change = COGL_MATERIAL_LAYER_STATE_WRAP_MODES;
|
||||||
|
|
||||||
if (authority->wrap_mode_s == wrap_mode_s &&
|
if (authority->wrap_mode_s == wrap_mode_s &&
|
||||||
authority->wrap_mode_t == wrap_mode_t &&
|
authority->wrap_mode_t == wrap_mode_t &&
|
||||||
authority->wrap_mode_r == wrap_mode_r)
|
authority->wrap_mode_p == wrap_mode_p)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
new = _cogl_material_layer_pre_change_notify (material, layer, change);
|
new = _cogl_material_layer_pre_change_notify (material, layer, change);
|
||||||
@ -2251,7 +2251,7 @@ _cogl_material_set_layer_wrap_modes (CoglMaterial *material,
|
|||||||
|
|
||||||
if (old_authority->wrap_mode_s == wrap_mode_s &&
|
if (old_authority->wrap_mode_s == wrap_mode_s &&
|
||||||
old_authority->wrap_mode_t == wrap_mode_t &&
|
old_authority->wrap_mode_t == wrap_mode_t &&
|
||||||
old_authority->wrap_mode_r == wrap_mode_r)
|
old_authority->wrap_mode_p == wrap_mode_p)
|
||||||
{
|
{
|
||||||
layer->differences &= ~change;
|
layer->differences &= ~change;
|
||||||
|
|
||||||
@ -2266,7 +2266,7 @@ _cogl_material_set_layer_wrap_modes (CoglMaterial *material,
|
|||||||
|
|
||||||
layer->wrap_mode_s = wrap_mode_s;
|
layer->wrap_mode_s = wrap_mode_s;
|
||||||
layer->wrap_mode_t = wrap_mode_t;
|
layer->wrap_mode_t = wrap_mode_t;
|
||||||
layer->wrap_mode_r = wrap_mode_r;
|
layer->wrap_mode_p = wrap_mode_p;
|
||||||
|
|
||||||
/* If we weren't previously the authority on this state then we need
|
/* If we weren't previously the authority on this state then we need
|
||||||
* to extended our differences mask and so it's possible that some
|
* to extended our differences mask and so it's possible that some
|
||||||
@ -2322,7 +2322,7 @@ cogl_material_set_layer_wrap_mode_s (CoglMaterial *material,
|
|||||||
_cogl_material_set_layer_wrap_modes (material, layer, authority,
|
_cogl_material_set_layer_wrap_modes (material, layer, authority,
|
||||||
internal_mode,
|
internal_mode,
|
||||||
authority->wrap_mode_t,
|
authority->wrap_mode_t,
|
||||||
authority->wrap_mode_r);
|
authority->wrap_mode_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -2353,13 +2353,25 @@ cogl_material_set_layer_wrap_mode_t (CoglMaterial *material,
|
|||||||
_cogl_material_set_layer_wrap_modes (material, layer, authority,
|
_cogl_material_set_layer_wrap_modes (material, layer, authority,
|
||||||
authority->wrap_mode_s,
|
authority->wrap_mode_s,
|
||||||
internal_mode,
|
internal_mode,
|
||||||
authority->wrap_mode_r);
|
authority->wrap_mode_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: this should be made public once we add support for 3D
|
/* TODO: this should be made public once we add support for 3D
|
||||||
textures in Cogl */
|
textures in Cogl */
|
||||||
|
/* The rationale for naming the third texture coordinate 'p' instead
|
||||||
|
of OpenGL's usual 'r' is that 'r' conflicts with the usual naming
|
||||||
|
of the 'red' component when treating a vector as a color. Under
|
||||||
|
GLSL this is awkward because the texture swizzling for a vector
|
||||||
|
uses a single letter for each component and the names for colors,
|
||||||
|
textures and positions are synonymous. GLSL works around this by
|
||||||
|
naming the components of the texture s, t, p and q. Cogl already
|
||||||
|
effectively already exposes this naming because it exposes GLSL so
|
||||||
|
it makes sense to use that naming consistently. Another alternative
|
||||||
|
could be u, v and w. This is what Blender and Direct3D use. However
|
||||||
|
the w component conflicts with the w component of a position
|
||||||
|
vertex. */
|
||||||
void
|
void
|
||||||
_cogl_material_set_layer_wrap_mode_r (CoglMaterial *material,
|
_cogl_material_set_layer_wrap_mode_p (CoglMaterial *material,
|
||||||
int layer_index,
|
int layer_index,
|
||||||
CoglMaterialWrapMode mode)
|
CoglMaterialWrapMode mode)
|
||||||
{
|
{
|
||||||
@ -2493,18 +2505,18 @@ cogl_material_get_layer_wrap_mode_t (CoglMaterial *material, int layer_index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CoglMaterialWrapMode
|
CoglMaterialWrapMode
|
||||||
_cogl_material_layer_get_wrap_mode_r (CoglMaterialLayer *layer)
|
_cogl_material_layer_get_wrap_mode_p (CoglMaterialLayer *layer)
|
||||||
{
|
{
|
||||||
CoglMaterialLayerState change = COGL_MATERIAL_LAYER_STATE_WRAP_MODES;
|
CoglMaterialLayerState change = COGL_MATERIAL_LAYER_STATE_WRAP_MODES;
|
||||||
CoglMaterialLayer *authority =
|
CoglMaterialLayer *authority =
|
||||||
_cogl_material_layer_get_authority (layer, change);
|
_cogl_material_layer_get_authority (layer, change);
|
||||||
|
|
||||||
return internal_to_public_wrap_mode (authority->wrap_mode_r);
|
return internal_to_public_wrap_mode (authority->wrap_mode_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: make this public when we expose 3D textures. */
|
/* TODO: make this public when we expose 3D textures. */
|
||||||
CoglMaterialWrapMode
|
CoglMaterialWrapMode
|
||||||
_cogl_material_get_layer_wrap_mode_r (CoglMaterial *material, int layer_index)
|
_cogl_material_get_layer_wrap_mode_p (CoglMaterial *material, int layer_index)
|
||||||
{
|
{
|
||||||
CoglMaterialLayer *layer;
|
CoglMaterialLayer *layer;
|
||||||
|
|
||||||
@ -2518,14 +2530,14 @@ _cogl_material_get_layer_wrap_mode_r (CoglMaterial *material, int layer_index)
|
|||||||
* material. */
|
* material. */
|
||||||
layer = _cogl_material_get_layer (material, layer_index);
|
layer = _cogl_material_get_layer (material, layer_index);
|
||||||
|
|
||||||
return _cogl_material_layer_get_wrap_mode_r (layer);
|
return _cogl_material_layer_get_wrap_mode_p (layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cogl_material_layer_get_wrap_modes (CoglMaterialLayer *layer,
|
_cogl_material_layer_get_wrap_modes (CoglMaterialLayer *layer,
|
||||||
CoglMaterialWrapModeInternal *wrap_mode_s,
|
CoglMaterialWrapModeInternal *wrap_mode_s,
|
||||||
CoglMaterialWrapModeInternal *wrap_mode_t,
|
CoglMaterialWrapModeInternal *wrap_mode_t,
|
||||||
CoglMaterialWrapModeInternal *wrap_mode_r)
|
CoglMaterialWrapModeInternal *wrap_mode_p)
|
||||||
{
|
{
|
||||||
CoglMaterialLayer *authority =
|
CoglMaterialLayer *authority =
|
||||||
_cogl_material_layer_get_authority (layer,
|
_cogl_material_layer_get_authority (layer,
|
||||||
@ -2533,7 +2545,7 @@ _cogl_material_layer_get_wrap_modes (CoglMaterialLayer *layer,
|
|||||||
|
|
||||||
*wrap_mode_s = authority->wrap_mode_s;
|
*wrap_mode_s = authority->wrap_mode_s;
|
||||||
*wrap_mode_t = authority->wrap_mode_t;
|
*wrap_mode_t = authority->wrap_mode_t;
|
||||||
*wrap_mode_r = authority->wrap_mode_r;
|
*wrap_mode_p = authority->wrap_mode_p;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@ -2673,7 +2685,7 @@ apply_wrap_mode_overrides_cb (CoglMaterialLayer *layer,
|
|||||||
COGL_MATERIAL_LAYER_STATE_WRAP_MODES);
|
COGL_MATERIAL_LAYER_STATE_WRAP_MODES);
|
||||||
CoglMaterialWrapModeInternal wrap_mode_s;
|
CoglMaterialWrapModeInternal wrap_mode_s;
|
||||||
CoglMaterialWrapModeInternal wrap_mode_t;
|
CoglMaterialWrapModeInternal wrap_mode_t;
|
||||||
CoglMaterialWrapModeInternal wrap_mode_r;
|
CoglMaterialWrapModeInternal wrap_mode_p;
|
||||||
|
|
||||||
g_return_val_if_fail (state->i < 32, FALSE);
|
g_return_val_if_fail (state->i < 32, FALSE);
|
||||||
|
|
||||||
@ -2683,16 +2695,16 @@ apply_wrap_mode_overrides_cb (CoglMaterialLayer *layer,
|
|||||||
wrap_mode_t = state->wrap_mode_overrides->values[state->i].t;
|
wrap_mode_t = state->wrap_mode_overrides->values[state->i].t;
|
||||||
if (wrap_mode_t == COGL_MATERIAL_WRAP_MODE_OVERRIDE_NONE)
|
if (wrap_mode_t == COGL_MATERIAL_WRAP_MODE_OVERRIDE_NONE)
|
||||||
wrap_mode_t = (CoglMaterialWrapModeInternal)authority->wrap_mode_t;
|
wrap_mode_t = (CoglMaterialWrapModeInternal)authority->wrap_mode_t;
|
||||||
wrap_mode_r = state->wrap_mode_overrides->values[state->i].r;
|
wrap_mode_p = state->wrap_mode_overrides->values[state->i].p;
|
||||||
if (wrap_mode_r == COGL_MATERIAL_WRAP_MODE_OVERRIDE_NONE)
|
if (wrap_mode_p == COGL_MATERIAL_WRAP_MODE_OVERRIDE_NONE)
|
||||||
wrap_mode_r = (CoglMaterialWrapModeInternal)authority->wrap_mode_r;
|
wrap_mode_p = (CoglMaterialWrapModeInternal)authority->wrap_mode_p;
|
||||||
|
|
||||||
_cogl_material_set_layer_wrap_modes (state->material,
|
_cogl_material_set_layer_wrap_modes (state->material,
|
||||||
layer,
|
layer,
|
||||||
authority,
|
authority,
|
||||||
wrap_mode_s,
|
wrap_mode_s,
|
||||||
wrap_mode_t,
|
wrap_mode_t,
|
||||||
wrap_mode_r);
|
wrap_mode_p);
|
||||||
|
|
||||||
state->i++;
|
state->i++;
|
||||||
|
|
||||||
@ -2973,7 +2985,7 @@ _cogl_material_layer_wrap_modes_equal (CoglMaterialLayer *authority0,
|
|||||||
{
|
{
|
||||||
if (authority0->wrap_mode_s != authority1->wrap_mode_s ||
|
if (authority0->wrap_mode_s != authority1->wrap_mode_s ||
|
||||||
authority0->wrap_mode_t != authority1->wrap_mode_t ||
|
authority0->wrap_mode_t != authority1->wrap_mode_t ||
|
||||||
authority0->wrap_mode_r != authority1->wrap_mode_r)
|
authority0->wrap_mode_p != authority1->wrap_mode_p)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -4515,7 +4527,7 @@ _cogl_material_init_default_layers (void)
|
|||||||
|
|
||||||
layer->wrap_mode_s = COGL_MATERIAL_WRAP_MODE_AUTOMATIC;
|
layer->wrap_mode_s = COGL_MATERIAL_WRAP_MODE_AUTOMATIC;
|
||||||
layer->wrap_mode_t = COGL_MATERIAL_WRAP_MODE_AUTOMATIC;
|
layer->wrap_mode_t = COGL_MATERIAL_WRAP_MODE_AUTOMATIC;
|
||||||
layer->wrap_mode_r = COGL_MATERIAL_WRAP_MODE_AUTOMATIC;
|
layer->wrap_mode_p = COGL_MATERIAL_WRAP_MODE_AUTOMATIC;
|
||||||
|
|
||||||
layer->big_state = big_state;
|
layer->big_state = big_state;
|
||||||
layer->has_big_state = TRUE;
|
layer->has_big_state = TRUE;
|
||||||
@ -5828,8 +5840,8 @@ static void
|
|||||||
_cogl_material_layer_forward_wrap_modes (CoglMaterialLayer *layer,
|
_cogl_material_layer_forward_wrap_modes (CoglMaterialLayer *layer,
|
||||||
CoglHandle texture)
|
CoglHandle texture)
|
||||||
{
|
{
|
||||||
CoglMaterialWrapModeInternal wrap_mode_s, wrap_mode_t, wrap_mode_r;
|
CoglMaterialWrapModeInternal wrap_mode_s, wrap_mode_t, wrap_mode_p;
|
||||||
GLenum gl_wrap_mode_s, gl_wrap_mode_t, gl_wrap_mode_r;
|
GLenum gl_wrap_mode_s, gl_wrap_mode_t, gl_wrap_mode_p;
|
||||||
|
|
||||||
if (texture == COGL_INVALID_HANDLE)
|
if (texture == COGL_INVALID_HANDLE)
|
||||||
return;
|
return;
|
||||||
@ -5837,7 +5849,7 @@ _cogl_material_layer_forward_wrap_modes (CoglMaterialLayer *layer,
|
|||||||
_cogl_material_layer_get_wrap_modes (layer,
|
_cogl_material_layer_get_wrap_modes (layer,
|
||||||
&wrap_mode_s,
|
&wrap_mode_s,
|
||||||
&wrap_mode_t,
|
&wrap_mode_t,
|
||||||
&wrap_mode_r);
|
&wrap_mode_p);
|
||||||
|
|
||||||
/* Update the wrap mode on the texture object. The texture backend
|
/* Update the wrap mode on the texture object. The texture backend
|
||||||
should cache the value so that it will be a no-op if the object
|
should cache the value so that it will be a no-op if the object
|
||||||
@ -5860,15 +5872,15 @@ _cogl_material_layer_forward_wrap_modes (CoglMaterialLayer *layer,
|
|||||||
else
|
else
|
||||||
gl_wrap_mode_t = wrap_mode_t;
|
gl_wrap_mode_t = wrap_mode_t;
|
||||||
|
|
||||||
if (wrap_mode_r == COGL_MATERIAL_WRAP_MODE_INTERNAL_AUTOMATIC)
|
if (wrap_mode_p == COGL_MATERIAL_WRAP_MODE_INTERNAL_AUTOMATIC)
|
||||||
gl_wrap_mode_r = GL_CLAMP_TO_EDGE;
|
gl_wrap_mode_p = GL_CLAMP_TO_EDGE;
|
||||||
else
|
else
|
||||||
gl_wrap_mode_r = wrap_mode_r;
|
gl_wrap_mode_p = wrap_mode_p;
|
||||||
|
|
||||||
_cogl_texture_set_wrap_mode_parameters (texture,
|
_cogl_texture_set_wrap_mode_parameters (texture,
|
||||||
gl_wrap_mode_s,
|
gl_wrap_mode_s,
|
||||||
gl_wrap_mode_t,
|
gl_wrap_mode_t,
|
||||||
gl_wrap_mode_r);
|
gl_wrap_mode_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* OpenGL associates the min/mag filters and repeat modes with the
|
/* OpenGL associates the min/mag filters and repeat modes with the
|
||||||
|
@ -227,14 +227,14 @@ static void
|
|||||||
_cogl_sub_texture_set_wrap_mode_parameters (CoglTexture *tex,
|
_cogl_sub_texture_set_wrap_mode_parameters (CoglTexture *tex,
|
||||||
GLenum wrap_mode_s,
|
GLenum wrap_mode_s,
|
||||||
GLenum wrap_mode_t,
|
GLenum wrap_mode_t,
|
||||||
GLenum wrap_mode_r)
|
GLenum wrap_mode_p)
|
||||||
{
|
{
|
||||||
CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex);
|
CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex);
|
||||||
|
|
||||||
_cogl_texture_set_wrap_mode_parameters (sub_tex->full_texture,
|
_cogl_texture_set_wrap_mode_parameters (sub_tex->full_texture,
|
||||||
wrap_mode_s,
|
wrap_mode_s,
|
||||||
wrap_mode_t,
|
wrap_mode_t,
|
||||||
wrap_mode_r);
|
wrap_mode_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -667,7 +667,7 @@ static void
|
|||||||
_cogl_texture_2d_sliced_set_wrap_mode_parameters (CoglTexture *tex,
|
_cogl_texture_2d_sliced_set_wrap_mode_parameters (CoglTexture *tex,
|
||||||
GLenum wrap_mode_s,
|
GLenum wrap_mode_s,
|
||||||
GLenum wrap_mode_t,
|
GLenum wrap_mode_t,
|
||||||
GLenum wrap_mode_r)
|
GLenum wrap_mode_p)
|
||||||
{
|
{
|
||||||
CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex);
|
CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex);
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ static void
|
|||||||
_cogl_texture_2d_set_wrap_mode_parameters (CoglTexture *tex,
|
_cogl_texture_2d_set_wrap_mode_parameters (CoglTexture *tex,
|
||||||
GLenum wrap_mode_s,
|
GLenum wrap_mode_s,
|
||||||
GLenum wrap_mode_t,
|
GLenum wrap_mode_t,
|
||||||
GLenum wrap_mode_r)
|
GLenum wrap_mode_p)
|
||||||
{
|
{
|
||||||
CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex);
|
CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex);
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ struct _CoglTexture3D
|
|||||||
GLenum mag_filter;
|
GLenum mag_filter;
|
||||||
GLint wrap_mode_s;
|
GLint wrap_mode_s;
|
||||||
GLint wrap_mode_t;
|
GLint wrap_mode_t;
|
||||||
GLint wrap_mode_r;
|
GLint wrap_mode_p;
|
||||||
gboolean auto_mipmap;
|
gboolean auto_mipmap;
|
||||||
gboolean mipmaps_dirty;
|
gboolean mipmaps_dirty;
|
||||||
};
|
};
|
||||||
|
@ -137,7 +137,7 @@ static void
|
|||||||
_cogl_texture_3d_set_wrap_mode_parameters (CoglTexture *tex,
|
_cogl_texture_3d_set_wrap_mode_parameters (CoglTexture *tex,
|
||||||
GLenum wrap_mode_s,
|
GLenum wrap_mode_s,
|
||||||
GLenum wrap_mode_t,
|
GLenum wrap_mode_t,
|
||||||
GLenum wrap_mode_r)
|
GLenum wrap_mode_p)
|
||||||
{
|
{
|
||||||
CoglTexture3D *tex_3d = COGL_TEXTURE_3D (tex);
|
CoglTexture3D *tex_3d = COGL_TEXTURE_3D (tex);
|
||||||
|
|
||||||
@ -145,18 +145,18 @@ _cogl_texture_3d_set_wrap_mode_parameters (CoglTexture *tex,
|
|||||||
to avoid too many GL calls. */
|
to avoid too many GL calls. */
|
||||||
if (tex_3d->wrap_mode_s != wrap_mode_s ||
|
if (tex_3d->wrap_mode_s != wrap_mode_s ||
|
||||||
tex_3d->wrap_mode_t != wrap_mode_t ||
|
tex_3d->wrap_mode_t != wrap_mode_t ||
|
||||||
tex_3d->wrap_mode_r != wrap_mode_r)
|
tex_3d->wrap_mode_p != wrap_mode_p)
|
||||||
{
|
{
|
||||||
_cogl_bind_gl_texture_transient (GL_TEXTURE_3D,
|
_cogl_bind_gl_texture_transient (GL_TEXTURE_3D,
|
||||||
tex_3d->gl_texture,
|
tex_3d->gl_texture,
|
||||||
FALSE);
|
FALSE);
|
||||||
GE( glTexParameteri (GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, wrap_mode_s) );
|
GE( glTexParameteri (GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, wrap_mode_s) );
|
||||||
GE( glTexParameteri (GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, wrap_mode_t) );
|
GE( glTexParameteri (GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, wrap_mode_t) );
|
||||||
GE( glTexParameteri (GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, wrap_mode_r) );
|
GE( glTexParameteri (GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, wrap_mode_p) );
|
||||||
|
|
||||||
tex_3d->wrap_mode_s = wrap_mode_s;
|
tex_3d->wrap_mode_s = wrap_mode_s;
|
||||||
tex_3d->wrap_mode_t = wrap_mode_t;
|
tex_3d->wrap_mode_t = wrap_mode_t;
|
||||||
tex_3d->wrap_mode_r = wrap_mode_r;
|
tex_3d->wrap_mode_p = wrap_mode_p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ _cogl_texture_3d_create_base (unsigned int width,
|
|||||||
/* Wrap mode not yet set */
|
/* Wrap mode not yet set */
|
||||||
tex_3d->wrap_mode_s = GL_FALSE;
|
tex_3d->wrap_mode_s = GL_FALSE;
|
||||||
tex_3d->wrap_mode_t = GL_FALSE;
|
tex_3d->wrap_mode_t = GL_FALSE;
|
||||||
tex_3d->wrap_mode_r = GL_FALSE;
|
tex_3d->wrap_mode_p = GL_FALSE;
|
||||||
|
|
||||||
tex_3d->format = internal_format;
|
tex_3d->format = internal_format;
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ struct _CoglTextureVtable
|
|||||||
void (* set_wrap_mode_parameters) (CoglTexture *tex,
|
void (* set_wrap_mode_parameters) (CoglTexture *tex,
|
||||||
GLenum wrap_mode_s,
|
GLenum wrap_mode_s,
|
||||||
GLenum wrap_mode_t,
|
GLenum wrap_mode_t,
|
||||||
GLenum wrap_mode_r);
|
GLenum wrap_mode_p);
|
||||||
|
|
||||||
CoglPixelFormat (* get_format) (CoglTexture *tex);
|
CoglPixelFormat (* get_format) (CoglTexture *tex);
|
||||||
GLenum (* get_gl_format) (CoglTexture *tex);
|
GLenum (* get_gl_format) (CoglTexture *tex);
|
||||||
@ -198,7 +198,7 @@ void
|
|||||||
_cogl_texture_set_wrap_mode_parameters (CoglHandle handle,
|
_cogl_texture_set_wrap_mode_parameters (CoglHandle handle,
|
||||||
GLenum wrap_mode_s,
|
GLenum wrap_mode_s,
|
||||||
GLenum wrap_mode_t,
|
GLenum wrap_mode_t,
|
||||||
GLenum wrap_mode_r);
|
GLenum wrap_mode_p);
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -151,7 +151,7 @@ static void
|
|||||||
_cogl_texture_rectangle_set_wrap_mode_parameters (CoglTexture *tex,
|
_cogl_texture_rectangle_set_wrap_mode_parameters (CoglTexture *tex,
|
||||||
GLenum wrap_mode_s,
|
GLenum wrap_mode_s,
|
||||||
GLenum wrap_mode_t,
|
GLenum wrap_mode_t,
|
||||||
GLenum wrap_mode_r)
|
GLenum wrap_mode_p)
|
||||||
{
|
{
|
||||||
CoglTextureRectangle *tex_rect = COGL_TEXTURE_RECTANGLE (tex);
|
CoglTextureRectangle *tex_rect = COGL_TEXTURE_RECTANGLE (tex);
|
||||||
|
|
||||||
|
@ -267,14 +267,14 @@ void
|
|||||||
_cogl_texture_set_wrap_mode_parameters (CoglHandle handle,
|
_cogl_texture_set_wrap_mode_parameters (CoglHandle handle,
|
||||||
GLenum wrap_mode_s,
|
GLenum wrap_mode_s,
|
||||||
GLenum wrap_mode_t,
|
GLenum wrap_mode_t,
|
||||||
GLenum wrap_mode_r)
|
GLenum wrap_mode_p)
|
||||||
{
|
{
|
||||||
CoglTexture *tex = COGL_TEXTURE (handle);
|
CoglTexture *tex = COGL_TEXTURE (handle);
|
||||||
|
|
||||||
tex->vtable->set_wrap_mode_parameters (tex,
|
tex->vtable->set_wrap_mode_parameters (tex,
|
||||||
wrap_mode_s,
|
wrap_mode_s,
|
||||||
wrap_mode_t,
|
wrap_mode_t,
|
||||||
wrap_mode_r);
|
wrap_mode_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is like CoglSpanIter except it deals with floats and it
|
/* This is like CoglSpanIter except it deals with floats and it
|
||||||
|
@ -1682,10 +1682,10 @@ enable_state_for_drawing_buffer (CoglVertexBuffer *buffer)
|
|||||||
COGL_MATERIAL_WRAP_MODE_OVERRIDE_REPEAT;
|
COGL_MATERIAL_WRAP_MODE_OVERRIDE_REPEAT;
|
||||||
options.flags |= COGL_MATERIAL_FLUSH_WRAP_MODE_OVERRIDES;
|
options.flags |= COGL_MATERIAL_FLUSH_WRAP_MODE_OVERRIDES;
|
||||||
}
|
}
|
||||||
if (_cogl_material_layer_get_wrap_mode_r (layer) ==
|
if (_cogl_material_layer_get_wrap_mode_p (layer) ==
|
||||||
COGL_MATERIAL_WRAP_MODE_AUTOMATIC)
|
COGL_MATERIAL_WRAP_MODE_AUTOMATIC)
|
||||||
{
|
{
|
||||||
options.wrap_mode_overrides.values[i].r =
|
options.wrap_mode_overrides.values[i].p =
|
||||||
COGL_MATERIAL_WRAP_MODE_OVERRIDE_REPEAT;
|
COGL_MATERIAL_WRAP_MODE_OVERRIDE_REPEAT;
|
||||||
options.flags |= COGL_MATERIAL_FLUSH_WRAP_MODE_OVERRIDES;
|
options.flags |= COGL_MATERIAL_FLUSH_WRAP_MODE_OVERRIDES;
|
||||||
}
|
}
|
||||||
|
@ -1286,7 +1286,7 @@ static void
|
|||||||
_cogl_texture_pixmap_x11_set_wrap_mode_parameters (CoglTexture *tex,
|
_cogl_texture_pixmap_x11_set_wrap_mode_parameters (CoglTexture *tex,
|
||||||
GLenum wrap_mode_s,
|
GLenum wrap_mode_s,
|
||||||
GLenum wrap_mode_t,
|
GLenum wrap_mode_t,
|
||||||
GLenum wrap_mode_r)
|
GLenum wrap_mode_p)
|
||||||
{
|
{
|
||||||
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
||||||
CoglHandle child_tex;
|
CoglHandle child_tex;
|
||||||
@ -1297,7 +1297,7 @@ _cogl_texture_pixmap_x11_set_wrap_mode_parameters (CoglTexture *tex,
|
|||||||
_cogl_texture_set_wrap_mode_parameters (child_tex,
|
_cogl_texture_set_wrap_mode_parameters (child_tex,
|
||||||
wrap_mode_s,
|
wrap_mode_s,
|
||||||
wrap_mode_t,
|
wrap_mode_t,
|
||||||
wrap_mode_r);
|
wrap_mode_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static CoglPixelFormat
|
static CoglPixelFormat
|
||||||
|
Loading…
Reference in New Issue
Block a user