}
static void
-_cogl_atlas_texture_set_wrap_mode_parameter (CoglTexture *tex,
- GLenum wrap_mode)
+_cogl_atlas_texture_set_wrap_mode_parameters (CoglTexture *tex,
+ GLenum wrap_mode_s,
+ GLenum wrap_mode_t,
+ GLenum wrap_mode_r)
{
CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex);
/* Forward on to the sub texture */
- _cogl_texture_set_wrap_mode_parameter (atlas_tex->sub_texture, wrap_mode);
+ _cogl_texture_set_wrap_mode_parameters (atlas_tex->sub_texture,
+ wrap_mode_s,
+ wrap_mode_t,
+ wrap_mode_r);
}
static void
_cogl_atlas_texture_set_filters,
_cogl_atlas_texture_ensure_mipmaps,
_cogl_atlas_texture_ensure_non_quad_rendering,
- _cogl_atlas_texture_set_wrap_mode_parameter,
+ _cogl_atlas_texture_set_wrap_mode_parameters,
_cogl_atlas_texture_get_format,
_cogl_atlas_texture_get_gl_format,
_cogl_atlas_texture_get_width,
/* We can't use hardware repeat so we need to set clamp to edge
otherwise it might pull in edge pixels from the other side */
/* FIXME: wrap modes should be part of the material! */
- _cogl_texture_set_wrap_mode_parameter (tex_handle, GL_CLAMP_TO_EDGE);
+ _cogl_texture_set_wrap_mode_parameters (tex_handle,
+ GL_CLAMP_TO_EDGE,
+ GL_CLAMP_TO_EDGE,
+ GL_CLAMP_TO_EDGE);
state.material = material;
else
wrap_mode = GL_CLAMP_TO_EDGE;
- _cogl_texture_set_wrap_mode_parameter (tex_handle, wrap_mode);
+ _cogl_texture_set_wrap_mode_parameters (tex_handle,
+ wrap_mode,
+ wrap_mode,
+ wrap_mode);
}
_cogl_journal_log_quad (position,
* a transparent border
* XXX: it's doesn't look like we save/restore this, like
* the comment implies? */
- _cogl_texture_set_wrap_mode_parameter (tex_handle,
- GL_CLAMP_TO_BORDER);
+ _cogl_texture_set_wrap_mode_parameters (tex_handle,
+ GL_CLAMP_TO_BORDER,
+ GL_CLAMP_TO_BORDER,
+ GL_CLAMP_TO_BORDER);
}
#endif
break;
}
static void
-_cogl_sub_texture_set_wrap_mode_parameter (CoglTexture *tex,
- GLenum wrap_mode)
+_cogl_sub_texture_set_wrap_mode_parameters (CoglTexture *tex,
+ GLenum wrap_mode_s,
+ GLenum wrap_mode_t,
+ GLenum wrap_mode_r)
{
CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex);
- _cogl_texture_set_wrap_mode_parameter (sub_tex->full_texture, wrap_mode);
+ _cogl_texture_set_wrap_mode_parameters (sub_tex->full_texture,
+ wrap_mode_s,
+ wrap_mode_t,
+ wrap_mode_r);
}
static void
_cogl_sub_texture_set_filters,
_cogl_sub_texture_ensure_mipmaps,
_cogl_sub_texture_ensure_non_quad_rendering,
- _cogl_sub_texture_set_wrap_mode_parameter,
+ _cogl_sub_texture_set_wrap_mode_parameters,
_cogl_sub_texture_get_format,
_cogl_sub_texture_get_gl_format,
_cogl_sub_texture_get_width,
int height;
GLenum min_filter;
GLenum mag_filter;
- GLint wrap_mode;
+ GLint wrap_mode_s;
+ GLint wrap_mode_t;
gboolean auto_mipmap;
gboolean mipmaps_dirty;
};
GLenum min_filter;
GLenum mag_filter;
gboolean is_foreign;
- GLint wrap_mode;
+ GLenum wrap_mode_s;
+ GLenum wrap_mode_t;
gboolean auto_mipmap;
gboolean mipmaps_dirty;
}
static void
-_cogl_texture_2d_sliced_set_wrap_mode_parameter (CoglTexture *tex,
- GLenum wrap_mode)
+_cogl_texture_2d_sliced_set_wrap_mode_parameters (CoglTexture *tex,
+ GLenum wrap_mode_s,
+ GLenum wrap_mode_t,
+ GLenum wrap_mode_r)
{
CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex);
- /* Only set the wrap mode if it's different from the current
- value to avoid too many GL calls */
- if (tex_2ds->wrap_mode != wrap_mode)
+ /* Only set the wrap mode if it's different from the current value
+ to avoid too many GL calls. Texture 2D doesn't make use of the r
+ coordinate so we can ignore its wrap mode */
+ if (tex_2ds->wrap_mode_s != wrap_mode_s ||
+ tex_2ds->wrap_mode_t != wrap_mode_t)
{
int i;
GLuint texnum = g_array_index (tex_2ds->slice_gl_handles, GLuint, i);
GE( glBindTexture (tex_2ds->gl_target, texnum) );
- GE( glTexParameteri (tex_2ds->gl_target, GL_TEXTURE_WRAP_S, wrap_mode) );
- GE( glTexParameteri (tex_2ds->gl_target, GL_TEXTURE_WRAP_T, wrap_mode) );
+ GE( glTexParameteri (tex_2ds->gl_target,
+ GL_TEXTURE_WRAP_S, wrap_mode_s) );
+ GE( glTexParameteri (tex_2ds->gl_target,
+ GL_TEXTURE_WRAP_T, wrap_mode_t) );
}
- tex_2ds->wrap_mode = wrap_mode;
+ tex_2ds->wrap_mode_s = wrap_mode_s;
+ tex_2ds->wrap_mode_t = wrap_mode_t;
}
}
tex_2ds->first_pixels = g_new (CoglTexturePixel, n_slices);
/* Wrap mode not yet set */
- tex_2ds->wrap_mode = GL_FALSE;
+ tex_2ds->wrap_mode_s = GL_FALSE;
+ tex_2ds->wrap_mode_t = GL_FALSE;
/* Generate a "working set" of GL texture objects
* (some implementations might supported faster
tex_2ds->max_waste = 0;
/* Wrap mode not yet set */
- tex_2ds->wrap_mode = GL_FALSE;
+ tex_2ds->wrap_mode_s = GL_FALSE;
+ tex_2ds->wrap_mode_t = GL_FALSE;
/* Create slice arrays */
tex_2ds->slice_x_spans =
_cogl_texture_2d_sliced_set_filters,
_cogl_texture_2d_sliced_ensure_mipmaps,
_cogl_texture_2d_sliced_ensure_non_quad_rendering,
- _cogl_texture_2d_sliced_set_wrap_mode_parameter,
+ _cogl_texture_2d_sliced_set_wrap_mode_parameters,
_cogl_texture_2d_sliced_get_format,
_cogl_texture_2d_sliced_get_gl_format,
_cogl_texture_2d_sliced_get_width,
}
static void
-_cogl_texture_2d_set_wrap_mode_parameter (CoglTexture *tex,
- GLenum wrap_mode)
+_cogl_texture_2d_set_wrap_mode_parameters (CoglTexture *tex,
+ GLenum wrap_mode_s,
+ GLenum wrap_mode_t,
+ GLenum wrap_mode_r)
{
CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex);
- /* Only set the wrap mode if it's different from the current
- value to avoid too many GL calls */
- if (tex_2d->wrap_mode != wrap_mode)
+ /* Only set the wrap mode if it's different from the current value
+ to avoid too many GL calls. Texture 2D doesn't make use of the r
+ coordinate so we can ignore its wrap mode */
+ if (tex_2d->wrap_mode_s != wrap_mode_s ||
+ tex_2d->wrap_mode_t != wrap_mode_t)
{
/* Any queued texture rectangles may be depending on the
* previous wrap mode... */
_cogl_journal_flush ();
GE( glBindTexture (GL_TEXTURE_2D, tex_2d->gl_texture) );
- GE( glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap_mode) );
- GE( glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap_mode) );
+ GE( glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap_mode_s) );
+ GE( glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap_mode_t) );
- tex_2d->wrap_mode = wrap_mode;
+ tex_2d->wrap_mode_s = wrap_mode_s;
+ tex_2d->wrap_mode_t = wrap_mode_t;
}
}
tex_2d->mag_filter = GL_LINEAR;
/* Wrap mode not yet set */
- tex_2d->wrap_mode = GL_FALSE;
+ tex_2d->wrap_mode_s = GL_FALSE;
+ tex_2d->wrap_mode_t = GL_FALSE;
tex_2d->format = internal_format;
_cogl_texture_2d_set_filters,
_cogl_texture_2d_ensure_mipmaps,
_cogl_texture_2d_ensure_non_quad_rendering,
- _cogl_texture_2d_set_wrap_mode_parameter,
+ _cogl_texture_2d_set_wrap_mode_parameters,
_cogl_texture_2d_get_format,
_cogl_texture_2d_get_gl_format,
_cogl_texture_2d_get_width,
void (* ensure_mipmaps) (CoglTexture *tex);
void (* ensure_non_quad_rendering) (CoglTexture *tex);
- void (* set_wrap_mode_parameter) (CoglTexture *tex,
- GLenum wrap_mode);
+ void (* set_wrap_mode_parameters) (CoglTexture *tex,
+ GLenum wrap_mode_s,
+ GLenum wrap_mode_t,
+ GLenum wrap_mode_r);
CoglPixelFormat (* get_format) (CoglTexture *tex);
GLenum (* get_gl_format) (CoglTexture *tex);
_cogl_texture_get_gl_format (CoglHandle handle);
void
-_cogl_texture_set_wrap_mode_parameter (CoglHandle handle,
- GLenum wrap_mode);
+_cogl_texture_set_wrap_mode_parameters (CoglHandle handle,
+ GLenum wrap_mode_s,
+ GLenum wrap_mode_t,
+ GLenum wrap_mode_r);
+
void
_cogl_texture_set_filters (CoglHandle handle,
/* FIXME: wrap modes should be set on materials not textures */
void
-_cogl_texture_set_wrap_mode_parameter (CoglHandle handle,
- GLenum wrap_mode)
+_cogl_texture_set_wrap_mode_parameters (CoglHandle handle,
+ GLenum wrap_mode_s,
+ GLenum wrap_mode_t,
+ GLenum wrap_mode_r)
{
CoglTexture *tex = COGL_TEXTURE (handle);
- tex->vtable->set_wrap_mode_parameter (tex, wrap_mode);
+ tex->vtable->set_wrap_mode_parameters (tex,
+ wrap_mode_s,
+ wrap_mode_t,
+ wrap_mode_r);
}
/* This is like CoglSpanIter except it deals with floats and it