diff --git a/clutter/cogl/gl/cogl-texture.c b/clutter/cogl/gl/cogl-texture.c index ad25195f9..3af78f9a0 100644 --- a/clutter/cogl/gl/cogl-texture.c +++ b/clutter/cogl/gl/cogl-texture.c @@ -1256,6 +1256,7 @@ cogl_texture_new_with_size (guint width, tex->is_foreign = FALSE; tex->auto_mipmap = (flags & COGL_TEXTURE_NO_AUTO_MIPMAP) == 0; tex->mipmaps_dirty = TRUE; + tex->first_pixels = NULL; tex->bitmap.width = width; tex->bitmap.height = height; @@ -1322,6 +1323,7 @@ cogl_texture_new_from_data (guint width, tex->is_foreign = FALSE; tex->auto_mipmap = (flags & COGL_TEXTURE_NO_AUTO_MIPMAP) == 0; tex->mipmaps_dirty = TRUE; + tex->first_pixels = NULL; tex->bitmap.width = width; tex->bitmap.height = height; @@ -1387,6 +1389,7 @@ cogl_texture_new_from_bitmap (CoglHandle bmp_handle, tex->is_foreign = FALSE; tex->auto_mipmap = (flags & COGL_TEXTURE_NO_AUTO_MIPMAP) == 0; tex->mipmaps_dirty = TRUE; + tex->first_pixels = NULL; tex->bitmap = *bmp; tex->bitmap_owner = FALSE; @@ -1553,6 +1556,7 @@ cogl_texture_new_from_foreign (GLuint gl_handle, tex->is_foreign = TRUE; tex->auto_mipmap = (gl_gen_mipmap == GL_TRUE) ? TRUE : FALSE; tex->mipmaps_dirty = TRUE; + tex->first_pixels = NULL; bpp = _cogl_get_format_bpp (format); tex->bitmap.format = format; @@ -1784,7 +1788,7 @@ _cogl_texture_ensure_mipmaps (CoglHandle handle) /* glGenerateMipmap is defined in the FBO extension */ if (cogl_features_available (COGL_FEATURE_OFFSCREEN)) GE( glGenerateMipmap (tex->gl_target) ); - else + else if (tex->first_pixels) { CoglTexturePixel *pixel = tex->first_pixels + i; /* Temporarily enable automatic mipmap generation and diff --git a/clutter/cogl/gles/cogl-texture.c b/clutter/cogl/gles/cogl-texture.c index d650b7015..ae3e437b8 100644 --- a/clutter/cogl/gles/cogl-texture.c +++ b/clutter/cogl/gles/cogl-texture.c @@ -1331,6 +1331,7 @@ cogl_texture_new_with_size (guint width, tex->is_foreign = FALSE; tex->auto_mipmap = (flags & COGL_TEXTURE_NO_AUTO_MIPMAP) == 0; tex->mipmaps_dirty = TRUE; + tex->first_pixels = NULL; tex->bitmap.width = width; tex->bitmap.height = height; @@ -1397,6 +1398,7 @@ cogl_texture_new_from_data (guint width, tex->is_foreign = FALSE; tex->auto_mipmap = (flags & COGL_TEXTURE_NO_AUTO_MIPMAP) == 0; tex->mipmaps_dirty = TRUE; + tex->first_pixels = NULL; tex->bitmap.width = width; tex->bitmap.height = height; @@ -1460,6 +1462,7 @@ cogl_texture_new_from_bitmap (CoglHandle bmp_handle, tex->is_foreign = FALSE; tex->auto_mipmap = (flags & COGL_TEXTURE_NO_AUTO_MIPMAP) == 0; tex->mipmaps_dirty = TRUE; + tex->first_pixels = NULL; tex->bitmap = *bmp; tex->bitmap_owner = TRUE; @@ -1629,6 +1632,7 @@ cogl_texture_new_from_foreign (GLuint gl_handle, tex->is_foreign = TRUE; tex->auto_mipmap = (gl_gen_mipmap == GL_TRUE) ? TRUE : FALSE; tex->mipmaps_dirty = TRUE; + tex->first_pixels = NULL; bpp = _cogl_get_format_bpp (format); tex->bitmap.format = format; @@ -1860,7 +1864,7 @@ _cogl_texture_ensure_mipmaps (CoglHandle handle) /* glGenerateMipmap is defined in the FBO extension */ if (cogl_features_available (COGL_FEATURE_OFFSCREEN)) GE( cogl_wrap_glGenerateMipmap (tex->gl_target) ); - else + else if (tex->first_pixels) { CoglTexturePixel *pixel = tex->first_pixels + i; /* Temporarily enable automatic mipmap generation and