[Please do not mail me a copy of your followup]
Post by Jens PedersenI need to make some clipping in the images I render.
I see two ways of doing that: ScissorRect and ViewPort
Both of these can restrict rendering to a rectangular region of the
render target, but you can also restrict rendering by rejecting source
pixels with alpha test, depth test and the stencil test.
Post by Jens PedersenWhich one is most efficient?
Efficiency is a performance measurement question. Performance
measurement should be done after you have a working implementation.
There is generally no predefined answer to the question of "which is
more efficient" in graphics because there are too many variables. My
advice is always the same to the efficiency question: implement the
simplest possible thing for your application and then do performance
measurements *if* its too slow. Unless you're really pushing the
limits of the graphics card (or doing something really poorly), you
won't even notice differences in performance.
Post by Jens PedersenAnd what is the difference?
Changing the viewport maps the entire view frustum to the viewport.
Changing the scissor rectangle shows a portion of the view frustum
within the scissor rectangle.
Alpha test, depth test and stencil test are all more involved, but
they act like a scissor test but on non-rectangular regions.
You can see how these interact in the data flow by looking at my
pipeline diagram:
<http://www.xmission.com/~legalize/book/preview/poster/index.html>
I discuss the viewport in Chapter 6. Vertex Transformations:
<http://www.xmission.com/~legalize/book/download/06-Vertex%20Transformations.pdf>
The sample application in my Chapter 7. Viewing and Projection
demonstrates the use of the viewport in showing multiple views of a
single model in a render target:
<http://www.xmission.com/~legalize/book/download/07-Viewing%20and%20Projection.pdf>
The alph, depth and stencil tests are discussed in my chapter 14 on
the Frame Buffer:
<http://www.xmission.com/~legalize/book/download/14-Frame%20Buffer.pdf>
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://www.xmission.com/~legalize/book/download/index.html>
Legalize Adulthood! <http://blogs.xmission.com/legalize/>