public class DistortedLibrary
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
DistortedLibrary.ExceptionListener
Every application using the library must implement this interface so that the library can send
it exceptions that arise.
|
Modifier and Type | Field and Description |
---|---|
static int |
CLONE_CHILDREN
When creating an instance of a DistortedNode from another instance, clone the children Nodes.
|
static int |
CLONE_FRAGMENT
When creating an instance of a DistortedEffects from another instance, clone the Fragment Effects.
|
static int |
CLONE_MATRIX
When creating an instance of a DistortedEffects from another instance, clone the Matrix Effects.
|
static int |
CLONE_POSTPROCESS
When creating an instance of a DistortedEffects from another instance, clone the PostProcess Effects.
|
static int |
CLONE_SURFACE
When creating an instance of a DistortedTexture from another instance, clone the Bitmap that's
backing up our DistortedTexture.
|
static int |
CLONE_VERTEX
When creating an instance of a DistortedEffects from another instance, clone the Vertex Effects.
|
static int |
WAIT_FOR_FBO_QUEUE_SIZE
When creating a DistortedScreen (which needs to have mFBOQueueSize FBOs attached), pass this
constant for 'numOfFBOs' and the number of backing FBOs will be taken from 'mFBOQueueSize'
(the value of which is most likely unknown at the time of creation of the Screen)
|
Modifier and Type | Method and Description |
---|---|
static int |
getGLSL()
Return OpenGL ES version supported by the hardware we are running on.
|
static int |
getMax(EffectType type)
Returns the maximum number of effects of a given type that can be simultaneously applied to a
single (InputSurface,MeshBase) combo.
|
static int |
getMaxTextureSize()
Return the maximum size of the texture supported by the driver.
|
static void |
needTransformFeedback()
Call this before calling onSurfaceCreated() if you want to access normal vectors in CPU.
|
static void |
onCreate()
Call this so that the Library can initialize its internal data structures.
|
static void |
onCreate(long id)
Call this so that the Library can initialize its internal data structures.
|
static void |
onDestroy()
Call this so that the Library can release its internal data structures.
|
static void |
onDestroy(long id)
Call this so that the Library can release its internal data structures.
|
static void |
onPause()
Call this so that the Library can release the OpenGL related data that needs to be recreated.
|
static void |
onPause(long id)
Call this so that the Library can release the OpenGL related data that needs to be recreated.
|
static void |
onResume()
Call this so that the Library can resume its operations.
|
static void |
onResume(long id)
Call this so that the Library can resume its operations.
|
static void |
onSurfaceCreated(Context context,
DistortedLibrary.ExceptionListener listener)
When OpenGL context gets created, call this method so that the library can initialise its internal data structures.
|
static void |
onSurfaceCreated(Context context,
DistortedLibrary.ExceptionListener listener,
int queueSize)
When OpenGL context gets created, call this method so that the library can initialise its internal data structures.
|
static boolean |
setMax(EffectType type,
int max)
Sets the maximum number of effects that can be stored in a single EffectQueue at one time.
|
public static final int CLONE_SURFACE
This way we can have two DistortedTextures, both backed up by the same Bitmap, to which we can apply different effects. Used in the copy constructor.
public static final int CLONE_MATRIX
This way we can have two different DistortedEffects sharing the MATRIX queue.
public static final int CLONE_VERTEX
This way we can have two different DistortedEffects sharing the VERTEX queue.
public static final int CLONE_FRAGMENT
This way we can have two different DistortedEffects sharing the FRAGMENT queue.
public static final int CLONE_POSTPROCESS
This way we can have two different DistortedEffects sharing the POSTPROCESS queue.
public static final int CLONE_CHILDREN
This is mainly useful for creating many similar sub-trees and rendering then at different places on the screen with (optionally) different Effects.
public static final int WAIT_FOR_FBO_QUEUE_SIZE
public static int getGLSL()
public static void onSurfaceCreated(Context context, DistortedLibrary.ExceptionListener listener)
Needs to be called from a thread holding the OpenGL context.
context
- Context of the App using the library - used to open up Resources and read Shader code.listener
- The library will send all (asynchronous!) exceptions there.public static void onSurfaceCreated(Context context, DistortedLibrary.ExceptionListener listener, int queueSize)
Needs to be called from a thread holding the OpenGL context.
context
- Context of the App using the library - used to open up Resources and read Shader code.listener
- The library will send all (asynchronous!) exceptions there.queueSize
- the size of the FBO queue, a workaround for the bug on Mali drivers. Use a small integer - 1,...,4public static void onCreate()
public static void onCreate(long id)
id
- id of an Activity that is using the library; anything unique so that the Library can
tell between Activities in case you're going to be using it from more than one.public static void onResume()
public static void onResume(long id)
id
- id of an Activity that is using the library; anything unique so that the Library can
tell between Activities in case you're going to be using it from more than one.public static void onPause()
public static void onPause(long id)
id
- id of an Activity that is using the library; anything unique so that the Library can
tell between Activities in case you're going to be using it from more than one.public static void onDestroy()
public static void onDestroy(long id)
id
- id of an Activity that is using the library; anything unique so that the Library can
tell between Activities in case you're going to be using it from more than one.public static int getMaxTextureSize()
public static void needTransformFeedback()
public static int getMax(EffectType type)
type
- EffectType
public static boolean setMax(EffectType type, int max)
onSurfaceCreated(Context, org.distorted.library.main.DistortedLibrary.ExceptionListener)
. After this
time only decreasing the value of 'max' is permitted.
type
- EffectType
max
- new maximum number of simultaneous effects. Has to be a non-negative number not greater
than Byte.MAX_VALUEtrue
if operation was successful, false
otherwise.