Method GL.GLSLUtils.GLSLProgram()->add_texture()


Method add_texture

void add_texture(string name, int|object type_or_texture, int|void id)

Description

Adds a texture to the list of textures used by the shader. If this function is used the allocation of texture units is done automatically by this class.

There are really two variants of this function: If type_or_texture is an integer, the id indicates the texture object ID (as given by glGenTextures), and type_or_texture indicates the texture type (GL_TEXTURE_2D etc).

If type_or_texture is an object, it's assumed that there is a texture_type member variable (indicating the texture type, such as GL_TEXTURE_2D) and a use method that will bind the texture to the currently active texture unit.

The GLUE.Texture class meets these requirements. The RenderBuffer objects does not, however.

A RenderBuffer can be added as an texture by calling add_texture( name, buffer->texture_type, buffer->texture )

There are currently no checks done to ensure that you don't use more textures than there are texture units on your graphics card.