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

Author Topic: CopyScreen y position not working  (Read 3995 times)

0 Members and 1 Guest are viewing this topic.

Cuban-Pete

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
CopyScreen y position not working
« on: July 04, 2011, 07:30:21 pm »
Hi,

I'm using CopyScreen and the y position is off.

I tried to fix it to change this line in the source code:

Code: [Select]
   GLCheck(glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, srcRect.Left, srcRect.Top + myHeight, myWidth, myHeight));

The glCopyTexSubImage2D function starts at the left bottom and not the top left position. My fix however does not work, somehow it goes higher than it should...  :roll:

Cuban-Pete

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
CopyScreen y position not working
« Reply #1 on: July 07, 2011, 06:30:54 pm »
Nobody has this problem?  :roll:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
CopyScreen y position not working
« Reply #2 on: July 07, 2011, 07:33:12 pm »
I don't remember such a problem with the CopyScreen function. Do you use SFML 1 or 2?
Laurent Gomila - SFML developer

Cuban-Pete

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
CopyScreen y position not working
« Reply #3 on: July 07, 2011, 07:53:37 pm »
I use SFML 2.

If you cut the screen in 4 even parts and try to get the bottom right one with the copyscreen function, it wont work.

Or perhaps it has to do with the opengl perspective?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
CopyScreen y position not working
« Reply #4 on: July 07, 2011, 08:43:41 pm »
Can you show a complete and minimal code that reproduces the problem?
Laurent Gomila - SFML developer

Cuban-Pete

  • Jr. Member
  • **
  • Posts: 71
    • View Profile

Cuban-Pete

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
CopyScreen y position not working
« Reply #6 on: July 11, 2011, 09:01:15 am »
bump

Code: [Select]

//taking a copyscreen of fourth quarter:
screen.CopyScreen(window, sf::IntRect( 600/2, 0, 300, 200) ); //this gives correct result
screen.CopyScreen(window, sf::IntRect( 600/2, 400/2, 300, 200) ); //this should be the correct code

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
CopyScreen y position not working
« Reply #7 on: July 11, 2011, 11:42:39 pm »
You were right about inverted coordinates, now it's fixed. Thanks for your feedback :)
Laurent Gomila - SFML developer

Cuban-Pete

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
CopyScreen y position not working
« Reply #8 on: July 15, 2011, 04:03:42 pm »
Thanks! It works great now!  :D