cogl-texture-2d: Use _cogl_texture_driver_gen to generate the GL tex
authorNeil Roberts <neil@linux.intel.com>
Tue, 9 Feb 2010 12:21:10 +0000 (12:21 +0000)
committerNeil Roberts <neil@linux.intel.com>
Tue, 9 Feb 2010 12:21:10 +0000 (12:21 +0000)
_cogl_texture_driver_gen is needed to set the texture minification
mode to Cogl's default of GL_LINEAR. There was also a line to set this
in _cogl_texture_2d_new_with_size but it wasn't working because it was
called *before* the texture was bound. If the texture was later
rendered with the default material it then it would end up with GL's
default mipmap filtering mode but without mipmaps so it would render
white squares instead.

clutter/cogl/cogl/cogl-texture-2d.c

index b700eb1..a86f844 100644 (file)
@@ -262,8 +262,7 @@ _cogl_texture_2d_new_with_size (unsigned int     width,
 
   tex_2d = _cogl_texture_2d_create_base (width, height, flags, internal_format);
 
-  GE( glGenTextures (1, &tex_2d->gl_texture) );
-  GE( glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR) );
+  _cogl_texture_driver_gen (GL_TEXTURE_2D, 1, &tex_2d->gl_texture);
   GE( glBindTexture (GL_TEXTURE_2D, tex_2d->gl_texture) );
   GE( glTexImage2D (GL_TEXTURE_2D, 0, gl_intformat,
                     width, height, 0, gl_format, gl_type, NULL) );