1

I have a canvas which is filled by raw WebGL with primitives. A three.js library is supposed to draw stuff on the same canvas. Is this even possible? I get errors like:

WebGL: INVALID_OPERATION: uniformMatrix4fv: location is not from current program

In the past I used an overlay to achieve this. But the three.js stuff must be on the same canvas, because of future depth-tests and collision-detection. Is there a solution without migrating the raw WebGL stuff to three.js? Is this answer still up-to-date?

Community
  • 1
  • 1
Sincostan
  • 361
  • 2
  • 11
  • Could you elaborate a bit more on what you are trying to do? You can get the raw webgl context out of three.js by calling WebGLRenderer.getContext(), from there on you can issue your own calls to the api, mix and match... How did you fill your canvas "by raw WebGL"? – pailhead Dec 02 '15 at 00:32
  • I am pretty new to this topic, please pardon my little knowledge. I have a GWT-application which uses the elemental library http://gwtproject.org/articles/elemental.html for WebGL rendering. The Java code initializes a canvas and WebGLRenderingContext. Now I want to draw other stuff in these with Three.js. – Sincostan Dec 02 '15 at 17:56
  • What does Java have to do with webgl? Is this supposed to compile down to javascript? I'm not sure where three.js would fit in all this, or vice-versa, if you use three.js why you need all this. It seems obsolete? – pailhead Dec 02 '15 at 18:35
  • Yes, GWT compiles Java down to javascript. Due to historical reasons, the rendering is written in Java (GWT). New functionality is added and this uses three.js for rendering. Now I want to combine these two. – Sincostan Dec 03 '15 at 12:47
  • I dont know anything about GWT or Java, but if it's using three.js, it sounds like you need to make whatever 3d you want on that end? Otherwise, it's just javasript, and if it's three, it has a renderer, a scene probably, you can pipe in wherever and do whatever you want. Again what exactly are you trying to do, what kind of stuff you want to draw – pailhead Dec 03 '15 at 17:38
  • GWT is NOT using three.js. As said above, there is a library called elemental for WebGL. It is totally different from the abstraction of three.js. Let's say my application renders a quad with help of the elemental-library. I draw a quad on an canvas. Now I would like to draw another quad with three.js, not the elemental-library on the same canvas. This is where I get the error in my initial question. – Sincostan Dec 07 '15 at 12:35

0 Answers0