Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8024789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:57:51+00:00 2026-06-04T22:57:51+00:00

im using xtk to visualize medical data in a webgl canvas. currently im playing

  • 0

im using xtk to visualize medical data in a webgl canvas. currently im playing around with this lesson:

lesson 10

this library is pretty good but not very well documented. i want to get rid of that gui and add some mouseevents. if i load the mesh from the gui how can i add a mouse event to the mesh? i actually don’t know where to start. it’s a little bit confusing to get started with this library….

i tried

mesh.click(function(){
    alert("yes");
  })

or

mesh.mousedown(function(){
    alert("yes");
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T22:57:52+00:00Added an answer on June 4, 2026 at 10:57 pm

    DOM events are not supported but you can do it with xtk. Check out this JSFiddle

    http://jsfiddle.net/haehn/r7Ugf/

    // create and initialize a 3D renderer
    var r = new X.renderer3D();
    r.init();
    
    // create a cube and a sphere
    cube = new X.cube();
    sphere = new X.sphere();
    sphere.center = [-20, 0, 0];
    
    r.interactor.onMouseMove = function() {
    
        // grab the current mouse position
        var _pos = r.interactor.mousePosition;
    
        // pick the current object
        var _id = r.pick(_pos[0], _pos[1]);
    
        if (_id != 0) {
    
            // grab the object and turn it red
            r.get(_id).color = [1, 0, 0];
    
        } else {
    
            // no object under the mouse
            cube.color = [1, 1, 1];
            sphere.color = [1, 1, 1];
    
        }
    
        r.render();
    
    }
    
    r.interactor.onMouseDown = function(left, middle, right) {
    
        // only observe right mouse clicks        
        if (!right) return;
    
        // grab the current mouse position
        var _pos = r.interactor.mousePosition;
    
        // pick the current object
        var _id = r.pick(_pos[0], _pos[1]);
    
        if (_id == sphere.id) {
    
            // turn the sphere green
            sphere.color = [0, 1, 0];
            r.render();
    
        }
    
    }
    
    r.add(cube); // add the cube to the renderer
    r.add(sphere); // and the sphere as well
    r.render(); // ..and render it
    

    Easy, no?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Google Maps InfoBox - http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/reference.html Currently the map will scroll - pan control
We're using XTK to display data processed and created on a server. In our
Using NSDateComponents I know how to get the day component, but this gives me
Using Android TelephonyManager an application can obtain the state of data activity over the
Using Core Data, I have a fetch request to fetch the minimum of a
we are using VTK to render data in a regular desktop application, e.g. for
Using this code, the following execution yields strange results: C 100 R W The
using xmltextreader, how would I load a hashtable. XML: <base><user name=john>2342343</user><user name=mark>239099393</user></base> This was
using file_get_contents , I open an Internet URL and get the contents of this
Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.