Top | ![]() |
![]() |
![]() |
![]() |
G3DImage * | g3d_texture_load_cached () |
G3DImage * | g3d_texture_load_from_stream () |
G3DImage * | g3d_texture_load () |
void | g3d_texture_free () |
gboolean | g3d_texture_prepare () |
gboolean | g3d_texture_flip_y () |
G3DImage * | g3d_texture_merge_alpha () |
A texture is an image used in materials. Here are some helper functions, mostly for cached loading of a G3DImage.
G3DImage * g3d_texture_load_cached (G3DContext *context
,G3DModel *model
,const gchar *filename
);
Loads a texture image from file and attaches it to a hash table in the model. On a second try to load this texture it is returned from cache.
G3DImage * g3d_texture_load_from_stream (G3DContext *context
,G3DModel *model
,G3DStream *stream
);
Load a texture image from a stream. The file type is determined by the
extension of the stream URI, so it should be valid. If model
is not NULL
the texture image is cached (or retrieved from cache if available).
G3DImage * g3d_texture_load (G3DContext *context
,const gchar *filename
);
Load a texture from a file. The type of file is determined by the file extension.
void
g3d_texture_free (G3DImage *texture
);
Frees all memory used by this texture image.
gboolean
g3d_texture_prepare (G3DImage *texture
);
Resizes the image to dimensions which are a power of 2 to be usable as an OpenGL texture. (FIXME: unimplemented)
gboolean
g3d_texture_flip_y (G3DImage *texture
);
Mirror the image along the x axis - all y coordinates are inverted.
#define G3D_FLAG_IMG_GREYSCALE (1L << 1)
The image just uses the red channel for grey value
typedef struct { gchar *name; guint32 width; guint32 height; guint8 depth; guint32 flags; guint8 *pixeldata; guint32 tex_id; G3DTexEnv tex_env; G3DFloat tex_scale_u; G3DFloat tex_scale_v; } G3DImage;
Object containing a two-dimensional pixel image.
name of image |
||
width of image in pixels |
||
height of image in pixels |
||
depth of image in bits |
||
flags |
||
the binary image data |
||
the OpenGL texture id, should be unique model-wide |
||
G3DTexEnv |
texture environment flags |
|
G3DFloat |
factor scaling texture width, should be 1.0 for most cases |
|
G3DFloat |
factor scaling texture height, should be 1.0 for most cases |