|
CTexture
This is just a
little object to store a texture, it works with any
.bmp file format. You'll be able to load and manage
textures very easily with CTexture object.
See the public
part of this class :
int |
LoadTexture(char *filename); |
void |
FreeData(); |
int |
GetWidth(); |
int |
GetHeight(); |
uchar |
*GetData(); |
int |
GetPixel(int *color, int x, int y); |
int |
GetPixel(uchar *r, uchar *g, uchar *b, int
x, int y); |
|
|
uint |
texture_id; |
Explanations :
LoadTexture()
will load an image into memory, and will stock its
width and height data.
FreeData() will release memory, but it'll will keep
width and height information, for a further use,
once the texture is bound into graphical memory by
OpenGL, you can
release the allocated system memory but it's useful
to keep width and height information.
Don't need any explanation about GetWidth() and
GetHeight() I guess.
GetData() will return a pointer to an allocated
system memory that contains the image pixel data.
The pixel format is RGB.
GetPixel are used to retrieve pixel data, as a
integer number, or as chromatic components
separately (Note this functions won't work with
bitmap format where depth is different from 24bits).
There is also
a texture_id field in the public part, that will
allow you to store the
OpenGL texture
ID once bound.
|
|