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

Author Topic: LoadFromFile Error  (Read 3729 times)

0 Members and 1 Guest are viewing this topic.

pia32

  • Newbie
  • *
  • Posts: 3
    • View Profile
LoadFromFile Error
« on: December 15, 2010, 02:52:02 am »
Hi,
I'm getting an error with the following code. It works on the computer I'm developing on, but it fails when I run it on a different computer. Is there some documentation about this somewhere where I can get more detailed information on why LoadFromFile isn't working, or the possible reasons why it would fail?

Code: [Select]
   if(!BackgoundImage.LoadFromFile(path))
    {
        MessageBox(NULL, path, "Error loading backgroundFax.jpg", MB_OK);
        return false;
    }

Terrydil

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
LoadFromFile Error
« Reply #1 on: December 15, 2010, 05:39:19 pm »
Well there is documentation of course.  For 1.6.

If it works on one computer but not another that would suggest that the file isn't where the application is expecting it to be on the second computer.  The fact that it loads on one computer suggests that the file itself can be read fine, the second computer just needs to know where to find it.

pia32

  • Newbie
  • *
  • Posts: 3
    • View Profile
LoadFromFile Error
« Reply #2 on: December 16, 2010, 12:37:33 am »
I have an installer for my program, which works on 4 other computers. Additionally, I manually checked that the file was there. I successfully loaded another image file in the same directory that loads using the about the same code. Are there any other reasons why the LoadFromFile method would fail other than 'file not found'?


EDIT: I may have found a possible culprit. I think some computers have a maximum native image size. Im using an old (2004) computer, with Intel (915GM/915GMS,910GML) onboard graphics. My image is 1280*1024. Could this be a problem?

Terrydil

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
LoadFromFile Error
« Reply #3 on: December 16, 2010, 02:58:57 am »
It could be.  1280 x 1024 isn't really all that big but if the card is old enough...try scaling it down or splitting it into two images.

Breakman79

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
LoadFromFile Error
« Reply #4 on: December 16, 2010, 06:49:48 pm »
You can also check what the max texture size of your card is by running this bit of code and looking at the value of texSize:

Code: [Select]
GLint texSize; glGetIntegerv(GL_MAX_TEXTURE_SIZE, &texSize);


Also, SFML does throw an error to std::cerr when you try to create a texture that is too large.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
LoadFromFile Error
« Reply #5 on: December 16, 2010, 09:52:58 pm »
Quote from: "Breakman79"
You can also check what the max texture size of your card is by running this bit of code and looking at the value of texSize:

Code: [Select]
GLint texSize; glGetIntegerv(GL_MAX_TEXTURE_SIZE, &texSize);


Also, SFML does throw an error to std::cerr when you try to create a texture that is too large.


sf::Image::GetMaximumSize() is much easier to write than a whole OpenGL call :P
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

pia32

  • Newbie
  • *
  • Posts: 3
    • View Profile
Solved
« Reply #6 on: December 18, 2010, 07:28:39 pm »
Fixed it. The problem was that the texture was too big (2048*1024). If I scaled it down to 1024*768 it worked.

However, I found a more interesting workaround. (Using MinGW) The rev that didnt work was a win32 app (starting with WinMain). When I changed it to a regular native app (starting from int main), it loaded the textures at 1280*1024. In addition, it increased the frame rate from 3 to 60.

 

anything