Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having issues with dynamic textures #14

Open
oortlieb opened this issue Mar 10, 2020 · 4 comments
Open

Having issues with dynamic textures #14

oortlieb opened this issue Mar 10, 2020 · 4 comments

Comments

@oortlieb
Copy link

oortlieb commented Mar 10, 2020

Relevant versions:
elixir 1.10.0-otp-22
erlang 22.0.7
scenic 0.10.2
scenic_driver_nerves_rpi 0.10.1
nerves 1.5.4
nerves_system_rpi3 1.10.2

I'm trying to show a full-screen photo using a dynamic texture. On my dev machine, everything works fine -- a window pops open, and my photo is there. When I run the program on my Pi devices (3, Zero), the screen stays black even as the logs indicate that the program is running normally.

I have a small example that demonstrates the problem. When run on my dev machine, the function below updates the window to a random color when the process receives this message. When I run it on a Raspberry Pi device, it looks like everything is running normally, but the screen remains black.

  def handle_info(:update, state) do
    width = 400
    height = 600
    texture = Scenic.Utilities.Texture.build!(:rgba, width, height)
    color = Enum.random([:red, :green, :blue, :yellow, :orange])

    0..height-1 |> Enum.each fn row ->
      0..width-1 |> Enum.each fn col ->
        texture |>
          Scenic.Utilities.Texture.put!(col, row, color)
      end
    end

    { :ok, hash } = Scenic.Cache.Dynamic.Texture.put("hash", texture)

    graph = Graph.build() |> rectangle({ width, height }, fill: { :dynamic, hash })

    { :noreply, state, push: graph }
  end

I've tried to use Scenic.Cache.Dynamic.Texture.subscribe to maybe receive more information from the cache, but haven't been able to get that to work. Otherwise, I'm currently stumped!

@sandromehic
Copy link

I can confirm the issue. I have the following version, and am using a custom nerves system done by me (everything else works). Trying to render anything dynamic gives just black texture.

elixir 1.10.2-otp-22
erlang 22.2.8
scenic 0.10
scenic_driver_nerves_rpi 0.10
nerves 1.6.0

I can try and help with the issue, but I would need some indication as to where to look.

@oortlieb
Copy link
Author

I've only spent a little bit of time trying to debug the issue, and haven't made much progress so far. In my most recent debugging session, I looked for issues on the elixir side of things -- I added some log statements to lib/rpi/port.ex and lib/rpi/cache.ex to see if I could find anything abnormal. I was unable to uncover any issues.

I was going to attempt to get into the c_src directory next, but I'm not exactly sure how to go about debugging at that level (this is my first project using elixir/nerves).

@Hanspagh
Copy link

Did you ever manage to get this to work? I am having the same problem now.

@boydm
Copy link
Owner

boydm commented Apr 15, 2021

I am reworking the dynamic textures code now as part of v.11 (It's the last big work item), although I haven't brought the RPI I driver over yet. I think this will go away, but lets make sure to check when the new version arrives. I'll do a beta version before properly publishing it. It will need a bunch of docs work before it is ready, but I want to get the new code out sooner than later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants