作者riveranb (River)
看板GameDesign
标题Re: [程式] ABOUT STENCIL BUFFER Question
时间Sun Jul 10 12:21:53 2011
※ 引述《riveranb (River)》之铭言:
: https://picasaweb.google.com/112165426532756160107/StencilQz#5627339704475169794
: -----------------------------------------------------
: // 2d projection
: gluOrtho2D(-Ortho2dRange.x, Ortho2dRange.x, -Ortho2dRange.y, Ortho2dRange.y);
: ....
: ....
: // do polygon tessellation
: // make mask of the polygon tessellation on the stencil buffer
: // draw test quad to find out the area of the stencil mask
: glStencilFunc(GL_EQUAL, 1, 1);
: glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
: glColor3f(1.0, 1.0, 1.0);
: glBegin(GL_QUADS);
: glVertex2i(-Ortho2dRange.x, -Ortho2dRange.y);
: glVertex2i(Ortho2dRange.x, -Ortho2dRange.y);
: glVertex2i(Ortho2dRange.x, Ortho2dRange.y);
: glVertex2i(-Ortho2dRange.x, Ortho2dRange.y);
: glEnd();
: glDisable(GL_STENCIL_TEST);
: -----------------------------------------------------
经过自己一天一夜盲目地debug後,终於发现白痴的问题出在於
glVertex2"i" ←用错函式,传入的符点数自动被转换成整数
double→integer .... 这样最後绘出的QUAD当然要比绘图区小 -__-||
所以STENCIL TEST部份并没有出错 XD
还是请各位高手不吝提出意见..有关如何做复杂形状指标的选取
功能需求定义如下:
User defines one complex shape, and the application select all objects
which are intersected with that shape(or joined in that shape).
使用者定义任一个复杂形状,系统将与该形状有交集的所有物体设定为选取状态.
目前STENCIL确定无误後本人将朝Back Buffer写入Unique Object ID的方向去做,
这样可能会在做check selection时必须做pixel-by-pixel的check,
但目前本人想不出其他好方法 -__-a
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.230.226.62
※ 编辑: riveranb 来自: 61.230.226.62 (07/10 12:22)