I've seen how to load bmps from a file.
However I'm having a bit of bother.
I'd like to using the method I've used previously of a gfx_buffer class and rbz's bmp2raw / bin2c, to load and create images from memory.
some code to illustrate.
#include "media\image_raw.cpp"
#include "media\image_pal.cpp"
class gfx_buffer
{
public:
int wwidth, height;
unsigned int *pixels;
};
void load_texture()
{
texture_one=create_gfx_buffer(128,128);//load_gfx_buffer( image_pal, image_raw, 128, 128 );
for ( int x=0; x<128; x++ )
{
for ( int y=0; y<128; y++)
{
texture_one->pixels[ x+y*texture_one->wwidth ]=0xff00f0;
}
}
glGenTextures(1, &texture_one->pixels[0]); // Create The Texture
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); // Linear Filtering
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); // Linear Filtering
glBindTexture(GL_TEXTURE_2D, texture_one->pixels[0]);
}
gfx_buffer *create_gfx_buffer( int wwidth, int height, unsigned int mask_colour=0 )
{
gfx_buffer *buffer = new gfx_buffer;
buffer->pixels = new unsigned int [wwidth*height];
buffer->wwidth = wwidth;
buffer->height = height;
return buffer;
}
Thankyou.