Comments (4)
I did some additional experimentation, so far I've asserted that push_graph
is generating the correct graph, it inserts this into ets:
%{
0 => %{
data: {Scenic.Primitive.Group, [1]},
styles: %{clear_color: {255, 255, 255, 255}}
},
1 => %{
data: {Scenic.Primitive.Rectangle, {62, 114}},
id: :parrot,
styles: %{fill: {:image, {"UfHCVlANI2cFbwSpJey64FxjT-0", 0, 0, 0, 0, 0, 4}}},
transforms: %{translate: {319.0, 243.0}}
}
}
But then Scenic.Driver.Glfw.Graph.handle_cast(:update_clear_color, ...)
gets root_group
equal to:
%{data: {Scenic.Primitive.Group, [1]}, transforms: %{}}
Thus falling back to the default clear_color or {0, 0, 0, 255}. I'm not sure where the styles
information is lost just yet.
from scenic.
From my understanding so far, a graph is stored in ETS sometime before push_graph
(the reference ending in 189393 in the logs below), which contains the reference to the graph that actually contains the scene data (the one that ends in 189406 below). When the :update_clear_color
message arrives at the destination, the graph_key
to fetch points to the wrapper graph, which contains no style data.
Log:
SET {:graph, #Reference<0.3473474407.829423617.189393>, nil} => %{0 => %{data: {Scenic.Primitive.Group, [1]}, transforms: %{}}, 1 => %{data: {Scenic.Primitive.SceneRef, {:graph, #Reference<0.3473474407.829423617.189406>, nil}}}}
Sending this to driver: {:cache_put, "UfHCVlANI2cFbwSpJey64FxjT-0"}
pushing: %Scenic.Graph{
add_to: 0,
ids: %{_root_: [0], parrot: [1]},
next_uid: 2,
primitives: %{
0 => %{
__struct__: Scenic.Primitive,
data: [1],
module: Scenic.Primitive.Group,
parent_uid: -1,
styles: %{clear_color: :white}
},
1 => %Scenic.Primitive{
data: {62, 114},
id: :parrot,
module: Scenic.Primitive.Rectangle,
parent_uid: 0,
styles: %{fill: {:image, {"UfHCVlANI2cFbwSpJey64FxjT-0", 0}}},
transforms: %{translate: {319.0, 243.0}}
}
}
}
pushed [true]: %{
0 => %{
data: {Scenic.Primitive.Group, [1]},
styles: %{clear_color: {255, 255, 255, 255}}
},
1 => %{
data: {Scenic.Primitive.Rectangle, {62, 114}},
id: :parrot,
styles: %{fill: {:image, {"UfHCVlANI2cFbwSpJey64FxjT-0", 0, 0, 0, 0, 0, 0}}},
transforms: %{translate: {319.0, 243.0}}
}
}
SET {:graph, #Reference<0.3473474407.829423617.189406>, nil} => %{0 => %{data: {Scenic.Primitive.Group, [1]}, styles: %{clear_color: {255, 255, 255, 255}}}, 1 => %{data: {Scenic.Primitive.Rectangle, {62, 114}}, id: :parrot, styles: %{fill: {:image, {"UfHCVlANI2cFbwSpJey64FxjT-0", 0, 0, 0, 0, 0, 0}}}, transforms: %{translate: {319.0, 243.0}}}}
pushed [true]: %{
0 => %{
data: {Scenic.Primitive.Group, [1]},
styles: %{clear_color: {255, 255, 255, 255}}
},
1 => %{
data: {Scenic.Primitive.Rectangle, {62, 114}},
id: :parrot,
styles: %{fill: {:image, {"UfHCVlANI2cFbwSpJey64FxjT-0", 0, 0, 0, 0, 0, 0}}},
transforms: %{translate: {319.0, 243.0}}
}
}
SET {:graph, #Reference<0.3473474407.829423617.189406>, nil} => %{0 => %{data: {Scenic.Primitive.Group, [1]}, styles: %{clear_color: {255, 255, 255, 255}}}, 1 => %{data: {Scenic.Primitive.Rectangle, {62, 114}}, id: :parrot, styles: %{fill: {:image, {"UfHCVlANI2cFbwSpJey64FxjT-0", 0, 0, 0, 0, 0, 0}}}, transforms: %{translate: {319.0, 243.0}}}}
pushed [true]: %{
0 => %{
data: {Scenic.Primitive.Group, [1]},
styles: %{clear_color: {255, 255, 255, 255}}
},
1 => %{
data: {Scenic.Primitive.Rectangle, {62, 114}},
id: :parrot,
styles: %{fill: {:image, {"UfHCVlANI2cFbwSpJey64FxjT-0", 0, 0, 0, 0, 0, 2}}},
transforms: %{translate: {319.0, 243.0}}
}
}
SET {:graph, #Reference<0.3473474407.829423617.189406>, nil} => %{0 => %{data: {Scenic.Primitive.Group, [1]}, styles: %{clear_color: {255, 255, 255, 255}}}, 1 => %{data: {Scenic.Primitive.Rectangle, {62, 114}}, id: :parrot, styles: %{fill: {:image, {"UfHCVlANI2cFbwSpJey64FxjT-0", 0, 0, 0, 0, 0, 2}}}, transforms: %{translate: {319.0, 243.0}}}}
Sending this to driver: {:set_root, {:graph, #Reference<0.3473474407.829423617.189393>, nil}}
GET {:graph, #Reference<0.3473474407.829423617.189406>, nil} => %{0 => %{data: {Scenic.Primitive.Group, [1]}, styles: %{clear_color: {255, 255, 255, 255}}}, 1 => %{data: {Scenic.Primitive.Rectangle, {62, 114}}, id: :parrot, styles: %{fill: {:image, {"UfHCVlANI2cFbwSpJey64FxjT-0", 0, 0, 0, 0, 0, 2}}}, transforms: %{translate: {319.0, 243.0}}}}
Sending this to driver: :update_clear_color
GET {:graph, #Reference<0.3473474407.829423617.189393>, nil} => %{0 => %{data: {Scenic.Primitive.Group, [1]}, transforms: %{}}, 1 => %{data: {Scenic.Primitive.SceneRef, {:graph, #Reference<0.3473474407.829423617.189406>, nil}}}}
GET {:graph, #Reference<0.3473474407.829423617.189406>, nil} => %{0 => %{data: {Scenic.Primitive.Group, [1]}, styles: %{clear_color: {255, 255, 255, 255}}}, 1 => %{data: {Scenic.Primitive.Rectangle, {62, 114}}, id: :parrot, styles: %{fill: {:image, {"UfHCVlANI2cFbwSpJey64FxjT-0", 0, 0, 0, 0, 0, 2}}}, transforms: %{translate: {319.0, 243.0}}}}
Got update_clear_color:
GET {:graph, #Reference<0.3473474407.829423617.189393>, nil} => %{0 => %{data: {Scenic.Primitive.Group, [1]}, transforms: %{}}, 1 => %{data: {Scenic.Primitive.SceneRef, {:graph, #Reference<0.3473474407.829423617.189406>, nil}}}}
root_group: %{data: {Scenic.Primitive.Group, [1]}, transforms: %{}}
Old clear_color = {0, 0, 0, 255}, New clear_color = {0, 0, 0, 255}
Stack trace: {:current_stacktrace,
[
{Process, :info, 2, [file: 'lib/process.ex', line: 662]},
{Scenic.Driver.Glfw.Graph, :handle_cast, 2,
[file: 'lib/glfw/graph.ex', line: 85]},
{Scenic.Driver.Glfw, :handle_cast, 2, [file: 'lib/glfw.ex', line: 135]},
{Scenic.ViewPort.Driver, :handle_cast, 2,
[file: 'lib/scenic/view_port/driver.ex', line: 198]},
{:gen_server, :try_dispatch, 4, [file: 'gen_server.erl', line: 637]},
{:gen_server, :handle_msg, 6, [file: 'gen_server.erl', line: 711]},
{:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]}
]}
Sending this to driver: :update_clear_color
For reference:
SET key => value -- Insert graph, in ViewPort.Tables
GET key => value -- Get graph, in ViewPort.Tables
Sending this to driver: msg -- Messages unhandled by the viewport that are passed down to the driver
pushing: graph -- Input for `push_graph`
pushed [true]: graph -- Resulting graph from `handle_cast({:push_graph, raw_graph, sub_id, true} ... )`
It seems this issue is more related to scenic_glfw_driver
than scenic
, so I've taken a shot at a straightforward fix.
from scenic.
Wow. Thank you for digging in to this!
from scenic.
I merged your changes in to the glfw driver. Closing this issue.
from scenic.
Related Issues (20)
- v0.11 - no function clause matching in `Scenic.start_link/1` HOT 22
- Lootie Files HOT 2
- Handle a non-configured assets module HOT 2
- Migrate Math module to Elixir's Math module HOT 2
- Video streaming
- Deeply nested groups do not get scissored by the upper most group.
- {r, g, b} in theme throws color error when used in fill with opacity.
- primitives outside of scissor region are not removed from the input list HOT 6
- Starting the app in full screen HOT 2
- `Scene.release_input/2` may not be working HOT 2
- Mouse events for buttons beyond normal 3 do not report uniquely.
- Proposal: embed graph within scene struct HOT 6
- How to use custom fonts HOT 1
- rapid redraws of the graph have tearing HOT 24
- Text paths HOT 1
- ECS Pattern HOT 4
- Further theme work HOT 2
- Window on Linux does not get repainted HOT 1
- Not receiving input HOT 3
- Dependencies not as documented (as far as I can find), additional libraries should be installed (ubuntu) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scenic.