Jump to content

Showing 3D object with WebGL


jstech
 Share

Recommended Posts

I am using WebGL inside a javascript to display a 3D object. On the page you can select the object to be displayed, among several available options and when selecting one, it appears rotating in 3D.
When successively selecting the different objects available to display, they are always displayed correctly, but the problem is that each time a new object is selected, it rotates a little faster than the previous one.
I would need the initial speed, which is correct, to be maintained instead of increasing.
The code I use to display the selected object is this:

   var ps;

   cam = new OrbitCam({closest:5, farthest:100, distance: 20});
   cam.setOrbitPoint([0,0,0]);

   ps = new PointStream();
   ps.setup(document.getElementById('canvas') ,{preserveDrawingBuffer:false});
  
   ps.background([0, 0, 0, 0.8]);
   ps.pointSize(3);
   ps.onRender = render;
   ps.onMouseScroll = zoom;
   ps.onMousePressed = mousePressed;
   ps.onMouseReleased = mouseReleased;


What is missing or incorrect in this code so that the speed is always the same?
 

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...