• Scissor Rect in 3D2D
    2 replies, posted
Is there a way to set a scissor rect local to a 3D2D camera orientation? Example: In the following case I would like the green circle to be clipped so it is only inside the grid rectangle area. [t]http://puu.sh/34MSo.png[/t] If it isn't possible I have an alternative, although it will require a lot of work and would be less efficient.
Stencil should do.
Awesome, thank you! [t]http://puu.sh/357IJ.png[/t] My solution: [code]function GUI:Draw() render.ClearStencil() render.SetStencilEnable(true) render.SetStencilFailOperation(STENCILOPERATION_KEEP) render.SetStencilZFailOperation(STENCILOPERATION_REPLACE) render.SetStencilPassOperation(STENCILOPERATION_REPLACE) render.SetStencilCompareFunction(STENCILCOMPARISONFUNCTION_ALWAYS) render.SetStencilReferenceValue(1) surface.SetDrawColor(Color(0, 0, 0, 255)) surface.DrawRect(self:GetGlobalRect()) render.SetStencilCompareFunction(STENCILCOMPARISONFUNCTION_EQUAL) render.SetStencilPassOperation(STENCILOPERATION_REPLACE) -- Drawing screen stuff render.SetStencilEnable(false) self.Super[BASE].Draw(self) end[/code]
Sorry, you need to Log In to post a reply to this thread.