com.neovisionaries.android.opengl
Class RenderBuffer

java.lang.Object
  extended by com.neovisionaries.android.opengl.RenderBuffer

public class RenderBuffer
extends Object

OpenGL ES render buffer.

Author:
Takahiko Kawasaki

Constructor Summary
RenderBuffer()
          A constructor.
RenderBuffer(RenderBufferFormat format, int width, int height)
          A constructor with format parameters.
 
Method Summary
 RenderBuffer bind()
          Bind this render buffer using glBindRenderbuffer().
 RenderBuffer delete()
          Delete the render buffer object using glDeleteRenderbuffers().
 int getId()
          Get the ID of the render buffer object assigned to this instance.
 RenderBufferState getState()
          Get the state of this render buffer.
 boolean isBound()
          Check if this render buffer is bound.
 RenderBuffer setFormat(RenderBufferFormat format, int width, int height)
          Set format, width and height of this render buffer using glRenderbufferStorage().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RenderBuffer

public RenderBuffer()
             throws GLESException
A constructor. A render buffer object is assigned internally by glGenRenderbuffers(). If this constructor returns without any exception, the state of this instance is RenderBufferState.CREATED.

Throws:
GLESException - glGenRenderbuffers() failed.
See Also:
glGenRenderbuffers

RenderBuffer

public RenderBuffer(RenderBufferFormat format,
                    int width,
                    int height)
             throws GLESException
A constructor with format parameters. A render buffer is assigned internally by glGenRenderbuffers() and then format parameters are set to the render buffer by glRenderbufferStorage(). If this constructor returns without any exception, the state of this instance is RenderBufferState.CREATED.

This constructor does the same thing as follows.


 new RenderBuffer().setFormat(format, width, height);
 

Parameters:
format -
width -
height -
Throws:
IllegalArgumentException -
  • The argument 'format' is null.
  • The argument 'width' is less than 0 or greater than GL_MAX_RENDERBUFFER_SIZE.
  • The argument 'height' is less than 0 or greater than GL_MAX_RENDERBUFFER_SIZE.
GLESException - glGenRenderbuffers() failed.
See Also:
glGenRenderbuffers
Method Detail

getId

public int getId()
Get the ID of the render buffer object assigned to this instance.

Returns:
The ID of the render buffer object assigned by glGenRenderbuffers().
See Also:
glGenRenderbuffers

getState

public RenderBufferState getState()
Get the state of this render buffer.

Returns:
The current state of this render buffer.

bind

public RenderBuffer bind()
Bind this render buffer using glBindRenderbuffer().

Returns:
This RenderBuffer object.
Throws:
IllegalStateException - This render buffer has already been deleted.
See Also:
glBindRenderbuffer

isBound

public boolean isBound()
Check if this render buffer is bound.

This method returns true if the value returned from GLESState.getRenderbufferBinding() and the value returned from getId() are identical.

Returns:
True if this render buffer is bound.
See Also:
GLESState.getRenderbufferBinding()

delete

public RenderBuffer delete()
Delete the render buffer object using glDeleteRenderbuffers(). If the render buffer object has already been deleted, nothing is executed. After this method returns, the state of this instance is RenderBufferState.DELETED.

Returns:
This RenderBuffer object.
See Also:
glDeleteRenderbuffers

setFormat

public RenderBuffer setFormat(RenderBufferFormat format,
                              int width,
                              int height)
Set format, width and height of this render buffer using glRenderbufferStorage().

If this render buffer is not bound when this method is called, bind() is called before glRenderbufferStorage().

Parameters:
format -
width -
height -
Returns:
This RenderBuffer object.
Throws:
IllegalArgumentException -
  • The argument 'format' is null.
  • The argument 'width' is less than 0 or greater than GL_MAX_RENDERBUFFER_SIZE.
  • The argument 'height' is less than 0 or greater than GL_MAX_RENDERBUFFER_SIZE.
IllegalStateException - This render buffer has already been deleted.
See Also:
glRenderbufferStorage, GLESState.getMaxRenderbufferSize()