The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
libpng error: decompression error.
mike4


Joined: 19 Jul 2010
Posts: 1
int LoadGLTexture(char *pFileName, int TextureId)
{
SDL_Surface* lotto[TextureId]
lotto[TextureId] = IMG_Load(TextureFileName)
...

with the above I get the error as in the title.
Why? What to change?
Many thanks


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
libpng error: decompression error.
Mason Wheeler
Guest

Sounds like an error in libpng. Can you attach the PNG you're trying to load?



Quote:
----- Original Message ----
From: mike
Subject: [SDL] libpng error: decompression error.

int LoadGLTexture(char *pFileName, int TextureId)
{
SDL_Surface* lotto[TextureId]
lotto[TextureId] = IMG_Load(TextureFileName)
...

with the above I get the error as in the title.
Why? What to change?
Many thanks

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
libpng error: decompression error.
Donny Viszneki
Guest

Mason is right, you need to attach the PNG for us to diagnose the
problem, which should probably end up being sent to the libpng
developer mailing list.

It would also help to know what application created your PNG image.

To work around the problem, try using another application to create
your PNG image. Simply open the PNG and try to "Save As..."

On Mon, Jul 19, 2010 at 12:29 PM, mike wrote:
Quote:
int LoadGLTexture(char *pFileName, int TextureId)
{
SDL_Surface* lotto[TextureId]
lotto[TextureId] = IMG_Load(TextureFileName)
...

with the above I get the error as in the title.
Why? What to change?
Many thanks


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org




--
http://codebad.com/
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
libpng error: decompression error.
Christoph Nelles
Guest

On Mon, 19 Jul 2010 16:29:51 +0000 (UTC), mike wrote:
Quote:
int LoadGLTexture(char *pFileName, int TextureId)
{
SDL_Surface* lotto[TextureId]
lotto[TextureId] = IMG_Load(TextureFileName)
...

Off-by-One error. Try again.
No clue about the libpng without further information.


--
Christoph Nelles

E-Mail :
Jabber : ICQ : 78819723

PGP-Key : ID 0x424FB55B on subkeys.pgp.net
or http://evilazrael.net/pgp.txt
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
libpng error: decompression error.
Donny Viszneki
Guest

On Mon, 19 Jul 2010 16:29:51 +0000 (UTC), mike wrote:
Quote:
int LoadGLTexture(char *pFileName, int TextureId)
{
SDL_Surface* lotto[TextureId]
lotto[TextureId] = IMG_Load(TextureFileName)
...

Oh, of course there is more going on here than I cared to pay any
attention to at first...

You should know that the way you have declared "lotto," it is a local
variable, and it will be lost when your LoadGLTexture() function
returns.

Also, the number of SDL_Surface* you can fit into "lotto" is
TextureId! I highly doubt that is what you intended!

You should grab a good C book and learn the basics :)

On Mon, Jul 19, 2010 at 12:40 PM, Christoph Nelles
wrote:
Quote:

Off-by-One error. Try again.
No clue about the libpng without further information.


--
Christoph Nelles

E-Mail    :
Jabber    :      ICQ       : 78819723

PGP-Key   : ID 0x424FB55B on subkeys.pgp.net
           or http://evilazrael.net/pgp.txt
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org




--
http://codebad.com/
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
libpng error: decompression error.
mike
Guest

Hi Donny
yes you might be wright so maybe you could help me move SDL_Surface out of the
function? This should be the way to go?
Anyway i tried as below and still randomly the error occurrs with 2-3 out of 4
png textures.

------
/// Loads one texture
int LoadGLTexture(char *pFileName, int TextureId)
{
SDL_Surface* lotto[TextureId];
SDL_RWops *rwop;
rwop=SDL_RWFromFile(TextureFileName, "rb");
lotto[TextureId]=IMG_LoadPNG_RW(rwop);

-------
declarations are:

int TextureId;
int lotto[5];

Many thanks
Michael


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
libpng error: decompression error.
Christoph Nelles
Guest

Am 20.07.2010 08:33, schrieb mike:
Quote:
Hi Donny
yes you might be wright so maybe you could help me move SDL_Surface out of the
function? This should be the way to go?
Anyway i tried as below and still randomly the error occurrs with 2-3 out of 4
png textures.

------
/// Loads one texture
int LoadGLTexture(char *pFileName, int TextureId)
{
SDL_Surface* lotto[TextureId];
SDL_RWops *rwop;
rwop=SDL_RWFromFile(TextureFileName, "rb");
lotto[TextureId]=IMG_LoadPNG_RW(rwop);


Using RWops here makes it more complicated but still not correct. When
you declare an array int xyz[5] you have the elements xyz[0]..xyz[4].
You are writing to xyz[5], so you are writing in space that is probably
not belonging to you and in every case is not in your array. Go fetch a
C/C++ book.
Quote:
int lotto[5];

Where is this declaration? It will still be shadowed by the local
declaration in the function.
http://en.wikibooks.org/wiki/C%2B%2B_Programming/Scope


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
libpng error: decompression error.
mike
Guest

int LoadGLTexture(char *pFileName, int TextureId)
{
SDL_Surface* image
image = IMG_Load(TextureFileName)


---------
Well first I had it like above and most examples but still
got the libpng decompression error. to be precise it worked
on opensuse 11.2 but after switching to unbuntu 10.04 i got
those errors.
So the above should work? Well I'm not alone with that error:
http://www.gamedev.net/community/forums/topic.asp?topic_id=546917


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
libpng error: decompression error.
Christoph Nelles
Guest

Hi,

please provide us/me with the source code and the image(s). I think the
problem might be somewhere else.

On Tue, 20 Jul 2010 08:06:48 +0000 (UTC), mike
wrote:
Quote:
int LoadGLTexture(char *pFileName, int TextureId)
{
SDL_Surface* image
image = IMG_Load(TextureFileName)


---------
Well first I had it like above and most examples but still
got the libpng decompression error. to be precise it worked
on opensuse 11.2 but after switching to unbuntu 10.04 i got
those errors.
So the above should work? Well I'm not alone with that error:
http://www.gamedev.net/community/forums/topic.asp?topic_id=546917


--
Christoph Nelles

E-Mail :
Jabber : ICQ : 78819723

PGP-Key : ID 0x424FB55B on subkeys.pgp.net
or http://evilazrael.net/pgp.txt
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
libpng error: decompression error.
mike
Guest

/// Loads one texture
int LoadGLTexture(char *pFileName, int TextureId)
{

SDL_Surface* image;

image = IMG_Load(TextureFileName);

if (image) {
...opengl stuff
Stat = TRUE;

} else {
Stat = FALSE;
}
if (image) {
SDL_FreeSurface(image);
}
return Stat;
}

The error occurrs randomly: ### LoadGLTexture(): Error loading texture! but
image paths are correct. Images are created in Gimp.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
libpng error: decompression error.
Donny Viszneki
Guest

Please send us your PNGs

On Tue, Jul 20, 2010 at 2:33 AM, mike wrote:
Quote:
Hi Donny
yes you might be wright so maybe you could help me move SDL_Surface out of the
function? This should be the way to go?
Anyway i tried as below and still randomly the error occurrs with 2-3 out of 4
png textures.

------
/// Loads one texture
int LoadGLTexture(char *pFileName, int TextureId)
{
  SDL_Surface* lotto[TextureId];
  SDL_RWops *rwop;
  rwop=SDL_RWFromFile(TextureFileName, "rb");
  lotto[TextureId]=IMG_LoadPNG_RW(rwop);

-------
declarations are:

int TextureId;
int lotto[5];

Many thanks
Michael


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org




--
http://codebad.com/
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
libpng error: decompression error.
Jonny D


Joined: 12 Sep 2009
Posts: 932
Is that the real code?  Why aren't you using pFileName?  I'd expect you to want something like this:
// Some global somewhereSDL_Surface* lotto[5];


// Somewhere, this function
int LoadGLTexture(const char* pFileName, int TextureId)
{
    int result = -1;
    SDL_Surface* image = IMG_Load(pFileName);
    if(image == NULL)
        return result;
    
    // Do OpenGL texture conversion here
    
    return result;
}


If you trust your code, then the other thing to do is to try saving the PNGs without Adam7 interlacing.  Maybe your libpng needs to be updated.  While we're at it, what version of SDL and SDL_image are you using?


Jonny D


On Tue, Jul 20, 2010 at 4:27 AM, Donny Viszneki wrote:
Quote:
Please send us your PNGs


On Tue, Jul 20, 2010 at 2:33 AM, mike wrote:
Quote:
Hi Donny
yes you might be wright so maybe you could help me move SDL_Surface out of the
function? This should be the way to go?
Anyway i tried as below and still randomly the error occurrs with 2-3 out of 4
png textures.

------
/// Loads one texture
int LoadGLTexture(char *pFileName, int TextureId)
{
  SDL_Surface* lotto[TextureId];
  SDL_RWops *rwop;
  rwop=SDL_RWFromFile(TextureFileName, "rb");
  lotto[TextureId]=IMG_LoadPNG_RW(rwop);

-------
declarations are:

int TextureId;
int lotto[5];

Many thanks
Michael


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org






--
http://codebad.com/

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


libpng error: decompression error.
Jonny D


Joined: 12 Sep 2009
Posts: 932
Eh, well you probably want that global to be 'int lotto[5]' and assign the new texture ID to lotto[TextureId] once you get it.

Jonny D


On Tue, Jul 20, 2010 at 8:03 AM, Jonathan Dearborn wrote:
Quote:
Is that the real code?  Why aren't you using pFileName?  I'd expect you to want something like this:
// Some global somewhere SDL_Surface* lotto[5];


// Somewhere, this function
int LoadGLTexture(const char* pFileName, int TextureId)
{
    int result = -1;
    SDL_Surface* image = IMG_Load(pFileName);
    if(image == NULL)
        return result;
    
    // Do OpenGL texture conversion here
    
    return result;
}


If you trust your code, then the other thing to do is to try saving the PNGs without Adam7 interlacing.  Maybe your libpng needs to be updated.  While we're at it, what version of SDL and SDL_image are you using?


Jonny D



On Tue, Jul 20, 2010 at 4:27 AM, Donny Viszneki wrote:
Quote:
Please send us your PNGs


On Tue, Jul 20, 2010 at 2:33 AM, mike wrote:
Quote:
Hi Donny
yes you might be wright so maybe you could help me move SDL_Surface out of the
function? This should be the way to go?
Anyway i tried as below and still randomly the error occurrs with 2-3 out of 4
png textures.

------
/// Loads one texture
int LoadGLTexture(char *pFileName, int TextureId)
{
  SDL_Surface* lotto[TextureId];
  SDL_RWops *rwop;
  rwop=SDL_RWFromFile(TextureFileName, "rb");
  lotto[TextureId]=IMG_LoadPNG_RW(rwop);

-------
declarations are:

int TextureId;
int lotto[5];

Many thanks
Michael


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org






--
http://codebad.com/

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org








libpng error: decompression error.
Mike
Guest

I'm not using Adam 7 but could send you a image. I've sent one to Christoph and
for the code see my other posting.

This used to work on Opensuse 11.2 but since I've moved to Ubuntu 10.04 I get
this error. All default Ubuntu libs.

Most examples simply do: SDL_Surface* image;
so why did this stop working on Ubuntu? My original code should work?(see other
posting) or do I have to change according to this:
http://www.gamedev.net/community/forums/topic.asp?topic_id=546917

Anyone wanting to test send me a mail i reply & attach a image.
Thanks



_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
libpng error: decompression error.
Christoph Nelles
Guest

I think you need to show us more of your code, perhaps you completely mess
up the memory which causes various malfunctions.

On Tue, 20 Jul 2010 15:17:22 +0000 (UTC), Mike
wrote:
Quote:
I'm not using Adam 7 but could send you a image. I've sent one to
Christoph and
for the code see my other posting.

This used to work on Opensuse 11.2 but since I've moved to Ubuntu 10.04
I
Quote:
get
this error. All default Ubuntu libs.

Most examples simply do: SDL_Surface* image;
so why did this stop working on Ubuntu? My original code should
work?(see
Quote:
other
posting) or do I have to change according to this:
http://www.gamedev.net/community/forums/topic.asp?topic_id=546917

Anyone wanting to test send me a mail i reply & attach a image.
Thanks



_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

--
Christoph Nelles

E-Mail :
Jabber : ICQ : 78819723

PGP-Key : ID 0x424FB55B on subkeys.pgp.net
or http://evilazrael.net/pgp.txt
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
libpng error: decompression error.
Mike
Guest

I've tried all possible changes and the error occurs immediately after IMG_Load:

No source available for "siglongjmp() "

I do a plugin for another app. Any ideas on how to proceed now?
Many thanks





_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
libpng error: decompression error.
Christoph Nelles
Guest

Where is the full source of your code? Everything from the main to the
function call. If you don't provide it probably nobody can help.

On Wed, 21 Jul 2010 08:34:42 +0000 (UTC), Mike
wrote:
Quote:
I've tried all possible changes and the error occurs immediately after
IMG_Load:

No source available for "siglongjmp() "

I do a plugin for another app. Any ideas on how to proceed now?
Many thanks





_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

--
Christoph Nelles

E-Mail :
Jabber : ICQ : 78819723

PGP-Key : ID 0x424FB55B on subkeys.pgp.net
or http://evilazrael.net/pgp.txt
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
libpng error: decompression error.
michael
Guest

I do i like this now:

if (!LoadGLTexture(TextureFileName0, PANEL_TEXTURE)) {
XPLMDebugString("Panel texture failed to load\n");
LoadGLTexture(TextureFileName0, PANEL_TEXTURE);
}

works and for 4 textures I get around 8 failed messages. But I doubt this to be
good programming...and even consider filing a bug report? Well memory is hardly
changing as I call all textures one after the other.


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
libpng error: decompression error.
mike
Guest

No luck still the same:

Single stepping until exit from function siglongjmp,
which has no line number information.
Warning:
Cannot insert breakpoint 0.
Error accessing memory address 0x131210e3: Input/output error.



_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
libpng error: decompression error.
mike
Guest

Where should I file a bug report?

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
libpng error: decompression error.
Jonny D


Joined: 12 Sep 2009
Posts: 932
I would guess here:
http://sourceforge.net/tracker/?atid=105624&group_id=5624&func=browse

[/url]Jonny D


On Wed, Jul 21, 2010 at 11:58 AM, mike wrote:
Quote:
Where should I file a bug report?


_______________________________________________
SDL mailing list

[url=http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org]http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


libpng error: decompression error.
mike
Guest

HI
basically I only want to do something alike:

SDL_Surface *cristal = IMG_Load("Images/cristal.png");

but it fails with a shared lib or dll. Why? What could I be doing wrong?
Many thanks
Michael


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
libpng error: decompression error.
Jonny D


Joined: 12 Sep 2009
Posts: 932
Did you try checking IMG_GetError()?  It might tell you the problem, like if you're using an incompatible or missing dll.

Jonny D


On Fri, Jul 30, 2010 at 4:37 AM, mike wrote:
Quote:
HI
basically I only want to do something alike:

SDL_Surface *cristal = IMG_Load("Images/cristal.png");

but it fails with a shared lib or dll. Why? What could I be doing wrong?
Many thanks
Michael


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
libpng error: decompression error.
mike
Guest

thanks but i only get:

Error reading the PNG file.

This worked only some months ago perfectly!
Any help is much appreciated
Michael





_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
libpng error: decompression error.
John Magnotti
Guest

Hi Mike,

How does it fail exactly? Does a white box show-up where there should
be something, or do you get a segfault. Probably not it, but check the
case of the file you are loading, as well as make sure you are running
the application from the appropriate directory (namely, the one that
has "Images" as a sub-directory).

Hope that helps,

John

On Sat, Jul 31, 2010 at 2:06 AM, mike wrote:
Quote:
thanks but i only get:

Error reading the PNG file.

This worked only some months ago perfectly!
Any help is much appreciated
Michael





_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org