Scissor versus viewport & projection
#1
Posted 21 July 2006 - 09:03 AM
Is the scissor test any different from (accordingly) adjusting the viewport and projection matrix? As far as I know all it does is 'clip' the area that is rendered to (like a viewport - with clipping enabled), but without scaling in screen space. But I might be missing something. Is scissoring redundant?
Thanks,
Nick
#2
Posted 21 July 2006 - 10:58 AM
Using scissors is also far more simple than resizing the viewport and adjusting the projection matrix =) But yes, I believe you could achieve the same affect with that approach so long as you don't clear any buffers in the process.
#3
Posted 21 July 2006 - 12:28 PM
TheNut said:
Quote
Anyway, I'd just like to know whether the two are in fact entirely redundant, or whether there is something that can't be done without having both? Or in other words, if an API didn't have scissoring, would it still be fully functional?
Quote
Thanks!
#4
Posted 21 July 2006 - 02:00 PM
you should use glScissor() (and enable GL_SCISSOR_TEST), and then set glViewport() if required.
#5
Posted 21 July 2006 - 02:51 PM
SigKILL said:
you should use glScissor() (and enable GL_SCISSOR_TEST), and then set glViewport() if required.
I just tried this with a Direct3D 'spinning cube' application and it works without trouble.
#6
Posted 21 July 2006 - 04:27 PM
Nick said:
OpenGL only clears the pixels in the viewport, so you can clear smaller areas by setting the viewport appropriately.
#7
Posted 21 July 2006 - 06:27 PM
Reedbeta said:
#8
Posted 21 July 2006 - 06:34 PM
Nick said:
My guess is that it is. But since pixels have to be clipped to the visible window area anyway (so-called 'pixel ownership test'), adding scissor capability is trivially easy for API implementors. It probably just exists to provide a somewhat simpler interface for updating a portion of the screen. It might also be a historical artifact as you mentioned.
#9
Posted 21 July 2006 - 08:02 PM
#10
Posted 21 July 2006 - 08:59 PM
#11
Posted 22 July 2006 - 07:44 AM
#12
Posted 22 July 2006 - 10:04 AM
Goz said:
Quote
Quote
Thanks!
#13
Posted 25 July 2006 - 08:59 AM
Nick said:
It can't under all circumstances ... this was the exact problem i had.
Floating point accuracy is your enemy here. You may be able to use ir for certain things but i was trying to save fill rate in a DX8 app by scissoring the geometry to the light's bounds (A Doom 3 style light renderer). You need to apply the same projection matrix to both (and hence GL or DX9 scissoring is so much better here) to make sure the same Z values are generated for triangles with the same 3D coordinates. Otherwise Z-fighting ensues. Now if we were using fixed point ... ;)
#14
Posted 25 July 2006 - 12:12 PM
Goz said:
That can indeed only be solved with a raster based scissor operation...
Thanks a lot for the information! :worthy:
#15
Posted 25 July 2006 - 12:45 PM
#16
Posted 26 July 2006 - 11:12 AM
Nick said:
Yup thats the one. Glad my terrible explanation made some sense to ya ;)
Its a fairly common matrix case Projection x Viewport produces a different results to Projection x InverseViewportScale x SmallViewport. That extra matrix multiply adds in the, often tiny but significant, error.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












