From 7c92aecee3ed504dfa95fb058e3e55aa40e10973 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Fri, 2 Jan 2015 15:41:29 -0500 Subject: [PATCH] lib/glesv2: intro culling related features MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- lib/glesv2/glesv2.nit | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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); `} -- 1.7.9.5