Jump to content

2D canvas issue Android VS PC


chicagobob123
 Share

Recommended Posts

So Sorry I really spaced out. It involves a context not canvas. There should be a hit head Emoticons for this. 

Lets start again.  I created a  BABYLON.DynamicTexture

var sizelimit=8192;
var dTexture=new BABYLON.DynamicTexture("dtex",sizelimit,scene,true);

var context=dTexture.getContext();

----> I drew the ground with different image tiles. 

context.drawImage(grnd[0],j*size,i*size);

 

       var materialGround=new BABYLON.StandardMaterial("std",scene);
       materialGround.diffuseTexture=dTexture;
       materialGround.specularPower=300000;

       dTexture.update();

--> created the ground and used the material

      var ground=BABYLON.Mesh.CreateGround("ground1",8192,8192,2,scene);
       ground.material=materialGround;
       ground.material.backFaceCulling=false;
       ground.position.y=0.1;
       ground.convertToFlatShadedMesh();
       ground.isPickable=false;

 

All works just fine except its not in the same place on android? Its hard to tell if its only the Z

direction where its off because its a phone but its off all right. 

 

Link to comment
Share on other sites

Sorry so far I have not been able to pull off an example but could reall use some help.

I was able to see what is going on. 

I have tiles from the same image as a top and bottom border gnd[0] (all preloaded). 

In the center I loaded a bunch of different image tiles. What occurs is so ODD. ALL the same gnd[0] tiles in the positive z axis

while the center group shows up below. 

Android Chrome

xxxxxxxxxxxxx same

xxxxxxxxxxxxx same 

xxxxxxxxxxxxx multiple images 

While on the PC it renders correctly 

xxxxxxxxxxxxx same

xxxxxxxxxxxxx multiple images 

xxxxxxxxxxxxx same 

 

// create texture for ground

       var sizelimit=8192;
       var dTexture=new BABYLON.DynamicTexture("dtex",sizelimit,scene,true);

       var context=dTexture.getContext();
       var span=sizelimit/512;
       var size=w;

 for(var i=0;i<6;i++)
        {
         for(var j=0;j<span;j++)
          {
           context.drawImage(grnd[0],j*size,i*size);
          }
        }

       // draw out the tiles that make the ground.      
       var cnt=1;
       for(var i=0;i<4;i++)
        {
         for(var j=0;j<span;j++)
          {
           context.drawImage(grnd[cnt],j*size,(i+6)*size);
           cnt++;
          };
        }
    
             // draw out the tiles that make the ground.
       for(var i=0;i<6;i++)
        {
         for(var j=0;j<span;j++)
          {
           context.drawImage(grnd[0],j*size,(i + 10) *size);
          }
        }

 

     var materialGround=new BABYLON.StandardMaterial("std",scene);
       materialGround.diffuseTexture=dTexture;
       materialGround.specularPower=300000;

       dTexture.update();

       var ground=BABYLON.Mesh.CreateGround("ground1",8192,8192,2,scene);
       ground.material=materialGround;
       ground.material.backFaceCulling=false;
       ground.position.y=0.1;
       ground.convertToFlatShadedMesh();
       ground.isPickable=false;

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...