From: Alexis Laferrière Date: Fri, 2 Jan 2015 20:41:29 +0000 (-0500) Subject: lib/glesv2: intro culling related features X-Git-Tag: v0.7.1~55^2~7 X-Git-Url: http://nitlanguage.org lib/glesv2: intro culling related features Signed-off-by: Alexis Laferrière --- diff --git a/lib/glesv2/glesv2.nit b/lib/glesv2/glesv2.nit index 670c903..3a49a8f 100644 --- a/lib/glesv2/glesv2.nit +++ b/lib/glesv2/glesv2.nit @@ -375,6 +375,27 @@ class GLES # Set the viewport fun viewport(x, y, width, height: Int) `{ glViewport(x, y, width, height); `} + # Define front- and back-facing polygons + # + # Front-facing polygons are clockwise if `value`, counter-clockwise otherwise. + fun front_face=(value: Bool) `{ glFrontFace(value? GL_CW: GL_CCW); `} + + # Specify whether front- or back-facing polygons can be culled, default is `back` only + # + # One or both of `front` or `back` must be `true`. If you want to deactivate culling + # use `(new GLCap.cull_face).disable`. + # + # Require: `front or back` + fun cull_face(front, back: Bool) + do + assert not (front or back) + cull_face_native(front, back) + end + + private fun cull_face_native(front, back: Bool) `{ + glCullFace(front? back? GL_FRONT_AND_BACK: GL_BACK: GL_FRONT); + `} + # Clear the `buffer` fun clear(buffer: GLBuffer) `{ glClear(buffer); `}