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
38d45165
Commit
38d45165
authored
Dec 28, 2015
by
Gaëtan Renaudeau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renderData set back to nil when data changes
Attempt to fix #38
parent
b8c60b78
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
9 deletions
+15
-9
android/src/main/java/com/projectseptember/RNGL/GLCanvas.java
...oid/src/main/java/com/projectseptember/RNGL/GLCanvas.java
+9
-6
ios/GLCanvas.m
ios/GLCanvas.m
+6
-3
No files found.
android/src/main/java/com/projectseptember/RNGL/GLCanvas.java
View file @
38d45165
...
@@ -206,6 +206,7 @@ public class GLCanvas extends GLSurfaceView
...
@@ -206,6 +206,7 @@ public class GLCanvas extends GLSurfaceView
public
void
setData
(
GLData
data
)
{
public
void
setData
(
GLData
data
)
{
this
.
data
=
data
;
this
.
data
=
data
;
renderData
=
null
;
if
(!
haveRemainingToPreload
())
syncContentBitmaps
();
if
(!
haveRemainingToPreload
())
syncContentBitmaps
();
requestSyncData
();
requestSyncData
();
}
}
...
@@ -586,13 +587,13 @@ public class GLCanvas extends GLSurfaceView
...
@@ -586,13 +587,13 @@ public class GLCanvas extends GLSurfaceView
private
boolean
syncData
()
{
private
boolean
syncData
()
{
if
(
data
==
null
)
return
true
;
if
(
data
==
null
)
return
true
;
HashMap
<
Uri
,
GLImage
>
i
mages
=
new
HashMap
<>();
HashMap
<
Uri
,
GLImage
>
newI
mages
=
new
HashMap
<>();
GLRenderData
node
=
recSyncData
(
data
,
i
mages
);
GLRenderData
node
=
recSyncData
(
data
,
newI
mages
);
if
(
node
==
null
)
return
false
;
if
(
node
==
null
)
return
false
;
Set
<
Uri
>
imagesGone
=
diff
(
this
.
images
.
keySet
(),
images
.
keySet
());
Set
<
Uri
>
imagesGone
=
diff
(
this
.
images
.
keySet
(),
images
.
keySet
());
images
=
newImages
;
preloaded
.
removeAll
(
imagesGone
);
renderData
=
node
;
renderData
=
node
;
this
.
images
=
images
;
this
.
preloaded
.
removeAll
(
imagesGone
);
return
true
;
return
true
;
}
}
...
@@ -647,16 +648,18 @@ public class GLCanvas extends GLSurfaceView
...
@@ -647,16 +648,18 @@ public class GLCanvas extends GLSurfaceView
}
}
private
void
render
()
{
private
void
render
()
{
if
(
renderData
==
null
)
return
;
GLRenderData
rd
=
renderData
;
if
(
rd
==
null
)
return
;
syncContentTextures
();
syncContentTextures
();
int
[]
defaultFBOArr
=
new
int
[
1
];
int
[]
defaultFBOArr
=
new
int
[
1
];
glGetIntegerv
(
GL_FRAMEBUFFER_BINDING
,
defaultFBOArr
,
0
);
glGetIntegerv
(
GL_FRAMEBUFFER_BINDING
,
defaultFBOArr
,
0
);
defaultFBO
=
defaultFBOArr
[
0
];
defaultFBO
=
defaultFBOArr
[
0
];
glEnable
(
GL_BLEND
);
glEnable
(
GL_BLEND
);
recRender
(
r
enderData
);
recRender
(
r
d
);
glDisable
(
GL_BLEND
);
glDisable
(
GL_BLEND
);
glBindFramebuffer
(
GL_FRAMEBUFFER
,
defaultFBO
);
glBindFramebuffer
(
GL_FRAMEBUFFER
,
defaultFBO
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
0
);
if
(
dirtyOnLoad
&&
!
haveRemainingToPreload
())
{
if
(
dirtyOnLoad
&&
!
haveRemainingToPreload
())
{
dirtyOnLoad
=
false
;
dirtyOnLoad
=
false
;
...
...
ios/GLCanvas.m
View file @
38d45165
...
@@ -138,6 +138,7 @@ RCT_NOT_IMPLEMENTED(-init)
...
@@ -138,6 +138,7 @@ RCT_NOT_IMPLEMENTED(-init)
-
(
void
)
setData
:(
GLData
*
)
data
-
(
void
)
setData
:(
GLData
*
)
data
{
{
_data
=
data
;
_data
=
data
;
_renderData
=
nil
;
[
self
requestSyncData
];
[
self
requestSyncData
];
}
}
...
@@ -375,7 +376,8 @@ RCT_NOT_IMPLEMENTED(-init)
...
@@ -375,7 +376,8 @@ RCT_NOT_IMPLEMENTED(-init)
-
(
void
)
render
-
(
void
)
render
{
{
if
(
!
_renderData
)
return
;
GLRenderData
*
rd
=
_renderData
;
if
(
!
rd
)
return
;
CGFloat
scale
=
RCTScreenScale
();
CGFloat
scale
=
RCTScreenScale
();
...
@@ -426,9 +428,10 @@ RCT_NOT_IMPLEMENTED(-init)
...
@@ -426,9 +428,10 @@ RCT_NOT_IMPLEMENTED(-init)
glGetIntegerv
(
GL_FRAMEBUFFER_BINDING
,
&
defaultFBO
);
glGetIntegerv
(
GL_FRAMEBUFFER_BINDING
,
&
defaultFBO
);
glEnable
(
GL_BLEND
);
glEnable
(
GL_BLEND
);
recDraw
(
_renderData
);
recDraw
(
rd
);
glDisable
(
GL_BLEND
);
glDisable
(
GL_BLEND
);
glBindFramebuffer
(
GL_FRAMEBUFFER
,
defaultFBO
);
glBindFramebuffer
(
GL_FRAMEBUFFER
,
defaultFBO
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
0
);
if
(
_dirtyOnLoad
&&
!
[
self
haveRemainingToPreload
])
{
if
(
_dirtyOnLoad
&&
!
[
self
haveRemainingToPreload
])
{
_dirtyOnLoad
=
false
;
_dirtyOnLoad
=
false
;
...
...
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