Skip to content

Commit baa9de1

Browse files
authored
Call Android native renderer while opengl context is still valid (#1504)
1 parent 26024d1 commit baa9de1

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

core/platform/android/java/src/org/axmol/lib/AxmolRenderer.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,19 @@ public void onDrawFrame(final GL10 gl) {
9797
} else {
9898
final long now = System.nanoTime();
9999
final long interval = now - this.mLastTickInNanoSeconds;
100+
101+
/*
102+
* Render time MUST be counted in, or the FPS will slower than appointed.
103+
*/
104+
this.mLastTickInNanoSeconds = now;
105+
AxmolRenderer.nativeRender();
100106

101107
if (interval < AxmolRenderer.sAnimationInterval) {
102108
try {
103109
Thread.sleep((AxmolRenderer.sAnimationInterval - interval) / AxmolRenderer.NANOSECONDSPERMICROSECOND);
104110
} catch (final Exception e) {
105111
}
106112
}
107-
/*
108-
* Render time MUST be counted in, or the FPS will slower than appointed.
109-
*/
110-
this.mLastTickInNanoSeconds = System.nanoTime();
111-
AxmolRenderer.nativeRender();
112113
}
113114
}
114115

0 commit comments

Comments
 (0)