BindChannels

Does anyone know exactly what ‘BindChannels’ does, particularly with regard to the OpenGL state?

This snippet seems to be used frequently…

BindChannels {
	Bind "Vertex", vertex
	Bind "TexCoord", texcoord
	Bind "Color", color
}

Thanks!

Bindchannel is used to tell Unity which geometry stuff goes to which OpenGL data stream…

Basically glVertexPointer

By default, Unity binds Vertex to vertex, mesh Uvs to texcoord, normal to normal. It doesn’t bind color by default at the moment (that is quite hard to get to work correctly once you add in lighting), so that’s why we have to be explicit in those cases.

If you look at shaders that use CG vertex programs (not the source files, the converted code shown in the shader inspector), you’ll see that we use BindChannel to make sure Unity puts mesh data where the vertex program expects it.