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

Author Topic: Texture.update() is not working  (Read 1632 times)

0 Members and 1 Guest are viewing this topic.

LordNani

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Texture.update() is not working
« on: June 03, 2019, 08:00:43 pm »
It says Assertion failed: x + window.getSize().x <= m_size.x
 :-\
Size and x\y are correct
It all breaks on last line. I need it for selection and copy/paste tool
        bufferRect.width = abs(curPos.x - point1.x);
        bufferRect.height = abs(curPos.y - point1.y);
        int width = bufferRect.width;
        int height = bufferRect.height;
        int x = bufferRect.left;
        int y = bufferRect.top;
        std::cout << "width is "<< bufferRect.width << std::endl;
        std::cout << "height is " << bufferRect.height << std::endl;
        std::cout << "left and top are " << bufferRect.left << " + " << bufferRect.top << std::endl;
       
        bufferTexture.create(width, height);
        bufferTexture.update(mainWindow,x ,y );
 

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Texture.update() is not working
« Reply #1 on: June 03, 2019, 09:21:33 pm »
Since we don't know how rect.left is calculated, and you don't show the result of your std::cout lines, there's nothing very helpful we can do. Of course I tend to trust the assert more than you ;)
Laurent Gomila - SFML developer

LordNani

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Re: Texture.update() is not working
« Reply #2 on: June 04, 2019, 12:29:32 am »
Since we don't know how rect.left is calculated, and you don't show the result of your std::cout lines, there's nothing very helpful we can do. Of course I tend to trust the assert more than you ;)
Well, it was correct. The problem is that texture should not be created from part of the window. It is written in the documentation

 

anything