*请注意,我一直在阅读,Apple Inc 的 java 插件可能不允许这样做,也可能不会,但我觉得这是我正在做的事情。话虽如此....*
我使用...编写了一个 java 小程序Processing 1.5.1
,上传到我的网站后,它可以在使用 IE、FF、Safari 和 Chrome 的 Windows 上完美运行。
但是,没有一个浏览器允许它在 mac osx 上正常工作。它可以正常加载和显示,但您根本无法与之交互。
该应用程序所做的只是加载一个 .obj 并让您在拖动鼠标时旋转它。
非常简单的程序。但是由于某种原因,鼠标拖动功能在 mac 上不起作用。就像小程序永远不会从浏览器或操作系统中获取焦点一样。
知道我能做什么吗?我正在使用java webstart。
*Processing 在导出小程序时生成 .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 加载草图:
...
<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">-->
....