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

Author Topic: [SOLVED] Failed to create texture, internal size too big  (Read 7561 times)

0 Members and 1 Guest are viewing this topic.

Debonair

  • Newbie
  • *
  • Posts: 16
    • View Profile
[SOLVED] Failed to create texture, internal size too big
« on: February 19, 2015, 06:11:13 pm »
Greetings.
Started learning to use SFML, took a while to set up libraries and whatnot but it works. Now, the first image I want to display gives me this error, and it can't be the size because it's 32x32 px. It's a jpg.
This is the bit of code that handles the texture:
Code: [Select]
    sf::Texture texture;
    if (!texture.loadFromFile("texture.jpg", sf::IntRect(100, 100, 32, 32)))
{
    // error...
}

What am I doing wrong?
« Last Edit: February 24, 2015, 05:23:37 pm by Debonair »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Failed to create texture, internal size too big
« Reply #1 on: February 19, 2015, 06:27:50 pm »
Is your graphics driver up-to-date?
Laurent Gomila - SFML developer

Debonair

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Failed to create texture, internal size too big
« Reply #2 on: February 19, 2015, 06:29:58 pm »
Yeah.
And on a sidenote, the program thinks the image is 4294967228x4294967228 pixels big.

AlexAUT

  • Sr. Member
  • ****
  • Posts: 396
    • View Profile
Re: Failed to create texture, internal size too big
« Reply #3 on: February 19, 2015, 07:21:46 pm »
Have you tried it with another image?

Or you could upload the image?

AlexAUT

Debonair

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Failed to create texture, internal size too big
« Reply #4 on: February 19, 2015, 08:30:44 pm »
I did try, gives the same error, except the number it says is different.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Failed to create texture, internal size too big
« Reply #5 on: February 19, 2015, 08:39:38 pm »
Quote
And on a sidenote, the program thinks the image is 4294967228x4294967228 pixels big.
Programs don't think. So where did you get these values from?
Laurent Gomila - SFML developer

Debonair

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Failed to create texture, internal size too big
« Reply #6 on: February 19, 2015, 10:01:40 pm »
Quote
And on a sidenote, the program thinks the image is 4294967228x4294967228 pixels big.
Programs don't think. So where did you get these values from?

From the debug console.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
AW: Failed to create texture, internal size too big
« Reply #7 on: February 19, 2015, 10:23:07 pm »
OS? GPU? SFML version? Compiler?

Can you run any of the SFML examples?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Debonair

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: AW: Failed to create texture, internal size too big
« Reply #8 on: February 20, 2015, 11:49:37 am »
OS? GPU? SFML version? Compiler?

Can you run any of the SFML examples?

Windows 7
ATI card
SFML 2.2
CodeBlocks - GNU/GCC Compiler

Can't tell you about the examples as of now, since it looks like CodeBlocks forgot the library linking settings, so I have to redo the whole thing.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Failed to create texture, internal size too big
« Reply #9 on: February 20, 2015, 11:53:37 am »
Quote
Can't tell you about the examples as of now, since it looks like CodeBlocks forgot the library linking settings, so I have to redo the whole thing.
The precompiled examples are provided in the SDK. You just have to run them.
« Last Edit: February 20, 2015, 01:23:58 pm by Laurent »
Laurent Gomila - SFML developer

Debonair

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Failed to create texture, internal size too big
« Reply #10 on: February 20, 2015, 12:29:35 pm »
Quote
Can't tell you about the examples as of now, since it looks like CodeBlocks forgot the library linking settings, so I have to redo the whole thing.
The precompiled examples are provided in the SDK. You just have to run them.

I know. I just had to redo the library linking, which I did now. Used normal instead of static this time, all examples run fine except ftp, sockets, and voip. And shader also compiles but then freezes at the start, I assume that's not what it was meant to do.
« Last Edit: February 20, 2015, 01:24:06 pm by Laurent »

Debonair

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Failed to create texture, internal size too big
« Reply #11 on: February 20, 2015, 01:04:28 pm »
Case solved. Looks like the code was wrong in the first place, even though it compiled. Creating it as a sprite worked, and it displays the image without issues.

Code: [Select]
    sf::Texture texture;
    texture.loadFromFile("texture.jpg");
    sf::Sprite sprite;
    sprite.setTexture(texture);
    sprite.setTextureRect(sf::IntRect(0, 0, 32, 32));
    sprite.setPosition(100, 25);
    window.draw(sprite);

Thanks for the help, guys.