Instance Method

handleBindingOfSymbol:usingBlock:

Specifies a block to be called before rendering using programs with the specified GLSL uniform variable or attribute name.

Declaration

- (void)handleBindingOfSymbol:(NSString *)symbol usingBlock:(SCNBindingBlock)block;

Parameters

symbol

A GLSL uniform variable or attribute name used in one of the technique’s shader programs.

block

A block that SceneKit calls.

Discussion

This method associates a block for handling setup of an attribute or uniform variable in the shader programs associated with the technique. SceneKit calls your block before any performing any rendering passes that use that symbol. In the block, you can execute any OpenGL commands or other code necessary for preparing your custom shader.

Use this method when you need to update a value in a shader program every time SceneKit renders a frame. To set a value infrequently, or only once, use the setObject:forKeyedSubscript: or setValue:forKey: method instead.

If you associate a block with a symbol using this method, SceneKit ignores values set using the setObject:forKeyedSubscript: method.

See Also

Handling Parameters for a Technique’s Shader Programs

- setObject:forKeyedSubscript:

Sets a value for the specified shader variable or attribute name, using subscript syntax.

- objectForKeyedSubscript:

Returns the value associated with the specified GLSL uniform variable or attribute name, using subscript syntax.