I need to pre process some textures before I use them. Basically I'm using devil to load the the source texture, then create a second texture on the fly and copy a section of the source texture using ilBlit, to test I output the image as a bitmap. The problem is the bitmap comes out as the right shape and size but is blank, no copied image. I'm really unsure what I'm doing wrong. I should add iloverlayimage dose not work but ilCopy does, though obviouslky wrong , that is it copies the whole image over.
Can anyone tell me what I'm doing wrong with ilBlit in my code? Thanks!
void LoadAnimationImages( VIDEO_ANIMATION *anim, string filename )
{
ILuint image,blankimage;
/*generate buffer*/
ilGenImages( 1, &image );
/*bind image to buffer*/
ilBindImage( image );
/*load the texture*/
if( !ilLoadImage( filename.c_str() ) )
{
printf( "\n falied to load texture \n ");
}
/*get height and with of pixels*/
int pixels_width = ( ilGetInteger( IL_IMAGE_WIDTH ) / GetNumberOfAnimations( anim ) ) * GetFramesUsed( anim ) ;
int pixels_hight = ilGetInteger( IL_IMAGE_HEIGHT );
int bpp = ilGetInteger(IL_IMAGE_BPP);
ILint format = ilGetInteger(IL_IMAGE_FORMAT);
ILint depth = ilGetInteger(IL_IMAGE_DEPTH);
ILint type = ilGetInteger(IL_IMAGE_TYPE);
printf( "\n width %d height %d depth %d \n",pixels_width,pixels_hight, depth );
/**********************create a blank image*********************/
/*generate buffer*/
ilGenImages( 1, &blankimage );
/*bind image to buffer*/
ilBindImage( blankimage );
/* create a new image */
ilTexImage( pixels_width, pixels_hight, depth, bpp, format, type, (void*)NULL );
/*copy some data from main image to reel vector data*/
ilBlit( blankimage, 0,0,depth, 0,0,depth, 128,128,depth ); //to dest x,y,z, from source x,y,z, width height depilth,
//ilOverlayImage( image, 100,100,depth ); does not work
//ilCopy( image ) will work
/*test to maked sure image is copied*/
ilSaveImage("test.bmp"); //test image comes out right size etc but with no image eg just black?
/****************************************************************/
}