com.jogamp.opengl.util.awt
Class AWTGLPixelBuffer.SingleAWTGLPixelBufferProvider

java.lang.Object
  extended by com.jogamp.opengl.util.awt.AWTGLPixelBuffer.AWTGLPixelBufferProvider
      extended by com.jogamp.opengl.util.awt.AWTGLPixelBuffer.SingleAWTGLPixelBufferProvider
All Implemented Interfaces:
GLPixelBuffer.GLPixelBufferProvider, GLPixelBuffer.SingletonGLPixelBufferProvider
Enclosing class:
AWTGLPixelBuffer

public static class AWTGLPixelBuffer.SingleAWTGLPixelBufferProvider
extends AWTGLPixelBuffer.AWTGLPixelBufferProvider
implements GLPixelBuffer.SingletonGLPixelBufferProvider

Provider for singleton AWTGLPixelBuffer instances.

Provider instance holds the last AWTGLPixelBuffer instance allocated. A new allocation will return same instance, if a new buffer is not required. The latter is true if size are compatible, hence allowRowStride should be enabled, if possible.


Field Summary
 
Fields inherited from class com.jogamp.opengl.util.awt.AWTGLPixelBuffer.AWTGLPixelBufferProvider
allowRowStride
 
Constructor Summary
AWTGLPixelBuffer.SingleAWTGLPixelBufferProvider(boolean allowRowStride)
           
 
Method Summary
 AWTGLPixelBuffer allocate(GL gl, GLPixelBuffer.GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, int minByteSize)
          Allocates a new GLPixelBuffer object.
 AWTGLPixelBuffer getSingleBuffer(GLPixelBuffer.GLPixelAttributes pixelAttributes)
          Return the last allocated AWTGLPixelBuffer w/ GLPixelBuffer.GLPixelAttributes.componentCount.
 AWTGLPixelBuffer initSingleton(int componentCount, int width, int height, int depth, boolean pack)
          Initializes the single AWTGLPixelBuffer w/ a given size, if not yet allocated.
 
Methods inherited from class com.jogamp.opengl.util.awt.AWTGLPixelBuffer.AWTGLPixelBufferProvider
getAttributes
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jogamp.opengl.util.GLPixelBuffer.GLPixelBufferProvider
getAttributes
 

Constructor Detail

AWTGLPixelBuffer.SingleAWTGLPixelBufferProvider

public AWTGLPixelBuffer.SingleAWTGLPixelBufferProvider(boolean allowRowStride)
Parameters:
allowRowStride - If true, allow row-stride, otherwise not. See AWTGLPixelBuffer.requiresNewBuffer(GL, int, int, int).
Method Detail

allocate

public AWTGLPixelBuffer allocate(GL gl,
                                 GLPixelBuffer.GLPixelAttributes pixelAttributes,
                                 int width,
                                 int height,
                                 int depth,
                                 boolean pack,
                                 int minByteSize)
Allocates a new GLPixelBuffer object.

Being called to gather the initial GLPixelBuffer, or a new replacement GLPixelBuffer if GLPixelBuffer.requiresNewBuffer(GL, int, int, int).

The minimum required remaining byte size equals to minByteSize, if > 0, otherwise utilize GLBuffers.sizeof(GL, int[], int, int, int, int, int, boolean) to calculate it.

Returns an array backed IntBuffer of size

width*height*SIZEOF_INT.
 

Returns an array backed IntBuffer of size

width*height*SIZEOF_INT.
 

Specified by:
allocate in interface GLPixelBuffer.GLPixelBufferProvider
Overrides:
allocate in class AWTGLPixelBuffer.AWTGLPixelBufferProvider
Parameters:
gl - the corresponding current GL context object
pixelAttributes - the desired GLPixelBuffer.GLPixelAttributes
width - in pixels
height - in pixels
depth - in pixels
pack - true for read mode GPU -> CPU, otherwise false for write mode CPU -> GPU
minByteSize - if > 0, the pre-calculated minimum byte-size for the resulting buffer, otherwise ignore.

getSingleBuffer

public AWTGLPixelBuffer getSingleBuffer(GLPixelBuffer.GLPixelAttributes pixelAttributes)
Return the last allocated AWTGLPixelBuffer w/ GLPixelBuffer.GLPixelAttributes.componentCount.

Specified by:
getSingleBuffer in interface GLPixelBuffer.SingletonGLPixelBufferProvider

initSingleton

public AWTGLPixelBuffer initSingleton(int componentCount,
                                      int width,
                                      int height,
                                      int depth,
                                      boolean pack)
Initializes the single AWTGLPixelBuffer w/ a given size, if not yet allocated.

Specified by:
initSingleton in interface GLPixelBuffer.SingletonGLPixelBufferProvider
Returns:
the newly initialized single AWTGLPixelBuffer, or null if already allocated.


Copyright 2010 JogAmp Community.