com.threerings.opengl.renderer
Class BufferObject

java.lang.Object
  extended by com.threerings.opengl.renderer.BufferObject

public class BufferObject
extends Object

An OpenGL buffer object.


Field Summary
protected  int _bytes
          The current size of the buffer, in bytes.
protected  int _id
          The OpenGL identifier for this buffer.
protected  Renderer _renderer
          The renderer that loaded this buffer.
 
Constructor Summary
protected BufferObject()
          Creates an invalid buffer object (used by the renderer to force reapplication).
  BufferObject(Renderer renderer)
          Creates a new buffer object for the specified renderer.
 
Method Summary
 void delete()
          Deletes this buffer object, rendering it unusable.
protected  void finalize()
           
 int getId()
          Returns this buffer's OpenGL identifier.
protected  void setBytes(int bytes)
          Notes the size of the buffer (and notifies the renderer).
 void setData(FloatBuffer data)
          Sets the data in this buffer.
 void setData(FloatBuffer data, int usage)
          Sets the data in this buffer.
 void setData(long size)
          Initializes the data in this buffer.
 void setData(long size, int usage)
          Initializes the data in this buffer.
 void setData(ShortBuffer data)
          Sets the data in this buffer.
 void setData(ShortBuffer data, int usage)
          Sets the data in this buffer.
 void setSubData(long offset, FloatBuffer data)
          Sets part of the data in this buffer.
 void setSubData(long offset, ShortBuffer data)
          Sets part of the data in this buffer.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_renderer

protected Renderer _renderer
The renderer that loaded this buffer.


_id

protected int _id
The OpenGL identifier for this buffer.


_bytes

protected int _bytes
The current size of the buffer, in bytes.

Constructor Detail

BufferObject

public BufferObject(Renderer renderer)
Creates a new buffer object for the specified renderer.


BufferObject

protected BufferObject()
Creates an invalid buffer object (used by the renderer to force reapplication).

Method Detail

getId

public final int getId()
Returns this buffer's OpenGL identifier.


setData

public void setData(long size)
Initializes the data in this buffer.


setData

public void setData(long size,
                    int usage)
Initializes the data in this buffer.


setData

public void setData(FloatBuffer data)
Sets the data in this buffer.


setData

public void setData(FloatBuffer data,
                    int usage)
Sets the data in this buffer.


setData

public void setData(ShortBuffer data)
Sets the data in this buffer.


setData

public void setData(ShortBuffer data,
                    int usage)
Sets the data in this buffer.


setSubData

public void setSubData(long offset,
                       FloatBuffer data)
Sets part of the data in this buffer.


setSubData

public void setSubData(long offset,
                       ShortBuffer data)
Sets part of the data in this buffer.


delete

public void delete()
Deletes this buffer object, rendering it unusable.


finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

setBytes

protected void setBytes(int bytes)
Notes the size of the buffer (and notifies the renderer).