update docs

This commit is contained in:
Gaëtan Renaudeau 2015-09-09 15:14:38 +02:00
parent ef5099bf4f
commit 5c6770c8b5
2 changed files with 9 additions and 4 deletions

View File

@ -1,6 +1,10 @@
# GL.Uniform
`GL.Uniform` allows to render a shader with any content. It can be an image, a video, a complex content (including texts and images...) or even another `GL.Component` (which allows to **compose and stack effects**).
`GL.Uniform` is an helper for describing content uniform.
GL.View allows uniform VDOM content: It can be an image, a video, a complex content (including texts and images...) or even another `GL.Component` (which allows to **compose and stack effects**).
> `<GL.Uniform name="foo">{value}</GL.Uniform>` is an alternative syntax to passing `{ foo: value }` in parent `GL.View` uniforms props. It is just more convenient for VDOM uniform value.
**Example:**

View File

@ -60,14 +60,15 @@ render () {
- **`width`** and **`height`** *(Number)* **(required)**: the size of the view.
- **`uniforms`** *(object)*: an object that contains all uniform parameters to send to the shader. The key is the uniform name and the value is whatever value that makes sense for the uniform's type (see below).
- **`opaque`** *(bool)*: specify if the view should be opaque. By default, it is true, meaning that the GL View won't support texture opacity and alpha channel.
- **...any other props** get directly passed to the underlying view.
- **`preload`** *(bool)*: specify if the view should initially not render until all images are loaded. `false` by default, this behavior should be explicitly enabled.
- **...any other props** get directly passed to the underlying view. *(this feature is deprecated and will eventually be removed. Prefer using a container on top for things like events and styles)*
## Uniform types
Here is the correspondance of GLSL and JavaScript types.
Here is the correspondence of GLSL and JavaScript types.
- `int`, `float`, `bool` : Number (e.g: `42`).
- `sampler2D` : either the image URL (String) OR an Object with an `uri` (in React Native, `require("image!id")` is also supported, the format is then exactly like the `source` prop of `React.Image`).
- `sampler2D` : either the image URL (String) OR an Object with an `uri` (in React Native, `require("image!id")` is also supported, the format is then exactly like the `source` prop of `React.Image`). Virtual DOM is also allowed, see [GL.Uniform][Uniform.md] for more information.
- `vecN`,`ivecN`,`bvecN` where N is {2,3,4} : an array of N Number (e.g: `[1, 2, 3.5]` for a `vec3`).
- `matN` : an array of N*N Number.