Open bkramer opened 11 years ago
Note that the above will break in many cases, because it isn't wrapped in a proper block on the image processing GCD queue. Also, the OpenGL ES context isn't set before that's enabled.
I've set edge clamping by default because that's the only supported mode for all but power-of-two-sized images, which is the vast majority of what gets fed into the framework. This would only work for a very small class of images, so its appeal would be limited. Still, there might be a way to incorporate this cleanly. Based on my recent slow progress, this might take months to add, though.
I've restructured things a bit so that a bool property can be set during GPUImagePicture initialization. Now GPUImageOutput's initializeOutputTextureIfNeeded will safely set the property GL_REPEAT instead of GL_CLAMP_TO_EDGE for those occasions when I know I am using a repeatable texture that has power of two size.
Thanks for the thread, I wound up adding the following function to GPUImageOutput
-(void)setOutputTextureOptions:(GPUTextureOptions)outputTextureOptions
{
_outputTextureOptions = outputTextureOptions;
if( outputFramebuffer.texture )
{
glBindTexture(GL_TEXTURE_2D, outputFramebuffer.texture);
//_outputTextureOptions.format
//_outputTextureOptions.internalFormat
//_outputTextureOptions.magFilter
//_outputTextureOptions.minFilter
//_outputTextureOptions.type
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, _outputTextureOptions.wrapS);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, _outputTextureOptions.wrapT);
glBindTexture(GL_TEXTURE_2D, 0);
}
}
I have a custom fragment shader that takes 2 inputs: a source image and a texture. Note that the texture is only 128 x 128 (and repeatable) while the source image may be any size.
I need a way to indicate to the GPUImage framework that the texture is repeatable, specifically set the GL_REPEAT property. To proceed I've added the following method to GPUImageOutput.m:
with that method i'm able to load an image with the following code:
perhaps you would consider adding this method (or similar functionality) to the framework?
thanks, -b