Page 1 of 1

[Unity] TextureSource leads to black image on Android

Posted: 20 Apr 2017, 18:13
by polycular
Hi,
the following setup leads to a problem when setting a texture (video) as Image.Source programmatically
img.Source = new TextureSource(tex);
:

Unity 5.6.0p1
Noesis 2
Android (Problem appears when deployed to an Android device)


An Image becomes black when setting a Texture as Image.Source on Android with Noesis 2
-> the same setup works fine in the Unity Editor
-> it works fine in the Unity Editor AND on the device using Noesis 1.2.6f5


To wrap it up: It only didn't work using Noesis2 on the Android device - We tried different devices and rendered the texture on a cube to check if it's okay.

Re: [Unity] TextureSource leads to black image on Android

Posted: 21 Apr 2017, 18:13
by sfernandez
Hi,

I tested the following sample in android and it worked fine:
<Grid
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Image x:Name="image" Margin="100"/>
</Grid>
using UnityEngine;

public class TestBehavior : MonoBehaviour
{
    void Start ()
    {
        var tex = Resources.Load<Texture2D>("Images/melon1"); // or any other image from your project

        var gui = GetComponent<NoesisView>();
        var image = (Noesis.Image)gui.Content.FindName("image");
        image.Source = new Noesis.TextureSource(tex);
    }
}
Could you please try it? If it works we will add more complexity to see when it starts to fail.

Re: [Unity] TextureSource leads to black image on Android

Posted: 24 Apr 2017, 10:39
by polycular
Hi,

I tested your sample which also leads to a black screen on our test device (Samsung Galaxy Tab 4 7.0 http://www.gsmarena.com/samsung_galaxy_ ... 0-6251.php).
Further I got the following error from the Android log:
04-24 09:18:15.456: E/Unity(4941): (Filename: ./Runtime/GfxDevice/opengles/GfxDeviceGLES.cpp Line: 371)
04-24 09:18:15.466: E/Unity(4941): OPENGL NATIVE PLUG-IN ERROR: GL_INVALID_ENUM: enum argument out of range
It works fine on devices which support OpenGLES 3 (tested it on an ASUS Nexus 7 (2013) and on a Samsung I9505 Galaxy S4).

After some testing I found out it depends on the image import settings if it's completely black on the OpenGLES2 device:

- "Generate Mip Maps" unchecked -> black image
- "Generate Mip Maps" checked -> image distorted and flipped

I uploaded the screenshots and the original image to: https://www.dropbox.com/sh/0hal8rss7sd1 ... sB9Ra?dl=0

Re: [Unity] TextureSource leads to black image on Android

Posted: 25 Apr 2017, 04:03
by jsantos
Does the texture work in Unity without using Noesis? Because, this error seems to indicate that the problem is located in Unity itself. And in fact, we no longer create textures, we reuse the handles created by Unity.
(Filename: ./Runtime/GfxDevice/opengles/GfxDeviceGLES.cpp Line: 371)

Re: [Unity] TextureSource leads to black image on Android

Posted: 25 Apr 2017, 08:30
by polycular
The texture works fine in Unity (and on the OpenGLES2 device), I tried the texture as Sprite as well as setting the texture in code:
Cube.GetComponent<Renderer>().material.mainTexture = tex;

Seems the error message I posted isn't directly related to this issue.

Re: [Unity] TextureSource leads to black image on Android

Posted: 25 Apr 2017, 20:44
by jsantos
Could you create a ticket so that we can send you a debug version of Noesis? (you already created #0001060 but this seems a different problem although probably related).

Re: [Unity] TextureSource leads to black image on Android

Posted: 26 Apr 2017, 14:54
by polycular
Issue created (https://bugs.noesisengine.com/view.php?id=1062) if someone wants to track the progress.