The IDLgrPolygon::SetMultiTextureCoord procedure method passes texture coordinates to a shader program when the shader program applies more than one texture to an object. The shader program accesses these texture coordinates by using the GLSL predefined uniform variable gl_MultiTexCoordn, where n corresponds to the Unit parameter in this method. This method is useful when a shader program defined by an IDLgrShader object applies more than a single texture to an object.


Obj->[IDLgrPolygon::]SetMultiTextureCoord, Unit, TexCoord



This scalar numeric value specifies the texture unit. Texture units are used primarily with multi-texturing and allow OpenGL to handle multiple textures and multiple sets of texture coordinates and parameters. This value should be greater than or equal to zero and less than the MAX_VERTEX_TEXTURE_IMAGE_UNITS (for vertex shaders) or MAX_TEXTURE_IMAGE_UNITS (for fragment shaders). These values can be returned by IDLgrWindow::GetDeviceInfo. The behavior is undefined for any other setting.

Unit 0 is used by the TEXTURE_COORD property on IDLgrPolygon. Using unit 0 in this method overrides any texture coordinates specified with the TEXTURE_COORD property. Therefore, the TEXTURE_COORD property can be used instead of this method if Unit is 0.


This data has exactly the same form as the TEXTURE_COORD property. IDL converts and maintains this data as single precision floating point. IDL displays an error message and does not draw the object if the number of texture coordinates provided in this parameter is not the same as the number of vertices in the polygon.

IDL stores the texture coordinates in the instance of the graphic object when the application calls this method for the first time with a given Unit parameter. If the application calls this method again with a Unit number used in a previous call to this method, IDL replaces the corresponding stored texture coordinates with the contents of the TexCoord parameter.

There is no way to remove texture coordinates from an instance of a graphics object. If texture coordinates are associated with a particular texture unit, and the shader program does not reference that unit, the texture coordinates are effectively ignored by the shader program.



Version History



See Also