Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gl-react-native-v2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Jira
Jira
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ym
gl-react-native-v2
Commits
424c7cf2
Commit
424c7cf2
authored
Sep 24, 2015
by
Gaëtan Renaudeau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add opacity tests
parent
3fa270ed
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
113 additions
and
19 deletions
+113
-19
Examples/Tests/Copy.js
Examples/Tests/Copy.js
+32
-0
Examples/Tests/Layer.js
Examples/Tests/Layer.js
+2
-1
Examples/Tests/NativeLayer.js
Examples/Tests/NativeLayer.js
+19
-0
Examples/Tests/index.ios.js
Examples/Tests/index.ios.js
+60
-18
No files found.
Examples/Tests/Copy.js
0 → 100644
View file @
424c7cf2
const
React
=
require
(
"
react-native
"
);
const
GL
=
require
(
"
gl-react-native
"
);
const
shaders
=
GL
.
Shaders
.
create
({
Copy
:
{
frag
:
`
precision highp float;
varying vec2 uv;
uniform sampler2D t;
void main () {
gl_FragColor = texture2D(t, uv);
}
`
}
});
class
Copy
extends
GL
.
Component
{
render
()
{
const
{
width
,
height
,
children
:
t
,
...
rest
}
=
this
.
props
;
return
<
GL
.
View
{...
rest
}
shader
=
{
shaders
.
Copy
}
width
=
{
width
}
height
=
{
height
}
uniforms
=
{{
t
}}
/>
;
}
}
module
.
exports
=
Copy
;
Examples/Tests/Layer.js
View file @
424c7cf2
...
...
@@ -21,10 +21,11 @@ void main () {
class
Layer
extends
GL
.
Component
{
render
()
{
const
{
width
,
height
,
children
}
=
this
.
props
;
const
{
width
,
height
,
children
,
...
rest
}
=
this
.
props
;
if
(
!
children
||
children
.
length
!==
2
)
throw
new
Error
(
"
You must provide 2 children to Layer
"
);
const
[
t1
,
t2
]
=
children
;
return
<
GL
.
View
{...
rest
}
shader
=
{
shaders
.
layer
}
width
=
{
width
}
height
=
{
height
}
...
...
Examples/Tests/NativeLayer.js
0 → 100644
View file @
424c7cf2
const
React
=
require
(
"
react-native
"
);
const
{
View
}
=
React
;
class
NativeLayer
extends
React
.
Component
{
render
()
{
const
{
width
,
height
,
children
,
...
rest
}
=
this
.
props
;
return
<
View
style
=
{{
width
,
height
,
position
:
"
relative
"
}}
>
{
React
.
Children
.
map
(
children
,
child
=>
<
View
style
=
{{
width
,
height
,
position
:
"
absolute
"
,
top
:
0
,
left
:
0
,
backgroundColor
:
"
transparent
"
}}
>
{
child
}
<
/View
>
)}
<
/View>
;
}
}
module
.
exports
=
NativeLayer
;
Examples/Tests/index.ios.js
View file @
424c7cf2
...
...
@@ -3,14 +3,18 @@ const {
AppRegistry
,
Text
,
View
,
ScrollView
,
Image
,
}
=
React
;
const
Blur
=
require
(
"
./Blur
"
);
const
Add
=
require
(
"
./Add
"
);
const
Multiply
=
require
(
"
./Multiply
"
);
const
Layer
=
require
(
"
./Layer
"
);
const
NativeLayer
=
require
(
"
./NativeLayer
"
);
const
HelloGL
=
require
(
"
./HelloGL
"
);
const
Display2
=
require
(
"
./Display2
"
);
const
Copy
=
require
(
"
./Copy
"
);
const
{
width
:
viewportW
,
height
:
viewportH
}
=
require
(
"
Dimensions
"
).
get
(
"
window
"
);
class
Tests
extends
React
.
Component
{
...
...
@@ -27,6 +31,9 @@ class Tests extends React.Component {
console
.
log
(
"
PROGRESS
"
,
progress
,
loaded
,
total
);
}
render
()
{
const
debugSize
=
viewportW
/
2
;
const
helloGL
=
<
HelloGL
width
=
{
64
}
height
=
{
64
}
/>
;
...
...
@@ -59,9 +66,8 @@ class Tests extends React.Component {
{
txt
}
<
/Layer>
;
return
<
View
style
=
{{
backgroundColor
:
"
#000
"
}}
>
<
Display2
width
=
{
viewportW
}
height
=
{
viewportH
}
vertical
preload
onLoad
=
{
this
.
onLoad
}
onProgress
=
{
this
.
onProgress
}
>
<
Display2
width
=
{
viewportW
}
height
=
{
viewportH
/
2
}
>
return
<
ScrollView
style
=
{{
backgroundColor
:
"
#000
"
}}
>
<
Display2
width
=
{
viewportW
}
height
=
{
viewportW
}
preload
onLoad
=
{
this
.
onLoad
}
onProgress
=
{
this
.
onProgress
}
>
<
Add
width
=
{
viewportW
/
2
}
height
=
{
viewportH
/
2
}
>
{
txt
}
{
helloGL
}
...
...
@@ -76,9 +82,45 @@ class Tests extends React.Component {
{
blurredImage
}
<
/Display2
>
<
/Display2
>
{
txt
}
<
/Display2
>
<
/View>
;
<
View
style
=
{{
flexDirection
:
"
row
"
,
flexWrap
:
"
wrap
"
}}
>
<
NativeLayer
width
=
{
debugSize
}
height
=
{
debugSize
}
>
<
Image
source
=
{{
uri
:
"
http://i.imgur.com/S22HNaU.png
"
}}
width
=
{
debugSize
}
height
=
{
debugSize
}
/
>
<
Image
source
=
{{
uri
:
"
http://i.imgur.com/mp79p5T.png
"
}}
width
=
{
debugSize
}
height
=
{
debugSize
}
/
>
<
/NativeLayer
>
<
NativeLayer
width
=
{
debugSize
}
height
=
{
debugSize
}
>
<
Copy
width
=
{
debugSize
}
height
=
{
debugSize
}
>
http
:
//i.imgur.com/S22HNaU.png
<
/Copy
>
<
Image
source
=
{{
uri
:
"
http://i.imgur.com/mp79p5T.png
"
}}
width
=
{
debugSize
}
height
=
{
debugSize
}
/
>
<
/NativeLayer
>
<
NativeLayer
width
=
{
debugSize
}
height
=
{
debugSize
}
>
<
Image
source
=
{{
uri
:
"
http://i.imgur.com/S22HNaU.png
"
}}
width
=
{
debugSize
}
height
=
{
debugSize
}
/
>
<
Copy
width
=
{
debugSize
}
height
=
{
debugSize
}
opaque
=
{
false
}
>
http
:
//i.imgur.com/mp79p5T.png
<
/Copy
>
<
/NativeLayer
>
<
NativeLayer
width
=
{
debugSize
}
height
=
{
debugSize
}
>
<
Copy
width
=
{
debugSize
}
height
=
{
debugSize
}
>
http
:
//i.imgur.com/S22HNaU.png
<
/Copy
>
<
Copy
width
=
{
debugSize
}
height
=
{
debugSize
}
opaque
=
{
false
}
>
http
:
//i.imgur.com/mp79p5T.png
<
/Copy
>
<
/NativeLayer
>
<
Layer
width
=
{
debugSize
}
height
=
{
debugSize
}
>
{
"
http://i.imgur.com/S22HNaU.png
"
}
{
"
http://i.imgur.com/mp79p5T.png
"
}
<
/Layer
>
<
/View
>
<
/ScrollView>
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment