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

Sounds like an error in libpng. Can you attach the PNG you’re trying to load?>----- 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

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:

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
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


http://codebad.com/

Off-by-One error. Try again.
No clue about the libpng without further information.On Mon, 19 Jul 2010 16:29:51 +0000 (UTC), mike wrote:

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


Christoph Nelles

E-Mail : @Christoph_Nelles
Jabber : eazrael at evilazrael.net ICQ : 78819723

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

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, 19 Jul 2010 16:29:51 +0000 (UTC), mike wrote:

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

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


Christoph Nelles

E-Mail ? ?: evilazrael at evilazrael.de
Jabber ? ?: eazrael at evilazrael.net ? ? ?ICQ ? ? ? : 78819723

PGP-Key ? : ID 0x424FB55B on subkeys.pgp.net
? ? ? ? ? ?or http://evilazrael.net/pgp.txt


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


http://codebad.com/

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

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.

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/ScopeAm 20.07.2010 08:33, schrieb mike:

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:

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 <scrat_is_here at yahoo.com> wrote:

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 : @Christoph_Nelles
Jabber : eazrael at evilazrael.net ICQ : 78819723

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

/// 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.

Please send us your PNGsOn Tue, Jul 20, 2010 at 2:33 AM, mike <scrat_is_here at yahoo.com> wrote:

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
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


http://codebad.com/

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 DOn Tue, Jul 20, 2010 at 4:27 AM, Donny Viszneki <donny.viszneki at gmail.com>wrote:

Please send us your PNGs

On Tue, Jul 20, 2010 at 2:33 AM, mike <scrat_is_here at yahoo.com> wrote:

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
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


http://codebad.com/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

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 DOn Tue, Jul 20, 2010 at 8:03 AM, Jonathan Dearborn <@Jonathan_Dearborn>wrote:

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 <donny.viszneki at gmail.com>wrote:

Please send us your PNGs

On Tue, Jul 20, 2010 at 2:33 AM, mike <scrat_is_here at yahoo.com> wrote:

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
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


http://codebad.com/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

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:

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

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

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?(seeOn Tue, 20 Jul 2010 15:17:22 +0000 (UTC), Mike <scrat_is_here at yahoo.com> wrote:
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
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Christoph Nelles

E-Mail : @Christoph_Nelles
Jabber : eazrael at evilazrael.net ICQ : 78819723

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

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

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 <scrat_is_here at yahoo.com> wrote:

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
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Christoph Nelles

E-Mail : @Christoph_Nelles
Jabber : eazrael at evilazrael.net ICQ : 78819723

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

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.

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.

Where should I file a bug report?