简体   繁体   中英

online java webstart applet will not allow mouseDragged() on mac osx but works on windows. Am I missing something?

* note I have been reading and it may or may not be that the java plugin for Apple Inc doesn't allow this, but I feel like its something I am doing. that being said....*

I wrote a java applet using Processing 1.5.1 ... After uploading to my website it works perfectly on windows using IE, FF, Safari, and Chrome.

However, NONE of the browsers allow it to work correctly on mac osx. It will load and display fine but you can not interact with it at all.

all the app does is load an .obj and let you rotate it when the mouse is dragged.

Very simple program. but the mouse dragged functionality doesnt work on mac for some reason. Its like the applet never grabs focus from the browser or OS.

know anything that I could do? I'm using java webstart.

*Processing generates the .jar and java script when it exports the applet. Do I need to add something to my sketch to make it work for macs? This is my processing sketch:

//this sketch was created as an example for the IMA 
//by Joseph Aaron Campbell
//josephaaroncampbell.com
//it uses OBJLoader and the SAITO example as a base

import processing.opengl.*;
import processing.opengl.PGraphicsOpenGL;//put this in because I got a random error looking for 
                                         //it.probably dont need it
import saito.objloader.*;

OBJModel model ;

float rotX, rotY;

void setup()
{
    size(640, 450, P3D);
    frameRate(30);
    ///keep your poly count 32000 and below for obj files
    //'or youre going to have a bad time'
    //
    //create and load instance of model
    model = new OBJModel(this, "vase_18.obj", "absolute", TRIANGLES);
    model.enableDebug();
    //scale of model. not sure the relationship to original size
    model.scale(10);
    model.translateToCenter();
    stroke(255);
    noStroke();
}



void draw()
{
   //what color is your background? 0=black, 255=white
    background(15);
     //add some info about model and origins
    String s = "Original Vase found at: Http://www.imamuseum.org/art/collections/artwork/abstract-vessel-black  Artist: Odundo, Magdalene";
    fill(200, 200, 200);
    textSize(12);
    textMode(SCREEN);
    textSize(12);
    text(s, 15, 20, 450, 50);

    //retrieve mouse cordinates for later use
    //adds directional light to position of mouse
    float dirY = (mouseY / float(height) - 0.5) * 2;
    float dirX = (mouseX / float(width) - 0.5) * 2;

    //Lights
    directionalLight(100,100, 100, -300, 150, -1);
    lightSpecular(255, 255, 255); 
    shininess(15.0);
    directionalLight(145,145,145, 300, 200, 1);
    directionalLight(100,100,100, -400,400,-1);



   //pushMatrix and popMatrix create little bubble for model to be in
    pushMatrix();//begin changes to model
    translate(width/2, height/2, 0);
    rotateX(rotY*0.4);
    rotateY(rotX*0.4);
    model.draw();
    popMatrix();//end changes to model


}

void mouseDragged()
{

   rotX += (mouseX - pmouseX) * 0.01;
   rotY -= (mouseY - pmouseY) * 0.01;

}//mousevoid

how I am loading the sketch via html generated by Processing:

  ...

  <div id="vase_container">
<applet code="org.jdesktop.applet.util.JNLPAppletLauncher"
    width="640"
    height="450"
    archive="http://absolute path to/vase.jar,
             http://absolute path to/opengl.jar,
             http://absolute path to/OBJLoader.jar,
          http://absolute path to/core.jar,
          http://jogamp.org/deployment/jogamp-current/jar/applet-launcher.jar,
          http://jogamp.org/deployment/jogamp-current/jar/jogl.all.jar,
          http://jogamp.org/deployment/jogamp-current/jar/gluegen-rt.jar">
  <!--http://jogamp.org/deployment/webstart/jogl-demos/jogl-demos.jar-->
  <param name="codebase_lookup" value="false" />
  <param name="subapplet.classname" value="vase" />
  <!--<param name="subapplet.displayname" value="Pretty Name Here">-->
  <param name="noddraw.check" value="true" />
  <param name="progressbar" value="true" />
  <param name="jnlpNumExtensions" value="1" />
  <param name="jnlpExtension1"
     value="http://jogamp.org/deployment/jogamp-current/jogl-all-awt.jnlp" />
  <param name="java_arguments" value="-Dsun.java2d.noddraw=true" />
  <!--<param name="jnlp_href" value="applet-gears.jnlp">-->

        ....

Processing interfaces with OpenGL through JOGL . You probably need to build a Mac OS version, which will require installing the Mac Developer Tools to get the OpenGL headers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM