Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## codeanticode.glgraphics
Class GLTexturePingPong

    java.lang.Object
      codeanticode.glgraphics.GLTexturePingPong

    public class GLTexturePingPong

extends java.lang.Object

This class encapsulates two GLTextures, that are labeled as read and write. The role of each texture is swaped upon calling the swap function. This class is intended to simplify the code in GP-GPU applications, where there is the need to apply iterative operations on textures holding float data that represents coordinates or velocities of particles, etc. This technique of alternatively swaping the textures to allow for read/write operations is called "Ping-Pong".

Constructor Summary
`GLTexturePingPong(GLTexture tex0, GLTexture tex1)` The constructor of the class.

Method Summary
`GLTexture` | `getNewTex()` Returns the current write texture.
`GLTexture` | `getOldTex()` Returns the current read texture.
`GLTexture` | `getReadTex()` Returns the current read texture.
`GLTexture` | `getWriteTex()` Returns the current write texture.
`void` | `init()` Inits the read and write indices.
`void` | `setNewTex(int idx)` Sets the value for the write texture.
`void` | `setOldTex(int idx)` Sets the value for the read texture.
`void` | `setReadTex(int idx)` Sets the value for the read texture.
`void` | `setWriteTex(int idx)` Sets the value for the write texture.
`void` | `swap()` Swaps the two textures, read becomes write and viceversa.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### GLTexturePingPong

    public GLTexturePingPong(GLTexture tex0,
                             GLTexture tex1)

  The constructor of the class. Sets the two textures to use.

  Parameters:
    `tex0` - GLTexture
    `tex1` - GLTexture

Method Detail

### getReadTex

    public GLTexture getReadTex()

  Returns the current read texture.

  Returns:
    GLTexture

### setReadTex

    public void setReadTex(int idx)

  Sets the value for the read texture.

  Parameters:
    `idx` - int

### getWriteTex

    public GLTexture getWriteTex()

  Returns the current write texture.

  Returns:
    GLTexture

### setWriteTex

    public void setWriteTex(int idx)

  Sets the value for the write texture.

  Parameters:
    `idx` - int

### getOldTex

    public GLTexture getOldTex()

  Returns the current read texture.

  Returns:
    GLTexture

### setOldTex

    public void setOldTex(int idx)

  Sets the value for the read texture.

  Parameters:
    `idx` - int

### getNewTex

    public GLTexture getNewTex()

  Returns the current write texture.

  Returns:
    GLTexture

### setNewTex

    public void setNewTex(int idx)

  Sets the value for the write texture.

  Parameters:
    `idx` - int

### init

    public void init()

  Inits the read and write indices.

### swap

    public void swap()

  Swaps the two textures, read becomes write and viceversa.

Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

processing library GLGraphics by Andres Colubri. (c) 2008