View Full Version : cutting a hole
07-04-2001, 04:31 AM
What would be the easiest way to cut a hole (4 corners, straight edges) in a disc?
I want to use gluDisc to display a Disc that has a hole through which you can see what lies behind...
07-04-2001, 05:51 AM
The absolute easiest way is to use a texture with a transparent hole in it and alpha testing. That works good on a disk with no thickness. The next easiest way to do that is to use the stencil buffer. First draw into the stencil buffer only, a block that is the size of the hole you want. Then enable stencil testing and set the test to skip the stencil pixels and draw your disk into the color buffer only. If your disk has any thickness to it, then you also need to draw the inside of the block that you used to make the hole by reversing the front face orientation, and draw the block. That will draw the walls of the hole. I'm still a little groggy from waking up so there are likely some details I skipped or got wrong.
[This message has been edited by DFrey (edited 07-04-2001).]
07-04-2001, 09:23 PM
Thanks, I will try that.
As the disc should be textured anyway I hope the first method will work...
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.