mirror of
https://github.com/brl/mutter.git
synced 2024-12-26 04:42:14 +00:00
e7f1582630
This interface represents any textures that are backed by a single texture in GL and that can be used directly with the cogl_framebuffer_draw_attributes family of functions. This currently equates to CoglTexture2D, CoglTexture3D and CoglTextureRectangle. The interface currently has only one method called cogl_primitive_set_auto_mipmap. This replaces the COGL_TEXTURE_NO_AUTO_MIPMAP flag from the CoglTextureFlags parameter in the constructors. None of the other flags in CoglTextureFlags make sense for primitive textures so it doesn't seem like a good idea to need them for primitive constructors. There is a boolean in the vtable to mark whether a texture type is primitive which the new cogl_is_primitive function uses. There is also a new texture virtual called set_auto_mipmap which is only required to be implemented for primitive textures. Reviewed-by: Robert Bragg <robert@linux.intel.com>
55 lines
1.5 KiB
C
55 lines
1.5 KiB
C
/*
|
|
* Cogl
|
|
*
|
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
|
*
|
|
* Copyright (C) 2012 Intel Corporation.
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library. If not, see
|
|
* <http://www.gnu.org/licenses/>.
|
|
*
|
|
*
|
|
* Authors:
|
|
* Neil Roberts <neil@linux.intel.com>
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
#include "config.h"
|
|
#endif
|
|
|
|
#include "cogl-primitive-texture.h"
|
|
#include "cogl-texture-private.h"
|
|
|
|
gboolean
|
|
cogl_is_primitive_texture (void *object)
|
|
{
|
|
return (cogl_is_texture (object) &&
|
|
COGL_TEXTURE (object)->vtable->is_primitive);
|
|
}
|
|
|
|
void
|
|
cogl_primitive_texture_set_auto_mipmap (CoglPrimitiveTexture *primitive_texture,
|
|
gboolean value)
|
|
{
|
|
CoglTexture *texture;
|
|
|
|
_COGL_RETURN_IF_FAIL (cogl_is_primitive_texture (primitive_texture));
|
|
|
|
texture = COGL_TEXTURE (primitive_texture);
|
|
|
|
g_assert (texture->vtable->set_auto_mipmap != NULL);
|
|
|
|
texture->vtable->set_auto_mipmap (texture, value);
|
|
}
|