|
@@ -71,7 +71,7 @@ open class PQImageFilter: PQBaseFilter {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if newImage != nil {
|
|
|
|
|
|
+ if newImage?.cgImage != nil {
|
|
BFLog(message: "提前加载图片。。。。timelineIn : \(String(describing: mSticker?.timelineIn)) timelineOut :\(String(describing: mSticker?.timelineOut)) \(String(describing: mSticker?.locationPath))")
|
|
BFLog(message: "提前加载图片。。。。timelineIn : \(String(describing: mSticker?.timelineIn)) timelineOut :\(String(describing: mSticker?.timelineOut)) \(String(describing: mSticker?.locationPath))")
|
|
|
|
|
|
imageTexture = PQGPUImageTools.setupTexture(image: newImage!.cgImage!)
|
|
imageTexture = PQGPUImageTools.setupTexture(image: newImage!.cgImage!)
|
|
@@ -79,16 +79,17 @@ open class PQImageFilter: PQBaseFilter {
|
|
} else { FilterLog(message: "image filter init error image data is nil!") }
|
|
} else { FilterLog(message: "image filter init error image data is nil!") }
|
|
}
|
|
}
|
|
|
|
|
|
- override public func newFramebufferAvailable(_ framebuffer: Framebuffer, fromSourceIndex: UInt) {
|
|
|
|
- super.newFramebufferAvailable(framebuffer, fromSourceIndex: fromSourceIndex)
|
|
|
|
-
|
|
|
|
- let currTime = CMTimeGetSeconds(CMTime(value: framebuffer.timingStyle.timestamp!.value, timescale: framebuffer.timingStyle.timestamp!.timescale))
|
|
|
|
- if mSticker!.timelineIn != 0, currTime >= mSticker!.timelineIn, currTime <= mSticker!.timelineOut, imageTexture == 0 {
|
|
|
|
- if newImage != nil {
|
|
|
|
-// imageTexture = PQGPUImageTools.setupTexture(image: newImage!.cgImage!)
|
|
|
|
- } else { BFLog(message: "image filter init error image data is nil!") }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+// override public func newFramebufferAvailable(_ framebuffer: Framebuffer, fromSourceIndex: UInt) {
|
|
|
|
+// super.newFramebufferAvailable(framebuffer, fromSourceIndex: fromSourceIndex)
|
|
|
|
+//
|
|
|
|
+//// let currTime = CMTimeGetSeconds(CMTime(value: framebuffer.timingStyle.timestamp!.value, timescale: framebuffer.timingStyle.timestamp!.timescale))
|
|
|
|
+////
|
|
|
|
+//// if mSticker!.timelineIn != 0, currTime >= mSticker!.timelineIn, currTime <= mSticker!.timelineOut, imageTexture == 0 {
|
|
|
|
+//// if newImage != nil {
|
|
|
|
+////// imageTexture = PQGPUImageTools.setupTexture(image: newImage!.cgImage!)
|
|
|
|
+//// } else { BFLog(message: "image filter init error image data is nil!") }
|
|
|
|
+//// }
|
|
|
|
+// }
|
|
|
|
|
|
override open func renderFrame() {
|
|
override open func renderFrame() {
|
|
let inputFramebuffer: Framebuffer = inputFramebuffers[0]!
|
|
let inputFramebuffer: Framebuffer = inputFramebuffers[0]!
|
|
@@ -104,7 +105,7 @@ open class PQImageFilter: PQBaseFilter {
|
|
let textureProperties = InputTextureProperties(textureCoordinates: inputFramebuffer.orientation.rotationNeededForOrientation(.portrait).textureCoordinates(), texture: inputFramebuffer.texture)
|
|
let textureProperties = InputTextureProperties(textureCoordinates: inputFramebuffer.orientation.rotationNeededForOrientation(.portrait).textureCoordinates(), texture: inputFramebuffer.texture)
|
|
|
|
|
|
renderFramebuffer.activateFramebufferForRendering()
|
|
renderFramebuffer.activateFramebufferForRendering()
|
|
- clearFramebufferWithColor(backgroundColor)
|
|
|
|
|
|
+ clearFramebufferWithColor(Color.white)
|
|
renderQuadWithShader(shader, uniformSettings: uniformSettings,
|
|
renderQuadWithShader(shader, uniformSettings: uniformSettings,
|
|
vertexBufferObject: sharedImageProcessingContext.standardImageVBO, inputTextures: [textureProperties])
|
|
vertexBufferObject: sharedImageProcessingContext.standardImageVBO, inputTextures: [textureProperties])
|
|
releaseIncomingFramebuffers()
|
|
releaseIncomingFramebuffers()
|
|
@@ -124,8 +125,8 @@ open class PQImageFilter: PQBaseFilter {
|
|
FilterLog(message: "textureCoordinates is \(textureCoordinates)")
|
|
FilterLog(message: "textureCoordinates is \(textureCoordinates)")
|
|
|
|
|
|
//imageTexture 有可能被析构导致黑屏
|
|
//imageTexture 有可能被析构导致黑屏
|
|
- if(imageTexture == 0){
|
|
|
|
- FilterLog(message: "imageTexture is error !!!!!")
|
|
|
|
|
|
+ if(imageTexture == 0 && newImage?.cgImage != nil){
|
|
|
|
+ FilterLog(message: "imageTexture is error !!!!!重新创建")
|
|
imageTexture = PQGPUImageTools.setupTexture(image: newImage!.cgImage!)
|
|
imageTexture = PQGPUImageTools.setupTexture(image: newImage!.cgImage!)
|
|
}
|
|
}
|
|
|
|
|