libgdx API

com.badlogic.gdx.graphics
Class VertexAttribute

java.lang.Object
  extended by com.badlogic.gdx.graphics.VertexAttribute

public final class VertexAttribute
extends java.lang.Object

A single vertex attribute defined by its VertexAttributes.Usage, its number of components and its shader alias. The Usage is needed for the fixed function pipeline of OpenGL ES 1.x. Generic attributes are not supported in the fixed function pipeline. The number of components defines how many components the attribute has. The alias defines to which shader attribute this attribute should bind. The alias is used by a Mesh when drawing with a ShaderProgram. The alias can be changed at any time.

Author:
mzechner

Field Summary
 java.lang.String alias
          the alias for the attribute used in a ShaderProgram
 int numComponents
          the number of components this attribute has
 int offset
          the offset of this attribute in bytes, don't change this!
 int usage
          the attribute VertexAttributes.Usage
 
Constructor Summary
VertexAttribute(int usage, int numComponents, java.lang.String alias)
          Constructs a new VertexAttribute.
 
Method Summary
static VertexAttribute Color()
           
static VertexAttribute ColorUnpacked()
           
static VertexAttribute Normal()
           
static VertexAttribute Position()
           
static VertexAttribute TexCoords(int unit)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

usage

public final int usage
the attribute VertexAttributes.Usage


numComponents

public final int numComponents
the number of components this attribute has


offset

public int offset
the offset of this attribute in bytes, don't change this!


alias

public java.lang.String alias
the alias for the attribute used in a ShaderProgram

Constructor Detail

VertexAttribute

public VertexAttribute(int usage,
                       int numComponents,
                       java.lang.String alias)
Constructs a new VertexAttribute.

Parameters:
usage - the usage, used for the fixed function pipeline. Generic attributes are not supported in the fixed function pipeline.
numComponents - the number of components of this attribute, must be between 1 and 4.
alias - the alias used in a shader for this attribute. Can be changed after construction.
Method Detail

Position

public static VertexAttribute Position()

TexCoords

public static VertexAttribute TexCoords(int unit)

Normal

public static VertexAttribute Normal()

Color

public static VertexAttribute Color()

ColorUnpacked

public static VertexAttribute ColorUnpacked()

libgdx API

Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)