cljs-webgl.shaders documentation
create-program
(create-program gl-context & shaders)
Returns a linked shader program composed of the compiled shader objects specified by the `shaders` parameter. Throws an error if the program was not linked successfully. Relevant OpenGL ES reference pages: * [glCreateProgram](http://www.khronos.org/opengles/sdk/docs/man/xhtml/glCreateProgram.xml) * [glAttachShader](http://www.khronos.org/opengles/sdk/docs/man/xhtml/glAttachShader.xml) * [glLinkProgram](http://www.khronos.org/opengles/sdk/docs/man/xhtml/glLinkProgram.xml)
create-shader
(create-shader gl-context type source)
Returns a compiled vertex or fragment shader object (specified by the `type` parameter) for a given `source`. If the shader cannot be compiled successfully, an error is thrown. The valid values for `type` are `cljs-webgl.constants.shader/vertex-shader` and `cljs-webgl.constants.shader/fragment-shader`. Relevant OpenGL ES reference pages: * [glCreateShader](http://www.khronos.org/opengles/sdk/docs/man/xhtml/glCreateShader.xml) * [glShaderSource](http://www.khronos.org/opengles/sdk/docs/man/xhtml/glShaderSource.xml) * [glCompileShader](http://www.khronos.org/opengles/sdk/docs/man/xhtml/glCompileShader.xml)
get-attached-shaders
(get-attached-shaders gl-context program)
Returns a lazy sequence of shader objects attached to a given shader `program`. Relevant OpenGL ES reference pages: * [glGetAttachedShaders](http://www.khronos.org/opengles/sdk/docs/man/xhtml/glGetAttachedShaders.xml)
get-attrib-location
(get-attrib-location gl-context shader-program attrib-name)
Returns the attribute - specified by it's name - location in a given `shader-program`. Relevant OpenGL ES reference pages: * [glGetAttribLocation](http://www.khronos.org/opengles/sdk/docs/man/xhtml/glGetAttribLocation.xml)
get-program-parameter
(get-program-parameter gl-context program parameter)
Returns the value of a given `parameter` in a `program` object. Valid values for `parameter` are `cljs-webgl.constants.shader/validate-status`, `cljs-webgl.constants.shader/link-status` and `cljs-webgl.constants.shader/delete-status`. Relevant OpenGL ES reference pages: * [glGetProgramiv (similar to getProgramParameter)](http://www.khronos.org/opengles/sdk/docs/man/xhtml/glGetProgramiv.xml)
get-shader
(get-shader gl-context script-id)
Returns a compiled vertext or fragment shader, loaded from the script-id
get-shader-info-log
(get-shader-info-log gl-context shader)
Returns the information log for a given `shader` object. Useful for checking for compile errors. Relevant OpenGL ES reference pages: * [glGetShaderInfoLog](http://www.khronos.org/opengles/sdk/docs/man/xhtml/glGetShaderInfoLog.xml)
get-shader-parameter
(get-shader-parameter gl-context shader parameter)
Returns the value of a given `parameter` in a `shader` object. Valid values for `parameter` are `cljs-webgl.constants.shader/shader-type`, `cljs-webgl.constants.shader/compile-status` and `cljs-webgl.constants.shader/delete-status`. Relevant OpenGL ES reference pages: * [glGetShaderiv(similar to getShaderParameter)](http://www.khronos.org/opengles/sdk/docs/man/xhtml/glGetShaderiv.xml)
get-shader-precision-format
(get-shader-precision-format gl-context shader-type precision-type)
Returns a map describing the range and precision for the specified `shader-type` and `precision-type`. The returned map has the following form: {:range-min :range-max :precision} Valid values for `shader-type` are `cljs-webgl.constants.shader/fragment-shader` and `cljs-webgl.constants.shader/vertex-shader`. Valid values for `precision type` are `cljs-webgl.constants.shader-precision-specified-types/low-float`, `cljs-webgl.constants.shader-precision-specified-types/medium-float`, `cljs-webgl.constants.shader-precision-specified-types/high-float`, `cljs-webgl.constants.shader-precision-specified-types/low-int`, `cljs-webgl.constants.shader-precision-specified-types/medium-int` and `cljs-webgl.constants.shader-precision-specified-types/high-int` Relevant OpenGL ES reference pages: * [glGetShaderPrecisionFormat](http://www.khronos.org/opengles/sdk/docs/man/xhtml/glGetShaderPrecisionFormat.xml)
get-shader-source
(get-shader-source gl-context shader)
Returns the source code for a given `shader` object. Relevant OpenGL ES reference pages: * [glGetShaderSource](http://www.khronos.org/opengles/sdk/docs/man/xhtml/glGetShaderSource.xml)
get-uniform-location
(get-uniform-location gl-context shader-program uniform-name)
Returns the uniform - specified by it's name - location in a given `shader-program`. Relevant OpenGL ES reference pages: * [glGetUniformLocation](http://www.khronos.org/opengles/sdk/docs/man/xhtml/glGetUniformLocation.xml)
is-program?
(is-program? gl-context shader-program)
Returns whether a given shader program is valid. Relevant OpenGL ES reference pages: * [glIsProgram](http://www.khronos.org/opengles/sdk/docs/man/xhtml/glIsProgram.xml)
is-shader?
(is-shader? gl-context shader)
Returns whether a given shader object is valid. Relevant OpenGL ES reference pages: * [glIsShader](http://www.khronos.org/opengles/sdk/docs/man/xhtml/glIsShader.xml)