JAVAFX on ANDROID
Matthias Hänel
haenel at ultramixer.com
Thu Oct 17 08:01:45 PDT 2013
Hi,
I found the reason for the touch crashes on Android. It's a JNI threading error in the
current implementation. We have to enqueue the touch events into the javafx dispatch thread.
There is a workaround for this attached in the java source file at dispatchTouchEvent
and dispatchKeyEvent. What is the best way to propose changes in the future?
regards
Matthias
-------------- next part --------------
Am 15.10.2013 um 13:50 schrieb Matthias Hänel <haenel at ultramixer.com>:
> Hey Tomas,
>
>
> I've seen a check-in for RT-32802. This seems to be your fix. There are a lot of interface changes.
> Could you explain the changes a bit, so I can merge it by hand into my jfx678 code? Today, I merged
> from Stefans b111 JFX78 but it will take a while to get your changes through this way ;)
>
>
> regards
> Matthias
>
>
>
> Am 14.10.2013 um 14:31 schrieb tomas.brandalik <tomas.brandalik at oracle.com>:
>
>> Hi Matthias,
>> cool, I'm surprised you we're able to run it on emulator. I run on device not on emulator for a long time. There wasn't opengl extension GL_EXT_texture_format_BGRA8888 in emulator. But that could have changed overtime.
>> Regarding events: yes there seems to be a problem which I haven't discovered. I've pushed multitouch support and broke touch events on dalvik. I will fix that soon.
>> In order to replace t2k there is freetype library for fonts and glyphs access and harfbuzz for layouting available among system libraries. Although google discourages to use them since they aren't part of public api. It can bring all sorts of compatibility problems (harfbuzz implementation has changed in recent android releases for example). Yes try pango if you have time to spare and share results please.
>>
>> good luck
>> -Tomas
>>
>> On 10/14/2013 01:45 PM, Matthias Hänel wrote:
>>> Hi Tomas,
>>>
>>>
>>> never mind, I found the problem over here in the simulator ;) I had to activate the GPU support.
>>>
>>> So, now I had to BGRA image format for Android and now I get JFX up and running without fonts.
>>>
>>> There are two things missing:
>>> 1. fonts - here we probably need to get pango working for Android right?
>>> 2. touch events - I saw that you have got a special Android proxy for the input stuff Java_com_oracle_dalvik_FXActivity_00024InternalSurfaceView_onTouchEventNative
>>> This seems to crash for some reason. any idea? It's not that complicated but it is producing a stack trace.
>>>
>>> After fixing the touch events Brickbreaker with Niklas' no-font-patch should work. I'd pleased to test this.
>>>
>>>
>>> kind regards
>>> Matthias
>>>
>>>
>>>
>>> Am 14.10.2013 um 12:17 schrieb Matthias Hänel <haenel at ultramixer.com>:
>>>
>>>> Hi Tomas,
>>>>
>>>>
>>>> since Tobi told me he had a similiar problem in the first place with the iOS port and he managed to run JFX8 without font.
>>>> We deactivated fonts. There is some code to deactivate and after that it looks like it is starting the JFX-Application.
>>>>
>>>> 10-14 06:06:49.529: INFO/GLASS(1546): glass_view_drawBegin
>>>> 10-14 06:06:49.529: INFO/javafx(1546): Using getAndroidNativeWindow() from glass.
>>>> 10-14 06:06:49.579: ERROR/libEGL(1546): called unimplemented OpenGL ES API
>>>> 10-14 06:06:49.579: ERROR/libEGL(1546): called unimplemented OpenGL ES API
>>>> 10-14 06:06:49.579: ERROR/libEGL(1546): called unimplemented OpenGL ES API
>>>> 10-14 06:06:49.579: ERROR/libEGL(1546): called unimplemented OpenGL ES API
>>>> 10-14 06:06:49.579: ERROR/javafx(1546): Some video driver error or programming error occurred. Framebuffer object status is invalid. (FBO - 823)
>>>> 10-14 06:06:49.579: ERROR/libEGL(1546): called unimplemented OpenGL ES API
>>>> 10-14 06:06:49.579: ERROR/javafx(1546): Error creating framebuffer object with TexID 1)
>>>> 10-14 06:06:49.599: ERROR/libEGL(1546): called unimplemented OpenGL ES API
>>>> 10-14 06:06:49.649: ERROR/libEGL(1546): called unimplemented OpenGL ES API
>>>> 10-14 06:06:49.649: ERROR/libEGL(1546): called unimplemented OpenGL ES API
>>>> 10-14 06:06:49.649: ERROR/libEGL(1546): called unimplemented OpenGL ES API
>>>> 10-14 06:06:49.649: ERROR/libEGL(1546): called unimplemented OpenGL ES API
>>>> 10-14 06:06:49.649: ERROR/libEGL(1546): called unimplemented OpenGL ES API
>>>> 10-14 06:06:49.649: ERROR/libEGL(1546): called unimplemented OpenGL ES API
>>>> 10-14 06:06:49.659: WARN/System.err(1546): java.lang.reflect.InvocationTargetException
>>>> 10-14 06:06:49.669: WARN/System.err(1546): at java.lang.reflect.Method.invokeNative(Native Method)
>>>> 10-14 06:06:49.669: WARN/System.err(1546): at java.lang.reflect.Method.invoke(Method.java:525)
>>>> 10-14 06:06:49.709: DEBUG/dalvikvm(1546): GC_FOR_ALLOC freed 330K, 10% free 4129K/4564K, paused 32ms, total 32ms
>>>> 10-14 06:06:49.709: WARN/System.err(1546): at com.sun.prism.es2.ES2ResourceFactory.createStockShader(ES2ResourceFactory.java:253)
>>>> 10-14 06:06:49.709: WARN/System.err(1546): at com.sun.prism.impl.ps.BaseShaderContext.getPaintShader(BaseShaderContext.java:227)
>>>> 10-14 06:06:49.709: WARN/System.err(1546): at com.sun.prism.impl.ps.BaseShaderContext.validatePaintOp(BaseShaderContext.java:485)
>>>> 10-14 06:06:49.709: WARN/System.err(1546): at com.sun.prism.impl.ps.BaseShaderContext.validatePaintOp(BaseShaderContext.java:418)
>>>> 10-14 06:06:49.709: WARN/System.err(1546): at com.sun.prism.impl.ps.BaseShaderContext.validatePaintOp(BaseShaderContext.java:351)
>>>> 10-14 06:06:49.709: WARN/System.err(1546): at com.sun.prism.impl.BaseContext.validateClearOp(BaseContext.java:116)
>>>> 10-14 06:06:49.709: WARN/System.err(1546): at com.sun.prism.es2.ES2Graphics.clear(ES2Graphics.java:78)
>>>> 10-14 06:06:49.719: WARN/System.err(1546): at com.sun.javafx.tk.quantum.ViewPainter.doPaint(ViewPainter.java:460)
>>>> 10-14 06:06:49.719: WARN/System.err(1546): at com.sun.javafx.tk.quantum.ViewPainter.paintImpl(ViewPainter.java:331)
>>>> 10-14 06:06:49.719: WARN/System.err(1546): at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:88)
>>>> 10-14 06:06:49.719: WARN/System.err(1546): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
>>>> 10-14 06:06:49.729: WARN/System.err(1546): at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:276)
>>>> 10-14 06:06:49.729: WARN/System.err(1546): at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
>>>> 10-14 06:06:49.729: WARN/System.err(1546): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
>>>> 10-14 06:06:49.729: WARN/System.err(1546): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
>>>> 10-14 06:06:49.729: WARN/System.err(1546): at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:129)
>>>> 10-14 06:06:49.729: WARN/System.err(1546): at java.lang.Thread.run(Thread.java:841)
>>>> 10-14 06:06:49.729: WARN/System.err(1546): Caused by: java.lang.RuntimeException: Error creating vertex shader
>>>> 10-14 06:06:49.740: WARN/System.err(1546): at com.sun.prism.es2.ES2Shader.createFromSource(ES2Shader.java:132)
>>>> 10-14 06:06:49.740: WARN/System.err(1546): at com.sun.prism.es2.ES2Shader.createFromSource(ES2Shader.java:173)
>>>> 10-14 06:06:49.740: WARN/System.err(1546): at com.sun.prism.es2.ES2ResourceFactory.createShader(ES2ResourceFactory.java:168)
>>>> 10-14 06:06:49.749: WARN/System.err(1546): at com.sun.prism.shader.Texture_Color_Loader.loadShader(Texture_Color_Loader.java:47)
>>>> 10-14 06:06:49.749: WARN/System.err(1546): ... 19 more
>>>> 10-14 06:06:49.749: WARN/System.err(1546): java.lang.InternalError: Error loading stock shader Texture_Color
>>>> 10-14 06:06:49.749: WARN/System.err(1546): at com.sun.prism.es2.ES2ResourceFactory.createStockShader(ES2ResourceFactory.java:256)
>>>> 10-14 06:06:49.759: WARN/System.err(1546): at com.sun.prism.impl.ps.BaseShaderContext.getPaintShader(BaseShaderContext.java:227)
>>>> 10-14 06:06:49.759: WARN/System.err(1546): at com.sun.prism.impl.ps.BaseShaderContext.validatePaintOp(BaseShaderContext.java:485)
>>>> 10-14 06:06:49.769: WARN/System.err(1546): at com.sun.prism.impl.ps.BaseShaderContext.validatePaintOp(BaseShaderContext.java:418)
>>>> 10-14 06:06:49.769: WARN/System.err(1546): at com.sun.prism.impl.ps.BaseShaderContext.validatePaintOp(BaseShaderContext.java:351)
>>>> 10-14 06:06:49.769: WARN/System.err(1546): at com.sun.prism.impl.BaseContext.validateClearOp(BaseContext.java:116)
>>>> 10-14 06:06:49.769: WARN/System.err(1546): at com.sun.prism.es2.ES2Graphics.clear(ES2Graphics.java:78)
>>>> 10-14 06:06:49.769: WARN/System.err(1546): at com.sun.javafx.tk.quantum.ViewPainter.doPaint(ViewPainter.java:460)
>>>> 10-14 06:06:49.769: WARN/System.err(1546): at com.sun.javafx.tk.quantum.ViewPainter.paintImpl(ViewPainter.java:331)
>>>> 10-14 06:06:49.779: WARN/System.err(1546): at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:88)
>>>> 10-14 06:06:49.779: WARN/System.err(1546): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
>>>> 10-14 06:06:49.779: WARN/System.err(1546): at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:276)
>>>> 10-14 06:06:49.779: WARN/System.err(1546): at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
>>>> 10-14 06:06:49.779: WARN/System.err(1546): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
>>>> 10-14 06:06:49.779: WARN/System.err(1546): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
>>>> 10-14 06:06:49.779: WARN/System.err(1546): at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:129)
>>>> 10-14 06:06:49.779: WARN/System.err(1546): at java.lang.Thread.run(Thread.java:841)
>>>> 10-14 06:06:49.779: INFO/GLASS(1546): glass_view_drawEnd
>>>>
>>>>
>>>> I track the error down to, compileShader in ES2Shader.java on line 130. This is returning 0 from native code.
>>>> The native codes looks okay for me and the Android Simulator is supposed to emulate OpenGL ES 2.0 correclty, so I am not sure
>>>> why the compileShader returns 0...
>>>>
>>>> int vertexShaderID = glCtx.compileShader(vert, true);
>>>> if (vertexShaderID == 0) {
>>>> throw new RuntimeException("Error creating vertex shader"); //<<--- this Exception occours.
>>>> }
>>>>
>>>> I know this is the common error from the shader compiler, but this should have worked for you,
>>>> when you started your own application. Do you have a hint, what I could have been done wrong?
>>>>
>>>> I assume right now that the native build is correctly, since it is called from java and it does
>>>> return the correct EGLContext. This assumption might be wrong.
>>>>
>>>>
>>>> regards
>>>> Matthias
>>>>
>>>>
>>>>
>>>>
>>>> Am 12.10.2013 um 14:04 schrieb Tomas Brandalik <tomas.brandalik at oracle.com>:
>>>>
>>>>> I think that PlatformLogger initialization in CssHelper was causing problems. I had to write one. Not 100% sure though I will look at it when I'm back in the office. (Or you can comment out css processing in the node.) I was able to run without font then.
>>>>>
>>>>> -Tomas
>>>>>
>>>>>
>>>>> On 10/11/2013 06:22 PM, Tom Schindl wrote:
>>>>>> On 11.10.13 18:10, Matthias Hänel wrote:
>>>>>>> Hi Tomas,
>>>>>>>
>>>>>>>
>>>>>>> today, I took the time to investigate a little more time on this.
>>>>>>>
>>>>>>> 1. I build an entirely new openjfx78 build for android
>>>>>>> 2. starting this gave me several errors that lead me to the
>>>>>>> conclusion that I need a java6 openjfx
>>>>>>> 3. based on openjfx78 I ported it back to java6 (adapted gradled scripts, and tons of java source code)
>>>>>>> 4. Now it's almost running on an 18th android. All libraries are firing up until the CssStyleHelper
>>>>>>> is called with a static call to createStyleHelper.
>>>>>>>
>>>>>>> That looks like the font stuff is not in jfx78. That's why "new Font" returns with null and therefore
>>>>>> On OS-X font stuff is definately there in jfx78, but the low-level font
>>>>>> stuff is loaded using reflection (at least this was the cause on robovm)!
>>>>>>
>>>>>> Tom
>>
>
More information about the openjfx-dev
mailing list