hello, Jon.
i think there are two points you may check:
firstly, have you render what you want in the texture?
its architecture looks like this:
rend~~>begin;
sprite~~>visit();
rend->end();
>
>
secondly, saveBuffer has two override functions as follows, one is for filepath, and the other is for filename, do you use it correctly?
/** saves the texture into a file */
// para szFilePath the absolute path to save
// para x,y the lower left corner coordinates of the buffer to save
// pare nWidth,nHeight the size of the buffer to save
// when nWidth = 0 and nHeight = 0, the image size to save equals to buffer texture size
bool saveBuffer(const char *szFilePath, int x = 0, int y = 0, int nWidth = 0, int nHeight = 0);
/** saves the texture into a file. put format at the first argument, or ti will be overloaded with
* saveBuffer(const char *szFilePath, int x = 0, int y = 0, int nWidth = 0, int nHeight = 0) */
// para name the file name to save
// para format the image format to save, here it supports kCCImageFormatPNG and kCCImageFormatJPG */
// para x,y the lower left corner coordinates of the buffer to save
// pare nWidth,nHeight the size of the buffer to save
// when nWidth = 0 and nHeight = 0, the image size to save equals to buffer texture size
bool saveBuffer(int format, const char *name, int x = 0, int y = 0, int nWidth = 0, int nHeight = 0);
but, how can i save it as a image on iphone to show it in the device galery?
it saves the images to app documents and there is no access from device menu.
If you want to save it to the iPhone, the best way is to create a objective-c proxy which calls to UIImageWriteToSavedPhotosAlbum(yourUIImage, nil, nil, nil);
That works on devices like ipad1 or iphone3 and 4.
I have tested it on ipad3 and iphone 5 and it doesnāt workā¦ I think itās because of the resolution. When we have textures bigger than 1024x1024px it doesnāt generate the image.
Is there any way to solve it? Maybe resizing the CCRenderTexture?