2012-05-07 21 views
0

* note我一直在閱讀,它可能會也可能不是蘋果公司的java插件不允許這樣做,但我覺得它是我正在做的事情。這就是說.... *在線java webstart applet不允許在mac osx上使用mouseDragged(),但在Windows上工作。我錯過了什麼嗎?

我寫了一個Java小程序使用Processing 1.5.1 ...上傳到我的網站後,它完美地在Windows,使用IE,FF,Safari和Chrome。

但是,沒有瀏覽器允許它在mac osx上正常工作。它會加載並顯示正常,但你根本無法進行交互。

所有應用程序都會加載.obj,並讓您在拖動鼠標時旋轉它。

非常簡單的程序。但由於某種原因,鼠標拖動的功能在mac上不起作用。它像applet一樣從不會從瀏覽器或操作系統獲得焦點。

知道我能做什麼嗎?我正在使用java webstart。

*處理程序在導出小程序時生成.jar和java腳本。我需要添加一些東西到我的草圖,使其適用於Mac嗎? 這是我處理素描:

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

我是如何通過加載HTML通過處理生成的草圖:通過JOGLOpenGL

... 

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

     .... 
+0

*「沒有瀏覽器允許它在mac osx上正常工作。」*當您啓動它自由浮動時會發生什麼? –

+0

我該怎麼做。通過處理意味着什麼? –

+0

'org.jdesktop.applet.util.JNLPAppletLauncher'用於將[JWS](http://stackoverflow.com/tags/java-web-start/info)項目填充到網頁中。所以,請儘量不要將它塞進網頁以便於部署。在提出進一步問題(是我的建議)之前,請閱讀提供的鏈接瞭解JWS的所有信息。 –

回答

相關問題