Next
This example shows how vertex attributes can be visualized.
Mesh
[
Plane
] [
Disc
] [
Triangle
] [
Cube
] [
UVsphere
]
Shaders:
[
UV1
] [
Normal
] [
Tangent
] [
Color
] [
Black
]
attribute vec3 vertex; attribute vec2 uv1; varying vec3 vColor; void main(void) { gl_Position = vec4(vertex, 1.0); vColor = vec3(uv1.x,uv1.y,0); }
attribute vec3 vertex; attribute vec3 normal; varying vec3 vColor; void main(void) { gl_Position = vec4(vertex, 1.0); vColor = normal*0.5+vec3(.5,.5,.5); }
attribute vec3 vertex; attribute vec4 tangent; varying vec3 vColor; void main(void) { gl_Position = vec4(vertex, 1.0); vColor = tangent.xyz*0.5+vec3(.5,.5,.5); }
attribute vec3 vertex; attribute vec4 color; varying vec3 vColor; void main(void) { gl_Position = vec4(vertex, 1.0); vColor = color.xyz; }
attribute vec3 vertex; varying vec3 vColor; void main(void) { gl_Position = vec4(vertex, 1.0); vColor = vec3(0,0,0); }
#ifdef GL_ES precision highp float; #endif varying vec3 vColor; void main(void) { gl_FragColor = vec4(vColor.x, vColor.y, vColor.z, 1.0); }