Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Possible scissor bug

Author
Message
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 1st Oct 2018 21:37
If you setscissor with then same value in y1 and y2 (and possibly x1 and x2, but haven't checked), I would expect everything to get clipped, but instead nothing gets clipped. This results in some annoying flickering when an animated scissor crosses this y1=y2 threshold. It's possible to fix in code by checking if y1 = y2 before setting the scissor, and then adding a tiny fraction of a pixel to y2, but would be much nicer if everything just got clipped if y1 = y2. Has anyone else had this issue?
Bengismo
6
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 1st Oct 2018 22:24 Edited at: 1st Oct 2018 22:25
If you set the scissor values to ALL be zero then you do get the full screen view as if the scissor isnt set. This is described in the documentation "SetScissor(0,0,0,0) is a special case that will turn off all clipping and make the full screen useable for displaying things. "

However if you set your scissor to be: SetScissor (1,1,1,1) so x1=x2,y1=y2 then you should see nothing and it works as expected on my machine. A black screen is what i see when testing on windows and android at least. I quickly tested both y values being identical and it clips everything.

Id guess you are seeing this issue when the values are all 0?? If not then your getting different results to me.

Do you have some code to demonstrate?
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 2nd Oct 2018 07:58 Edited at: 2nd Oct 2018 08:00
Sounds like we are getting different results in that case. Here's a little demo code and screenshots showing the issue I am experiencing (I get the same on Windows and Android):



In the above code, I'd expect everything to get clipped, but instead I'm seeing the whole sprite:


However, when I increase the y2 value, it clips correctly:



Attachments

Login to view attachments
Bengismo
6
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 2nd Oct 2018 09:00
CJB wrote: "If you setscissor with then same value in y1 and y2 "


In your first post you mentioned using SetScissor() ....so I tested that and it seems to work ok for me at least.
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 2nd Oct 2018 09:55 Edited at: 2nd Oct 2018 18:17
My bad... I meant setspritescissor.

So is this a bug, or is that intended behaviour?
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 3rd Oct 2018 13:53
In the special case of 0,0,0,0, it appears that it applies to either dimension being 0. So in your example with SetSpriteScissor(test_spr,40,50,60,50) the viewable amount on Y-axis is 0. Technically you shouldn't see anything, but I think if either value results in 0 then it triggers the special case. I'd say possible bug or bad behavior.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Bengismo
6
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 3rd Oct 2018 14:51 Edited at: 3rd Oct 2018 14:54
In the C draw functions for the sprites in AGK's source, there is this code



Width and height are just the difference between x1,x2 and y1,y2

...if either width or height is zero then the scissor is reset (it goes full screen).

Id agree that most of us would expect the behavior to be that it should display nothing at all when the width or height of the scissor is zero. Theres no need to even try draw the sprite if width or height is 0 so id say it is a bug. Especially since the fullscreen scissor works differently/correctly.
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 8th Oct 2018 16:24
The special case of x=0 y=0 x2=0 y2=0 will turn off the scissor function, everything else gets passed to the OpenGL driver unchanged, so it must be the driver that is deciding to ignore the 0 size.
Bengismo
6
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 8th Oct 2018 16:28 Edited at: 8th Oct 2018 16:29
Quote: "The special case of x=0 y=0 x2=0 y2=0 will turn off the scissor function, everything else gets passed to the OpenGL driver unchanged, so it must be the driver that is deciding to ignore the 0 size."


Sorry Paul but thats not correct.

The code I posted above is straight from the teir 2 code and it does just check as above....Soif EITHER the X1-X2 OR Y1-Y2 is zero then it resets the sprite scissor before drawing.

Maybe take another look?
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 8th Oct 2018 17:09
You're right, sorry, I was looking at the SetScissor command which passes the values straight through. I've changed the code you found to check all values for 0 to see if there is no scissor.
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 8th Oct 2018 21:03 Edited at: 10th Oct 2018 23:14
Yay! Does that mean it's fixed for next release? Woopwoop! Thanks Paul.

Confirmed! Latest update has fixed the flickering that occurred when a sprite or text scissor crossed the y1=y2 barrier. Thanks Paul! Deep-links is a fantastic addition too! Great update!

Login to post a reply

Server time is: 2024-04-20 07:03:29
Your offset time is: 2024-04-20 07:03:29