From: Alexis Laferrière Date: Fri, 2 Jan 2015 20:51:34 +0000 (-0500) Subject: lib/glesv2: intro `blend_func` and `depth_func` X-Git-Tag: v0.7.1~55^2~3 X-Git-Url: http://nitlanguage.org lib/glesv2: intro `blend_func` and `depth_func` Signed-off-by: Alexis Laferrière --- diff --git a/lib/glesv2/glesv2.nit b/lib/glesv2/glesv2.nit index 3e6ad1b..f7a2e64 100644 --- a/lib/glesv2/glesv2.nit +++ b/lib/glesv2/glesv2.nit @@ -492,6 +492,22 @@ class GLES # Specify the width of rasterized lines fun line_width(width: Float) `{ glLineWidth(width); `} + # Set the pixel arithmetic for the blending operations + # + # Defaultvalues before assignation: + # * `src_factor`: `GLBlendFactor::one` + # * `dst_factor`: `GLBlendFactor::zero` + fun blend_func(src_factor, dst_factor: GLBlendFactor) `{ + glBlendFunc(src_factor, dst_factor); + `} + + # Specify the value used for depth buffer comparisons + # + # Default value is `GLDepthFunc::less` + # + # Foreign: glDepthFunc + fun depth_func(func: GLDepthFunc) `{ glDepthFunc(func); `} + # Set the texture minifying function # # Foreign: glTexParameter with GL_TEXTURE_MIN_FILTER @@ -562,6 +578,47 @@ extern class GLDataType fun is_sampler_cube: Bool `{ return recv == GL_SAMPLER_CUBE; `} end +# Pixel arithmetic for blending operations +# +# Used by `GLES::blend_func` +extern class GLBlendFactor + super GLEnum + + new zero `{ return GL_ZERO; `} + new one `{ return GL_ONE; `} + new src_color `{ return GL_SRC_COLOR; `} + new one_minus_src_color `{ return GL_ONE_MINUS_SRC_COLOR; `} + new dst_color `{ return GL_DST_COLOR; `} + new one_minus_dst_color `{ return GL_ONE_MINUS_DST_COLOR; `} + new src_alpha `{ return GL_SRC_ALPHA; `} + new one_minus_src_alpha `{ return GL_ONE_MINUS_SRC_ALPHA; `} + new dst_alpha `{ return GL_DST_ALPHA; `} + new one_minus_dst_alpha `{ return GL_ONE_MINUS_DST_ALPHA; `} + new constant_color `{ return GL_CONSTANT_COLOR; `} + new one_minus_constant_color `{ return GL_ONE_MINUS_CONSTANT_COLOR; `} + new constant_alpha `{ return GL_CONSTANT_ALPHA; `} + new one_minus_constant_alpha `{ return GL_ONE_MINUS_CONSTANT_ALPHA; `} + + # Used for destination only + new src_alpha_saturate `{ return GL_SRC_ALPHA_SATURATE; `} +end + +# Condition under which a pixel will be drawn +# +# Used by `GLES::depth_func` +extern class GLDepthFunc + super GLEnum + + new never `{ return GL_NEVER; `} + new less `{ return GL_LESS; `} + new equal `{ return GL_EQUAL; `} + new lequal `{ return GL_LEQUAL; `} + new greater `{ return GL_GREATER; `} + new not_equal `{ return GL_NOTEQUAL; `} + new gequal `{ return GL_GEQUAL; `} + new always `{ return GL_ALWAYS; `} +end + # Set of buffers as a bitwise OR mask, used by `GLES::clear` # # ~~~