From Rehno:
In my game the canvas element is setup up with css to
automatically resize with the screen. However, scenejs has some
slightly strange behaviour. If my scene starts with a regular
"renderer" node then the webgl viewport doesn't appear to change
with the canvas size.
E.g. I have:
sceneNode =
type: "scene"
id: "gameScene"
canvasId: "gameCanvas"
loggingElementId: "scenejsLog"
nodes: [
type: "renderer"
clear:
depth: true
color: true
stencil: false
clearColor: { r: 0.7, g: 0.7, b: 0.7 }
nodes: [ ... ]
]
However, as soon as I add a "geometry" node with at least one
triangle
to the scene graph right above the "renderer" node it all works
out
fine.
E.g.
sceneNode =
type: "scene"
id: "gameScene"
canvasId: "gameCanvas"
loggingElementId: "scenejsLog"
nodes: [
type: "geometry"
resource: "tmp"
primitive: "triangles"
positions: [0.0, 0.0, 0.0]
indices: [0, 1, 2]
,
type: "renderer"
clear:
depth: true
color: true
stencil: false
clearColor: { r: 0.7, g: 0.7, b: 0.7 }
nodes: [ ... ]
]
So I suspect some render state change is causing scenejs to
update the
viewport properly in the second case.
I've been keeping track of the issue in my game here: http://github.com/rehno-lindeque/Gates-of-Olympus/issues#issue/9