![](/img/trans.png)
[英]Why Java applet works on windows but not on Mac 10.6.8?
[英]online java webstart applet will not allow mouseDragged() on mac osx but works on windows. Am I missing something?
* 請注意,我一直在閱讀,可能是(也可能不是)Apple Inc.的java插件不允許這樣做,但是我感覺它在做我的事情。 話雖如此....*
我使用Processing 1.5.1
編寫了一個Java applet ...上傳到我的網站后,它在使用IE,FF,Safari和Chrome的Windows上可以完美運行。
但是,沒有瀏覽器允許它在mac osx上正常工作。 它會加載並正常顯示,但您根本無法與它進行交互。
該應用程序所做的全部工作就是加載.obj,並在拖動鼠標時旋轉它。
很簡單的程序。 但由於某些原因,鼠標拖動功能在Mac上不起作用。 就像小程序一樣,它永遠不會吸引瀏覽器或OS的關注。
知道我能做些什么? 我正在使用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
我如何通過Processing生成的html加載草圖:
...
<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">-->
....
通過JOGL
Processing
與OpenGL
接口。 您可能需要構建Mac OS版本,這將需要安裝Mac Developer Tools來獲取OpenGL標頭。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.