+ # Clear the color buffer to `red`, `green`, `blue` and `alpha`
+ fun clear_color(red, green, blue, alpha: Float) `{
+ glClearColor(red, green, blue, alpha);
+ `}
+
+ # Set the viewport
+ fun viewport(x, y, width, height: Int) `{ glViewport(x, y, width, height); `}
+
+ # Clear the `buffer`
+ fun clear(buffer: GLBuffer) `{ glClear(buffer); `}
+
+ # Last error from OpenGL ES 2.0
+ fun error: GLError `{ return glGetError(); `}
+
+ # Query the boolean value at `key`
+ private fun get_bool(key: Int): Bool `{
+ GLboolean val;
+ glGetBooleanv(key, &val);
+ return val == GL_TRUE;
+ `}
+
+ # Query the floating point value at `key`
+ private fun get_float(key: Int): Float `{
+ GLfloat val;
+ glGetFloatv(key, &val);
+ return val;
+ `}
+
+ # Query the integer value at `key`
+ private fun get_int(key: Int): Int `{
+ GLint val;
+ glGetIntegerv(key, &val);
+ return val;
+ `}
+
+ # Does this driver support shader compilation?
+ #
+ # Should always return `true` in OpenGL ES 2.0 and 3.0.
+ fun shader_compiler: Bool do return get_bool(0x8DFA)
+end