# Class VertexAttribute

java.lang.Object
com.codename1.gpu.VertexAttribute

public final class VertexAttribute extends Object
Describes a single attribute (position, normal, texture coordinate, color) within a `VertexFormat`. The engine derives the generated shader's vertex inputs from the attributes present in the format, which is why a fixed set of well known usages is used rather than free form names.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `VertexAttribute.Usage`
  The semantic meaning of a vertex attribute.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `VertexAttribute(VertexAttribute.Usage usage, int components)`
  Creates a float backed attribute.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `getComponents()`
  Returns the number of float components in this attribute.
  `VertexAttribute.Usage`
  `getUsage()`
  Returns the semantic usage of this attribute.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### VertexAttribute

    public VertexAttribute(VertexAttribute.Usage usage, int components)

    Creates a float backed attribute.

    ###### Parameters

    - `usage`: the semantic usage of the attribute

    - `components`: the number of float components (1 to 4)

- ## Method Details

  - ### getUsage

    public VertexAttribute.Usage getUsage()
    Returns the semantic usage of this attribute.

  - ### getComponents

    public int getComponents()
    Returns the number of float components in this attribute.