JavaScript copy texture Three.js three js copy texture

I want to load the left half of video texture to left Geometry and right half of video texture to the right Geometry

var video = document.createElement("video");
var texture = new THREE.Texture(video);
texture.offset = new THREE.Vector2(0,0);
texture.repeat = new THREE.Vector2( 0.5, 1 );
var material = new THREE.MeshLambertMaterial({
    map: texture,
    side: THREE.DoubleSide
});

this is the left plane texture

var texture2 = new THREE.Texture(video);
texture2.minFilter = THREE.NearestFilter;
texture2.offset = new THREE.Vector2(0.5,0);
texture2.repeat = new THREE.Vector2( 0.5, 1 );
var material2 = new THREE.MeshLambertMaterial({
    map: texture2,
    side: THREE.DoubleSide
});

this is the right plane texture

var plane = new THREE.Mesh(new THREE.PlaneBufferGeometry(320,   240), material);
var plane2 = new THREE.Mesh(new THREE.PlaneBufferGeometry(320, 240), material2);

loading two video texture didn't work,the left plane does display but the right not ,Than I try to copy texture instead of loading the same video texture:

 texture2 = THREE.Texture.clone(texture);

or

 texture = texture;

both don't work,too.Because(in three.js reference):

.clone(texture)
Make copy of texture. Note this is not a "deep copy", the image is shared.

What if anything can I do ?

function change_uvs( geometry, unitx, unity, offsetx, offsety ) {
    var faceVertexUvs = geometry.faceVertexUvs[ 0 ];
    for ( var i = 0; i < faceVertexUvs.length; i ++ ) {
       var uvs = faceVertexUvs[ i ];
       for ( var j = 0; j < uvs.length; j ++ ) {
         var uv = uvs[ j ];
         uv.x = ( uv.x + offsetx ) * unitx;
         uv.y = ( uv.y + offsety ) * unity;
      }
   }
}
var P1 = new THREE.PlaneGeometry(320, 240);
var p2 = new THREE.PlaneGeometry(320, 240);
change_uvs(p1,0.5,1,0,0);//left plane
change_uvs(p2,0.5,1,1,0);// right plane

by changging the uvMapping of planes i solve the problem :)

Answer:1

my question is really simple. It is possible use Angular Controllers with prototype? 'use strict'; var EventController = function(scope, EventModel) { this.scope = scope; this....

my question is really simple. It is possible use Angular Controllers with prototype? 'use strict'; var EventController = function(scope, EventModel) { this.scope = scope; this....

  1. in angular controller
  2. angular use controller from another module

I have a little FTP script which basically transfer an entire directory tree (by walking it with fs.readdir) to an FTP server one file at a time (I have to do some analysis on each file as it's ...

I have a little FTP script which basically transfer an entire directory tree (by walking it with fs.readdir) to an FTP server one file at a time (I have to do some analysis on each file as it's ...

  1. node make synchronous http request
  2. node make synchronous query
  3. make node js synchronous
  4. node make function synchronous
  5. node make promise synchronous
  6. make foreach synchronous node js
  7. make request synchronous node js
  8. make node js code synchronous
  9. node make callback synchronous
  10. make function synchronous node js
  11. make for loop synchronous node js
  12. node make asynchronous call synchronous

In my entity framework model (from oracle) I have a table that contains the following Column Now. I use an asp.net webforms datagrid to view the data. At one stage the value in this column is ...

In my entity framework model (from oracle) I have a table that contains the following Column Now. I use an asp.net webforms datagrid to view the data. At one stage the value in this column is ...

How would I make a sticky nav bar without using jQuery? I want to do something like: if (scrollheight == x) navbar.addclass "sticky"

How would I make a sticky nav bar without using jQuery? I want to do something like: if (scrollheight == x) navbar.addclass "sticky"