mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 08:30:42 -05:00
* clutter/cogl/gles/cogl-texture.c: Use the wrapper for
glTexParameteri. Call glGenerateMipmap after every change to the texture image data. * clutter/cogl/gles/cogl-gles2-wrapper.h: * clutter/cogl/gles/cogl-gles2-wrapper.c: Added a wrapper for glTexParameteri so that it can ignore requests to set GL_GENERATE_MIPMAP. Added a wrapper for glGenerateMipmap that does nothing on GLES 1
This commit is contained in:
parent
cb279f999a
commit
29f7cbdfb7
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
|||||||
|
2008-05-28 Neil Roberts <neil@o-hand.com>
|
||||||
|
|
||||||
|
* clutter/cogl/gles/cogl-texture.c: Use the wrapper for
|
||||||
|
glTexParameteri. Call glGenerateMipmap after every change to the
|
||||||
|
texture image data.
|
||||||
|
|
||||||
|
* clutter/cogl/gles/cogl-gles2-wrapper.h:
|
||||||
|
* clutter/cogl/gles/cogl-gles2-wrapper.c: Added a wrapper for
|
||||||
|
glTexParameteri so that it can ignore requests to set
|
||||||
|
GL_GENERATE_MIPMAP. Added a wrapper for glGenerateMipmap that does
|
||||||
|
nothing on GLES 1
|
||||||
|
|
||||||
2008-05-28 Emmanuele Bassi <ebassi@openedhand.com>
|
2008-05-28 Emmanuele Bassi <ebassi@openedhand.com>
|
||||||
|
|
||||||
* clutter/clutter-script.c:
|
* clutter/clutter-script.c:
|
||||||
|
@ -630,3 +630,10 @@ cogl_wrap_glFogxv (GLenum pname, const GLfixed *params)
|
|||||||
{
|
{
|
||||||
/* FIXME */
|
/* FIXME */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cogl_wrap_glTexParameteri (GLenum target, GLenum pname, GLfloat param)
|
||||||
|
{
|
||||||
|
if (pname != GL_GENERATE_MIPMAP)
|
||||||
|
glTexParameteri (target, pname, param);
|
||||||
|
}
|
||||||
|
@ -148,9 +148,14 @@ void cogl_wrap_glFogxv (GLenum pname, const GLfixed *params);
|
|||||||
|
|
||||||
void cogl_wrap_glDrawArrays (GLenum mode, GLint first, GLsizei count);
|
void cogl_wrap_glDrawArrays (GLenum mode, GLint first, GLsizei count);
|
||||||
|
|
||||||
|
void cogl_wrap_glTexParameteri (GLenum target, GLenum pname, GLfloat param);
|
||||||
|
|
||||||
void cogl_gles2_wrapper_bind_texture (GLenum target, GLuint texture,
|
void cogl_gles2_wrapper_bind_texture (GLenum target, GLuint texture,
|
||||||
GLenum internal_format);
|
GLenum internal_format);
|
||||||
|
|
||||||
|
/* This function is only available on GLES 2 */
|
||||||
|
#define cogl_wrap_glGenerateMipmap glGenerateMipmap
|
||||||
|
|
||||||
#else /* HAVE_COGL_GLES2 */
|
#else /* HAVE_COGL_GLES2 */
|
||||||
|
|
||||||
/* If we're not using GL ES 2 then just use the GL functions
|
/* If we're not using GL ES 2 then just use the GL functions
|
||||||
@ -181,12 +186,17 @@ void cogl_gles2_wrapper_bind_texture (GLenum target, GLuint texture,
|
|||||||
#define cogl_wrap_glGetFixedv glGetFixedv
|
#define cogl_wrap_glGetFixedv glGetFixedv
|
||||||
#define cogl_wrap_glFogx glFogx
|
#define cogl_wrap_glFogx glFogx
|
||||||
#define cogl_wrap_glFogxv glFogxv
|
#define cogl_wrap_glFogxv glFogxv
|
||||||
|
#define cogl_wrap_glTexParameteri glTexParameteri
|
||||||
|
|
||||||
/* The extra third parameter of the bind texture wrapper isn't needed
|
/* The extra third parameter of the bind texture wrapper isn't needed
|
||||||
so we can just directly call glBindTexture */
|
so we can just directly call glBindTexture */
|
||||||
#define cogl_gles2_wrapper_bind_texture(target, texture, internal_format) \
|
#define cogl_gles2_wrapper_bind_texture(target, texture, internal_format) \
|
||||||
glBindTexture ((target), (texture))
|
glBindTexture ((target), (texture))
|
||||||
|
|
||||||
|
/* COGL uses the automatic mipmap generation for GLES 1 so
|
||||||
|
glGenerateMipmap doesn't need to do anything */
|
||||||
|
#define cogl_wrap_glGenerateMipmap(x) ((void) 0)
|
||||||
|
|
||||||
#endif /* HAVE_COGL_GLES2 */
|
#endif /* HAVE_COGL_GLES2 */
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@ -232,6 +232,9 @@ _cogl_texture_upload_to_gl (CoglTexture *tex)
|
|||||||
slice_bmp.height,
|
slice_bmp.height,
|
||||||
tex->gl_format, tex->gl_type,
|
tex->gl_format, tex->gl_type,
|
||||||
slice_bmp.data) );
|
slice_bmp.data) );
|
||||||
|
|
||||||
|
if (tex->auto_mipmap)
|
||||||
|
cogl_wrap_glGenerateMipmap (tex->gl_target);
|
||||||
|
|
||||||
/* Free temp bitmap */
|
/* Free temp bitmap */
|
||||||
g_free (slice_bmp.data);
|
g_free (slice_bmp.data);
|
||||||
@ -603,6 +606,9 @@ _cogl_texture_upload_subregion_to_gl (CoglTexture *tex,
|
|||||||
source_gl_type,
|
source_gl_type,
|
||||||
slice_bmp.data) );
|
slice_bmp.data) );
|
||||||
|
|
||||||
|
if (tex->auto_mipmap)
|
||||||
|
cogl_wrap_glGenerateMipmap (tex->gl_target);
|
||||||
|
|
||||||
/* Free temp bitmap */
|
/* Free temp bitmap */
|
||||||
g_free (slice_bmp.data);
|
g_free (slice_bmp.data);
|
||||||
}
|
}
|
||||||
@ -816,13 +822,18 @@ _cogl_texture_slices_create (CoglTexture *tex)
|
|||||||
gl_handles[y * n_x_slices + x],
|
gl_handles[y * n_x_slices + x],
|
||||||
tex->gl_intformat) );
|
tex->gl_intformat) );
|
||||||
|
|
||||||
GE( glTexParameteri (tex->gl_target, GL_TEXTURE_MAG_FILTER, tex->mag_filter) );
|
GE( cogl_wrap_glTexParameteri (tex->gl_target, GL_TEXTURE_MAG_FILTER,
|
||||||
GE( glTexParameteri (tex->gl_target, GL_TEXTURE_MIN_FILTER, tex->min_filter) );
|
tex->mag_filter) );
|
||||||
GE( glTexParameteri (tex->gl_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE) );
|
GE( cogl_wrap_glTexParameteri (tex->gl_target, GL_TEXTURE_MIN_FILTER,
|
||||||
GE( glTexParameteri (tex->gl_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE) );
|
tex->min_filter) );
|
||||||
|
GE( cogl_wrap_glTexParameteri (tex->gl_target, GL_TEXTURE_WRAP_S,
|
||||||
|
GL_CLAMP_TO_EDGE) );
|
||||||
|
GE( cogl_wrap_glTexParameteri (tex->gl_target, GL_TEXTURE_WRAP_T,
|
||||||
|
GL_CLAMP_TO_EDGE) );
|
||||||
|
|
||||||
if (tex->auto_mipmap)
|
if (tex->auto_mipmap)
|
||||||
GE( glTexParameteri (tex->gl_target, GL_GENERATE_MIPMAP, GL_TRUE) );
|
GE( cogl_wrap_glTexParameteri (tex->gl_target, GL_GENERATE_MIPMAP,
|
||||||
|
GL_TRUE) );
|
||||||
|
|
||||||
/* Pass NULL data to init size and internal format */
|
/* Pass NULL data to init size and internal format */
|
||||||
GE( glTexImage2D (tex->gl_target, 0, tex->gl_intformat,
|
GE( glTexImage2D (tex->gl_target, 0, tex->gl_intformat,
|
||||||
@ -1351,8 +1362,10 @@ cogl_texture_new_from_foreign (GLuint gl_handle,
|
|||||||
g_array_append_val (tex->slice_gl_handles, gl_handle);
|
g_array_append_val (tex->slice_gl_handles, gl_handle);
|
||||||
|
|
||||||
/* Force appropriate wrap parameter */
|
/* Force appropriate wrap parameter */
|
||||||
GE( glTexParameteri (tex->gl_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE) );
|
GE( cogl_wrap_glTexParameteri (tex->gl_target, GL_TEXTURE_WRAP_S,
|
||||||
GE( glTexParameteri (tex->gl_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE) );
|
GL_CLAMP_TO_EDGE) );
|
||||||
|
GE( cogl_wrap_glTexParameteri (tex->gl_target, GL_TEXTURE_WRAP_T,
|
||||||
|
GL_CLAMP_TO_EDGE) );
|
||||||
|
|
||||||
return _cogl_texture_handle_new (tex);
|
return _cogl_texture_handle_new (tex);
|
||||||
}
|
}
|
||||||
@ -1554,8 +1567,10 @@ cogl_texture_set_filters (CoglHandle handle,
|
|||||||
{
|
{
|
||||||
gl_handle = g_array_index (tex->slice_gl_handles, GLuint, i);
|
gl_handle = g_array_index (tex->slice_gl_handles, GLuint, i);
|
||||||
GE( glBindTexture (tex->gl_target, gl_handle) );
|
GE( glBindTexture (tex->gl_target, gl_handle) );
|
||||||
GE( glTexParameteri (tex->gl_target, GL_TEXTURE_MAG_FILTER, tex->mag_filter) );
|
GE( cogl_wrap_glTexParameteri (tex->gl_target, GL_TEXTURE_MAG_FILTER,
|
||||||
GE( glTexParameteri (tex->gl_target, GL_TEXTURE_MIN_FILTER, tex->min_filter) );
|
tex->mag_filter) );
|
||||||
|
GE( cogl_wrap_glTexParameteri (tex->gl_target, GL_TEXTURE_MIN_FILTER,
|
||||||
|
tex->min_filter) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user