xml3d / xml3d.js

The WebGL/JS implementation of XML3D
Other
75 stars 25 forks source link

Custom RenderTree doesn't work #178

Closed Arsakes closed 8 years ago

Arsakes commented 8 years ago

I'm trying to use RenderInterfaces I've copied the blur code from here Is it suppose to work with current version (non-dev branch)? It doesn't work with either branch.

Using following code:

<script>
  ...here is the code pasted from link I've provided...
</script>

<xml3d id="myXml3dElement">
  <view></view>   
</xml3d>

I get following results:

xml3d.js:29296 TypeError: Cannot read property 'attributes' of undefined
    at XML3D.extend.draw (xml3d.js:19053)
    at XML3D.extend.render ((index):97)
    at XML3D.extend.renderTree (xml3d.js:23214)
    at XML3D.extend.render (xml3d.js:24251)
    at XML3D.extend.render ((index):150)
    at XML3D.extend.renderToCanvas (xml3d.js:24648)
    at AbstractCanvasHandler.GLCanvasHandler.draw (xml3d.js:20711)
    at tick (xml3d.js:20599)

Also I've corrected error in naming shader you did [here]https://github.com/xml3d/xml3d.js/wiki/Custom-RenderTrees-and-the-RenderInterface I mean: horizontalBlurShader -> box-blur-shader

csvurt commented 8 years ago

Hi Arsakes,

sorry, this example was neglected a bit lately since this isn't officially supported yet. I've just fixed up some problems with it and edited the wiki page, it should work now.

Note in the render function there's a call to this.mainRenderPass.setProcessed(false); now, and in the render pass this is propagated to the pre-passes as well. This is really ugly but for now you have to explicitly set the processed flag in every render pass to false before you begin rendering the tree, otherwise nothing will be re-drawn.

I hope we'll get some time to work on this interface soon because it's a bit of a mess, but see if the example blur tree works now in your scene.

Arsakes commented 8 years ago

Blur works, thanks for fixing the example.