Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: PNG loader might be broken in 1.2  (Read 20857 times)

0 Members and 4 Guests are viewing this topic.

dunce

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
PNG loader might be broken in 1.2
« Reply #15 on: February 07, 2008, 12:15:08 pm »
In my mind there is a table that was formed long ago when I began program for 32bit platforms and I don't have any idea now how this happened:
char: 8
short: 16
long: 32
int: depends on CPU
I guess it's time to have a look at standards. :)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
PNG loader might be broken in 1.2
« Reply #16 on: February 11, 2008, 06:15:36 pm »
I made some modifications to the code. Can you try the latest sources and see what happens now ?

I basically replaced every unsigned long with uint32 (I really don't know if it's going to make a difference), and I changed the error reporting mode so that we'll at least have the exact location of the error.
Laurent Gomila - SFML developer

zarka

  • Jr. Member
  • **
  • Posts: 81
    • View Profile
PNG loader might be broken in 1.2
« Reply #17 on: February 12, 2008, 08:33:03 pm »
Quote from: "dunce"
In my mind there is a table that was formed long ago when I began program for 32bit platforms and I don't have any idea now how this happened:
char: 8
short: 16
long: 32
int: depends on CPU
I guess it's time to have a look at standards. :)


you can never be sure that long is 32 bits ...
and in the end it is all upp to the compiler ... and then it's the funny deal about memory alignment and the like ;)
//Zzzarka

dunce

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
PNG loader might be broken in 1.2
« Reply #18 on: February 13, 2008, 07:54:58 am »
I hate to go off-topic. But I found the Borland's help source that misled me when I started with Borland C++ Builder:
 
Quote
The long keyword designates a 32-bit integer. It can be preceded by either the keyword signed or the keyword unsigned. The int keyword is optional and can be omitted. To the MIDL compiler, a long integer is signed by default and is synonymous with signed long int. On 32-bit platforms, long is synonymous with int.

jbadams

  • Newbie
  • *
  • Posts: 12
    • View Profile
PNG loader might be broken in 1.2
« Reply #19 on: February 13, 2008, 11:45:50 am »
Quote from: "dunce"
I hate to go off-topic. But I found the Borland's help source that misled me when I started with Borland C++ Builder:
 
Quote
The long keyword designates a 32-bit integer. It can be preceded by either the keyword signed or the keyword unsigned. The int keyword is optional and can be omitted. To the MIDL compiler, a long integer is signed by default and is synonymous with signed long int. On 32-bit platforms, long is synonymous with int.
That would have been true for that compiler, but it doesn't neccesarily apply to others or to the language itself.

armage

  • Newbie
  • *
  • Posts: 10
    • View Profile
PNG loader might be broken in 1.2
« Reply #20 on: February 19, 2008, 09:47:20 am »
I am also having problems loading an Image.

Code: [Select]
sf::Image anImage;
anImage.LoadFromFile("graphics\\background.png");


At first I thought it was the Bit Depth of 64 is the problem
1280X768, Bit Depth 64bit
but when reduced to 32 bit stilla problem
1280X768, Bit Depth 32bit

Just a suggestion, have you thought about using FreeImage? It has wide support for a lot of formats.

dunce

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
PNG loader might be broken in 1.2
« Reply #21 on: February 20, 2008, 04:52:31 am »
You should not use doubled slash in the image file path I guess.
Code: [Select]
"graphics/background.png"

armage

  • Newbie
  • *
  • Posts: 10
    • View Profile
PNG loader might be broken in 1.2
« Reply #22 on: February 21, 2008, 01:25:18 am »
I will try what you suggest. But I have successfully used the same path naming with other smaller files. But the paths are stored in an xml file.

Will update you guys.

Lord Delvin

  • Jr. Member
  • **
  • Posts: 68
    • ICQ Messenger - 166781460
    • View Profile
PNG loader might be broken in 1.2
« Reply #23 on: February 29, 2008, 10:29:00 am »
Is there by the way any information available whether you can use new sfml on 64bit linux now or not?

skwurp

  • Newbie
  • *
  • Posts: 2
    • View Profile
PNG loader might be broken in 1.2
« Reply #24 on: April 16, 2008, 01:03:35 am »
I confirm that replacing every unsigned long with uint32 in stb_image_aug.c seems to fix the problem.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
PNG loader might be broken in 1.2
« Reply #25 on: April 16, 2008, 03:20:40 am »
Quote
I confirm that replacing every unsigned long with uint32 in stb_image_aug.c seems to fix the problem.

Are you talking about the last changes I made, or did you have to do it yourself ? I don't remember if I replaced every unsigned long :)
Laurent Gomila - SFML developer

skwurp

  • Newbie
  • *
  • Posts: 2
    • View Profile
PNG loader might be broken in 1.2
« Reply #26 on: April 17, 2008, 07:33:36 am »
No, I made the changes myself, to the file included in version 1.2 of sfml.

I see that changing them to uint32 makes them unsigned ints, as defined in stb_image_aug.c on line 74:
Code: [Select]
typedef unsigned int   uint32;
I don't know if they should be unsigned ints, but image loading seems to work fine after the change.


Ahh, now I see that line 645 is the culprit:
Code: [Select]
static unsigned long  code_buffer; // jpeg entropy-coded buffer
If I change that to:
Code: [Select]
static uint32  code_buffer; // jpeg entropy-coded buffer
it no longer gives the "Failed to load image "thenameofyourimage.png". Reason : Corrupt PNG" error.

I don't know, maybe the other unsigned longs need changing (to be safe with 64 bit) as well?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
PNG loader might be broken in 1.2
« Reply #27 on: April 17, 2008, 07:59:50 am »
Quote
I don't know, maybe the other unsigned longs need changing (to be safe with 64 bit) as well?

I don't really know, it depends on the specs of the file formats. The author of the library is not sure about this, too.

Anyway, thanks a lot for finding the exact location of the problem :)
Laurent Gomila - SFML developer

fixus971

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
    • http://www.fixweb.it
PNG loader might be broken in 1.2
« Reply #28 on: June 12, 2008, 12:55:19 pm »
Hi.

I make a nice program with SFML but
I can't run it on some others PC:
go on: WinXP(old=full of applications) and other WinXP(office)
don't go: WinXP(of my developer friend), WinXP(new in office), WinXP(old), win2000.


 :!: I found the problem  in the x dimensions of image:
if I use images of any type greater than 1024 (pixel x)
I'm don't get any error but simply see that
win start and exit after 0.13secs.

I try to move files and put *.dll on many PC.

So.. witch file of SO can I check to work on others PC? :?:


Thanks Laurent
^_^=>Il calcolatore รจ straordinariamente veloce, accurato e stupido. Gli uomini sono incredibilmente lenti, imprecisi e creativi. L'insieme dei due costituisce una forza incalcolabile. (Albert Einstein)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
PNG loader might be broken in 1.2
« Reply #29 on: June 12, 2008, 01:11:12 pm »
Maximum image size depends on the GPU, you can't assume > 1024x1024 will be supported on every system.
Laurent Gomila - SFML developer