SFML community forums

Help => Graphics => Topic started by: Cuban-Pete on July 04, 2011, 07:30:21 pm

Title: CopyScreen y position not working
Post by: Cuban-Pete 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:
Title: CopyScreen y position not working
Post by: Cuban-Pete on July 07, 2011, 06:30:54 pm
Nobody has this problem?  :roll:
Title: CopyScreen y position not working
Post by: Laurent 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?
Title: CopyScreen y position not working
Post by: Cuban-Pete 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?
Title: CopyScreen y position not working
Post by: Laurent on July 07, 2011, 08:43:41 pm
Can you show a complete and minimal code that reproduces the problem?
Title: CopyScreen y position not working
Post by: Cuban-Pete on July 08, 2011, 08:27:36 pm
Yes, here it is: https://legacy.sfmluploads.org/index.php?page=view_code&isparent=yes&id=16
Title: CopyScreen y position not working
Post by: Cuban-Pete 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
Title: CopyScreen y position not working
Post by: Laurent on July 11, 2011, 11:42:39 pm
You were right about inverted coordinates, now it's fixed. Thanks for your feedback :)
Title: CopyScreen y position not working
Post by: Cuban-Pete on July 15, 2011, 04:03:42 pm
Thanks! It works great now!  :D