Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Since sunday I'm trying to solve the same problem. Although there is much information in the www, I wasn't able to get it working on my example-program. As soon as I solve it, I'll post my example in here.</p> <p>My last try was to use the glu-unProject port for webGL. This one needs the following parameters:</p> <blockquote> <p>function(winX, winY, winZ, model, proj, view, objPos)</p> </blockquote> <p>I've tried to call this function directly from my scene-drawing function for testing purposes.</p> <pre><code>var pMatrix = new mat4.ortho(iL, iR, iB, iT, fNearZ, farZ); var mvMatrix = new mat4.create(); mat4.identity(mvMatrix); mat4.translate(mvMatrix,[0,0,-40]); var oMouseMatrix = mat4.create(); mat4.identity(oMouseMatrix); //Rotate eye :-S mat4.rotate(oMouseMatrix,((this.fAnimationXAngle/10) * Math.PI) / 360.0,[0,1,0]); mat4.rotate(oMouseMatrix,((this.fAnimationYAngle/10) * Math.PI) / 360.0,[1,0,0]); mat4.multiply(oMouseMatrix, mvMatrix, mvMatrix); //Rotate model mat4.rotateX(mvMatrix,this.fRotX * Math.PI / 180.0); mat4.rotateY(mvMatrix,this.fRotY * Math.PI / 180.0); mat4.rotateZ(mvMatrix,this.fRotZ * Math.PI / 180.0); var aTest = this.unProject( this.pLastMouse.x, this.pLastMouse.y, 0, mvMatrix, pMatrix, [0,0,this.iWidth,this.iHeight] ); </code></pre> <p>this.iWidth &amp; this.iHeight are the canvas and viewport width/height - this.pLastMouse.x &amp; .y are the mouse-coordinates inside the canvas</p> <pre><code>zI.debug(aTest); </code></pre> <p>But the result is <strong>totally crap</strong>. I guess there are several errors in my code. I've started playing around with WebGL just last friday. I didn't want to give up that early, but I've solved many problems since then, but this one is making me crazy.</p> <p>In openGL it was much easier to me.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload