public abstract class

ZeroMemoryVertexBufferObject

extends Object
implements IVertexBufferObject
java.lang.Object
   ↳ org.andengine.opengl.vbo.ZeroMemoryVertexBufferObject
Known Direct Subclasses

Class Overview

Compared to a HighPerformanceVertexBufferObject or a LowMemoryVertexBufferObject, the ZeroMemoryVertexBufferObject uses no permanent heap memory, at the cost of expensive data buffering (up to 5x slower!) whenever the bufferdata needs to be updated and higher GC activity, due to the temporary ByteBuffer allocations.

Usually a ZeroMemoryVertexBufferObject is preferred to a HighPerformanceVertexBufferObject or a LowMemoryVertexBufferObject when the following conditions are met:

  1. The application is close to run out of memory.
  2. You have very big HighPerformanceVertexBufferObject/LowMemoryVertexBufferObject or an extreme number of small HighPerformanceVertexBufferObject/LowMemoryVertexBufferObjects, where you can't afford to have any of the bufferdata to be kept in heap memory.
  3. The content (color, vertices, texturecoordinates) of the ZeroMemoryVertexBufferObject is changed not often, or even better: never.

(c) Zynga 2011

Summary

[Expand]
Inherited Constants
From interface org.andengine.opengl.vbo.IVertexBufferObject
Fields
protected final boolean mAutoDispose
protected final int mCapacity
protected boolean mDirtyOnHardware
protected boolean mDisposed
protected int mHardwareBufferID
protected final int mUsage
protected final VertexBufferObjectAttributes mVertexBufferObjectAttributes
protected final VertexBufferObjectManager mVertexBufferObjectManager
Public Constructors
ZeroMemoryVertexBufferObject(VertexBufferObjectManager pVertexBufferObjectManager, int pCapacity, VertexBufferObject.DrawType pDrawType, boolean pAutoDispose, VertexBufferObjectAttributes pVertexBufferObjectAttributes)
Public Methods
void bind(GLState pGLState)
void bind(GLState pGLState, ShaderProgram pShaderProgram)
void dispose()
void draw(int pPrimitiveType, int pCount)
void draw(int pPrimitiveType, int pOffset, int pCount)
int getByteCapacity()
int getCapacity()
int getGPUMemoryByteSize()
int getHardwareBufferID()
int getHeapMemoryByteSize()
int getNativeHeapMemoryByteSize()
VertexBufferObjectManager getVertexBufferObjectManager()
boolean isAutoDispose()
boolean isDirtyOnHardware()
boolean isDisposed()
boolean isLoadedToHardware()
void setDirtyOnHardware()
Mark this VertexBufferObject dirty so it gets updated on the hardware.
void setNotLoadedToHardware()
Mark this VertexBufferObject as not not loaded to hardware.
void unbind(GLState pGLState, ShaderProgram pShaderProgram)
void unloadFromHardware(GLState pGLState)
Protected Methods
ByteBuffer aquireByteBuffer()
When a non null ByteBuffer is returned by this function, it is guaranteed that releaseByteBuffer(ByteBuffer) is called.
void finalize()
abstract void onPopulateBufferData(ByteBuffer byteBuffer)
void releaseByteBuffer(ByteBuffer byteBuffer)
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.andengine.opengl.vbo.IVertexBufferObject
From interface org.andengine.util.IDisposable

Fields

protected final boolean mAutoDispose

protected final int mCapacity

protected boolean mDirtyOnHardware

protected boolean mDisposed

protected int mHardwareBufferID

protected final int mUsage

protected final VertexBufferObjectAttributes mVertexBufferObjectAttributes

protected final VertexBufferObjectManager mVertexBufferObjectManager

Public Constructors

public ZeroMemoryVertexBufferObject (VertexBufferObjectManager pVertexBufferObjectManager, int pCapacity, VertexBufferObject.DrawType pDrawType, boolean pAutoDispose, VertexBufferObjectAttributes pVertexBufferObjectAttributes)

Public Methods

public void bind (GLState pGLState)

public void bind (GLState pGLState, ShaderProgram pShaderProgram)

public void dispose ()

public void draw (int pPrimitiveType, int pCount)

public void draw (int pPrimitiveType, int pOffset, int pCount)

public int getByteCapacity ()

public int getCapacity ()

public int getGPUMemoryByteSize ()

public int getHardwareBufferID ()

public int getHeapMemoryByteSize ()

public int getNativeHeapMemoryByteSize ()

public VertexBufferObjectManager getVertexBufferObjectManager ()

public boolean isAutoDispose ()

public boolean isDirtyOnHardware ()

public boolean isDisposed ()

public boolean isLoadedToHardware ()

public void setDirtyOnHardware ()

Mark this VertexBufferObject dirty so it gets updated on the hardware.

public void setNotLoadedToHardware ()

Mark this VertexBufferObject as not not loaded to hardware. It will reload itself to hardware when it gets used again.

public void unbind (GLState pGLState, ShaderProgram pShaderProgram)

public void unloadFromHardware (GLState pGLState)

Protected Methods

protected ByteBuffer aquireByteBuffer ()

When a non null ByteBuffer is returned by this function, it is guaranteed that releaseByteBuffer(ByteBuffer) is called.

Returns

protected void finalize ()

Throws
Throwable

protected abstract void onPopulateBufferData (ByteBuffer byteBuffer)

protected void releaseByteBuffer (ByteBuffer byteBuffer)