DevIL - zapisywanie pliku

0

Piszę funkcje do zapisu pliku graficznego jednak owa funkcja nie działa.
Tworzy się plik 1x1 i nic więcej.
Funkcje piszę w bibliotecę DevIL (kiedyś się nazywała OpenIL) więc jeśli ktoś pracował tą biblioteką to prosiłbym o pomoc.
Oto kod:

void SaveTexture(ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILenum Format, ILenum Type, 
	             ILenum TypeS, ILenum Mode, char * FileName, ILuint Texture)
{
	//////////////////////////////
	//      Width  
	// * Specifies the new image width. This cannot be 0.
	//      Height 
	// * Specifies the new image height. This cannot be 0.
        //      Depth 
	// * Specifies the new image depth. Anything greater than 1 will make the image 3d. This cannot be 0.
	//      Bpp
	// * The bytes per pixel of the image data. Do not confuse this with bits
        //   per pixel, which is also commonly used. Common bytes per pixel
        //   values are 1, 3 and 4.
        //      Format,
	// * The format of the image data. Formats accepted are listed here and are self-explanatory:
        // - IL_COLOUR_INDEX
        // - IL_RGB
        // - IL_RGBA
        // - IL_BGR
        // - IL_BGRA
        // - IL_LUMINANCE
        //      Type
        // * The type of image data. Usually, this will be IL_UNSIGNED_BYTE,
        //   unless you want to utilize multiple bits per colour channel. 
        //   Type accepted are listed here:
        // - IL_BYTE
        // - IL_UNSIGNED_BYTE
        // - IL_SHORT
        // - IL_UNSIGNED_SHORT
        // - IL_INT
        // - IL_UNSIGNED_INT
        // - IL_FLOAT
        // - IL_DOUBLE
	//      TypeS-aved-image
        // * IL_BMP - Save the image as a Microsoft bitmap (.bmp).
        // * IL_JPG - Save the image as a Jpeg (.jpg, .jpeg).
        // * IL_PNG - Save the image as a Portable Network Graphics (.png) image.
        // * IL_TGA - Save the image as a TrueVision Targa.
	//      Mode   
	// * IL_FILE_OVERWRITE - Possible to override.
	// * IL_FILE_ALREADY_EXISTS - Impossible to override.
        //      FileName 
	// * The filename of the file to save to.
	//      Texture
	// * Texture to the save.
	//////////////////////////////

	// włączenie parametru Mode
	ilEnable(Mode);

	//ilGenImages(1, &Texture);

	// wybranie biezacego obrazu
	ilBindImage(Texture);

	if(Width == NULL)Width = ilGetInteger(IL_IMAGE_WIDTH);
	if(Height == NULL)Height = ilGetInteger(IL_IMAGE_HEIGHT);
	if(Bpp == NULL)Bpp = ilGetInteger(IL_IMAGE_BYTES_PER_PIXEL);
	if(Format == NULL)Format = ilGetInteger(IL_IMAGE_FORMAT);
	if(Type == NULL)Type = ilGetInteger(IL_IMAGE_TYPE);
	
	ilTexImage(Width, Height, Depth, Bpp, Format, Type, ilGetData() /*Texture*/);

	// zapisanie obrazu
	ilSave(TypeS, FileName);

	// wyłączenie parametru Mode
	ilDisable(Mode);
}

Wszystko wywołuje tak:

SaveTexture(64,64,1,3,IL_RGB,IL_UNSIGNED_BYTE,IL_PNG,IL_FILE_OVERWRITE,"Test.png",Grass);
0

Sprawdziłem moją funkcje funkcją ilGetError() i ona zwróciła 0 tzn. że nie ma błędu czyli kod jest poprawny

  • tylko ja źle coś wywołuje jednak dalej nie wiem co więc każda pomoc mile widziana.

EDIT:
Gdy próbuje zapisać otrzymuje (patrz do załącznika) test.png.

Test.png

EDIT 2:
Tu jest link do działającego przykładu (nie sprawdzałem) więć mógłby ktoś przejrzeć, porównać?
http://www.gamedev.net/topic/273576-devil-image-saving/

dodanie obrazka do treści posta - fp

1 użytkowników online, w tym zalogowanych: 0, gości: 1