看板 GameDesign 關於我們 聯絡資訊
※ 引述《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)