From f2fc9bf0cbbe31a46efe02ada15cd9992360c163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Mon, 8 Feb 2016 11:15:26 +0100 Subject: [PATCH] better example and bugfix --- Examples/Video/index.ios.js | 21 +++++++++++++++++---- ios/GLCanvas.m | 2 +- ios/GLShader.m | 2 +- ios/RNGLContext.m | 2 +- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Examples/Video/index.ios.js b/Examples/Video/index.ios.js index 3244cd2..ffdcf35 100644 --- a/Examples/Video/index.ios.js +++ b/Examples/Video/index.ios.js @@ -3,6 +3,7 @@ const { AppRegistry, StyleSheet, View, + Text, } = React; const Video = require("react-native-video").default; const { @@ -37,20 +38,32 @@ class App extends React.Component { this.state = { blur: 0, blurPasses: 2, - hue: 0 + hue: 0, + mode: 0 }; } render () { - const { blur, hue, blurPasses } = this.state; + const { blur, hue, blurPasses, mode } = this.state; return ( - + - + this.setState({ mode })} name="Content" width={width} /> this.setState({ hue })} name="Hue" width={width} /> this.setState({ blur })} name="Blur" width={width} /> this.setState({ blurPasses })} name="Blur Passes" width={width} /> diff --git a/ios/GLCanvas.m b/ios/GLCanvas.m index 3a7513f..1232b6f 100644 --- a/ios/GLCanvas.m +++ b/ios/GLCanvas.m @@ -342,7 +342,7 @@ RCT_NOT_IMPLEMENTED(-init) imgData = [GLImageData genPixelsWithView:v withPixelRatio:self.contentScaleFactor]; } } - if (imgData) rasterizedContent[i] = imgData; + rasterizedContent[i] = imgData==nil ? [GLImageData empty] : imgData; } _rasterizedContent = rasterizedContent; [self setNeedsDisplay]; diff --git a/ios/GLShader.m b/ios/GLShader.m index 37e5c10..ff5c961 100644 --- a/ios/GLShader.m +++ b/ios/GLShader.m @@ -384,7 +384,7 @@ GLuint compileShader (NSString* shaderName, NSString* shaderString, GLenum shade [self computeMeta]; - pointerLoc = glGetAttribLocation(program, "position"); + pointerLoc = glGetAttribLocation(program, "_p"); glGenBuffers(1, &buffer); glBindBuffer(GL_ARRAY_BUFFER, buffer); diff --git a/ios/RNGLContext.m b/ios/RNGLContext.m index 909aac3..4436592 100644 --- a/ios/RNGLContext.m +++ b/ios/RNGLContext.m @@ -77,7 +77,7 @@ withOnCompile:(RCTResponseSenderBlock)onCompile _shaders[id] = shader; } -static NSString* fullViewportVert = @"attribute vec2 position;varying vec2 uv;void main() {gl_Position = vec4(position,0.0,1.0);uv = vec2(0.5, 0.5) * (position+vec2(1.0, 1.0));}"; +static NSString* fullViewportVert = @"attribute vec2 _p;varying vec2 uv;void main(){gl_Position = vec4(_p,0.,1.);uv=vec2(.5,.5)*(_p+vec2(1.,1.));}"; NSString* glTypeString (int type) { switch (type) { -- 2.26.2