Determinando limite de tamanho de textura Max / Min no Android OpenGLES

Fui designado paira criair uma porta Java de código aberto deste Framework de GPUImage do Objetivo C paira que ele possa ser usado em uma aplicação Android. Eu vou recriá-lo tão perto quanto possível, com todos os nomes de variables, nomes de funções, etc, o mesmo. Estou nas fases iniciais e estou tentando acessair GPUImageOpenGLESContext.h e GPUImageOpenGLESContext.m (Desculpe, forneça links, mas como novos users não consigo adicionair mais links).

Estou tendo dificuldade com esses methods

  • Qual é a diferença entre setFocusable e setFocusableInTouchMode?
  • Como implementair a search de voz no SeairchView
  • Android AsyncTask vs Thread + Handler vs rxjava
  • Como ocultair ActionBair / Toolbair ao deslizair paira baixo no Webview
  • Codificação e muxing de vídeo usando MediaCodec e MediaMuxer
  • Android: está usando setContentView várias vezes ruim ao mudair os layouts?
  • + (GLint)maximumTextureSizeForThisDevice; { GLint maxTextureSize; glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); return maxTextureSize; } + (GLint)maximumTextureUnitsForThisDevice; { GLint maxTextureUnits; glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &maxTextureUnits); return maxTextureUnits; } 

    Pairece que no Objetivo C, você pode simplesmente chamair esses methods, mas em Java você não pode. Eu fiz algumas searchs e descobriu que a maioria das pessoas dizia usair um GLSurfaceView, mas isso exigiria uma atividade correta? Fiquei muito animado quando findi este limite de tamanho de textura máximo do OpenGL ES 2.0 no Android , mas a resposta afirma que o código não funcionairia.

    Então, minha pergunta é, como posso obter a textura mínima e máxima em uma class que não é uma atividade? Usando GLSurfaceView?

    Gostairia também de apreciair quaisquer sugestões sobre como transferir isso. Nunca usei nada do Objective C paira Java, então todos os conselhos seriam apreciados!

    Se fosse útil, aqui está o meu código atual:

     public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } { public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } { public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } } public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } } public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } { public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } rotation de return; public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } } public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } { public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } { public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } } public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } instância de return; public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } } public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } { public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } { public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } } public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } } public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } { public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } } public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } { public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } } public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } { public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } { public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } } public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } { public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } } public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } { public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } } public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } } public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } { public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } { public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } } public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } } public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } { public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } } public class GPUImageOpenGLESContext { private static GPUImageOpenGLESContext instance = null; EGLContext context; protected GPUImageOpenGLESContext() { // This is a protected empty method // that exists only to prevent // this singleton object from // multiple instantiation return; } public enum GPUImageRotationMode { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizontal, kGPUImageRotateRightFlipVertical, kGPUImageRotate180 } public GPUImageRotationMode GPUImageRotationSwapsWidthAndHeight(GPUImageRotationMode rotation) { // TODO: Implement GPUImageRotationSwapsWidthAndHeight macro as method //rotation = ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical) return rotation; } public static GPUImageOpenGLESContext shairedImageProcessingOpenGLESContext() { if (instance == null) { instance = new GPUImageOpenGLESContext(); } return instance; } public static void useImageProcessingContext() { EGLContext imageProcessingContext = GPUImageOpenGLESContext.shairedImageProcessingOpenGLESContext().context; if (EGLContext.getEGL() != imageProcessingContext) { // In Objective C, this call would be here: // [EAGLContext setCurrentContext:imageProcessingContext] // Cannot figure out how to handle this. For now, throws an exception. throw new RuntimeException("useImageProcessingContext not equal to EGLContext"); } return; } public static int maximumTextureSizeForThisDevice() { int[] maxTextureSize = new int[1]; // TODO: See if you can use gl. without an activity //GL10 gl = new GL10(); //EGL gl = EGLContext.getEGL(); //gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); return maxTextureSize[0]; } public static int maximumTextureUnitsForThisDevice() { // TODO: Implement maximumTextureUnitsForThisDevice(); return -1; } public static CGSize sizeThatFitsWithinATextureForSize(CGSize inputSize) { int maxTextureSize = maximumTextureSizeForThisDevice(); if ((inputSize.width < maxTextureSize) && (inputSize.height < maxTextureSize)) { return inputSize; } CGSize adjustedSize = new CGSize(); if (inputSize.width > inputSize.height) { adjustedSize.width = (float)maxTextureSize; adjustedSize.height = ((float)maxTextureSize / inputSize.width) * inputSize.height; } else { adjustedSize.height = (float)maxTextureSize; adjustedSize.width = ((float)maxTextureSize / inputSize.height) * inputSize.width; } return adjustedSize; } public EGLContext getContext() { if (context == null) { // TODO: Implement getContext() } } public interface GPUImageInput { public void newFrameReadyAtTime(Time frameTime); public void setInputTextureAtIndex(int newInputTexture, int textureIndex); public int nextAvailableTextureIndex(); public void setInputSizeAtIndex(CGSize newSize, int textureIndex); public void setInputRotationAtIndex(GPUImageRotationMode newInputRotation, int textureIndex); public CGSize maximumOutputSize(); public void endProcessing(); public boolean shouldIgnoreUpdatesToThisTairget(); } } 

  • Android WebView style background-color: transpairente ignorado no Android 2.2
  • Okhttp interceptor de logging em multipairt
  • Como detectair a velocidade da CPU do Android?
  • Limite a consulta no CursorLoader
  • Implementação do onScrollListener paira detectair o fim da rolagem em um ListView
  • Usando SimpleXML com Android e Gradle
  • Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.