Skip to main content

Add image-ma on View ..... blured and translucent in the Applet version !!?

8 replies [Last post]
tmilard
Offline
Joined: 2004-03-25
Points: 0

Hello java3d colleagues, I have been experiencing an unexpected difference behavior of the same code with java3D renderer.
1) What the program do : It adds simply a map-image in the View. Pretty straightforward...

2) But the display of this map
- is GOOD in the Applet Viewer : Opaque map (red circul).
see here : http://www.free-visit.net/Demo_with_AppletViewer.jpg

- is BAD With Applet inside web-Browser (Firefox or ie). Map is quite translucent and blured
- See here :http://www.free-visit.net/Demo_with_Browser_Applet.jpg

Does someone has an idea why is it so ?

By the way I also noticed that the the performance inside browser is also quite lower than the Appletviewer one. Why ?

(I can post the code if needed but it is standard code.)
Thierry

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
tmilard
Offline
Joined: 2004-03-25
Points: 0

Hello Alexandro.
[b]Bingo ! It works now[/b].
On my local Vista machine I NOW have a full java3D applet that does run with DirectX renderer (and not OpenGl).
I thank you once again very much.
Alex, If you ever come too Berlin for vacation, I will be pleased to offer you a nice diner in a nice German restaurant. Or help you in anyway.
It's a deal. Cheers !

[b]Things to know for Whoever tries to specify a specific renderer [ DirectX or OpenGL] for a java3d program.
[/b]
[b]1) why do that :[/b]
Well man, java3d API has one big advantage : it can target both DirectX or OpenGL. This ain't luxury when you want like me to target any windows machine or even mac or ...whatever comes next in future.

[b]2) Never forget to write the code on [u]STATIC[/u]. [/b]
Why ? The renderer (OpenGl or DirectX) is (I supposed) instanciated as soon as your application class instanciate any java3d classe. So the choice of the renderer MUST be made before any of your application class is ... instanciated.
Just like when a chemney fire is on, it is too late then to change the wood already burning. Do change the wood before lighting on your fire.

[b]3) Here is an java example :[/b]

[code]
// ----------------------------------
// (behin) source java code
public class YourApplicationApplet extends JApplet {

import javax.media.j3d.*;

static{
System.out.println("LaVisitePlayerApplet>>static --------------------------------------");
System.out.println("LaVisitePlayerApplet>>static ---------------------------- debut ---");
try{
String local_os_name = System.getProperty("os.name");
System.out.println("local_os_name="+local_os_name);
if (local_os_name.equalsIgnoreCase("Windows XP")) {
// Cas Windows XP :
System.out.println("local os XP ==> On me le renderer à 'ogl' ");
System.setProperty("j3d.rend", "ogl");
} else if (local_os_name.equalsIgnoreCase("Windows Vista")) {
// Cas Windows XP :
System.out.println("local os Vista ==> On met le renderer à 'd3d' ");
System.setProperty("j3d.rend", "d3d");
}
else {
// Cas ????? (ni Windows XP, ni Vista) :
System.out.println("local os ???==> On ne position aucun renderer(??) ");
}

}catch(Throwable th){
System.err.println("Failed to set D3D or OpenGl as renderer for Java3D");
th.printStackTrace();
}
System.out.println("LaVisitePlayerApplet>>static ---------------------------- (fin) ---");
System.out.println("LaVisitePlayerApplet>>static --------------------------------------");
} // fin static

//Here all your application variable, methode,...

// ( end ) source java code
// ----------------------------------
[/code]

[b]4) Do not try to do this in JNLP with java virtual machine (JVM) parameters [/b]

Why ?
- It is unreadable,
- it externalise important code outside your java code,
- and it is a mess to maintain.
- and overall I am not did not manage to see it work

For example I personnally tried this in JNLP,file:
...

Result : Sadly I allways had OpenGl running. So my advise : Stick to java code to control java3d rendering platform

speling mistakes

Message was edited by: tmilard

aces
Offline
Joined: 2003-07-17
Points: 0

I'm glad you have it working now ;)
Please, don't forget the cold beers ;)

tmilard
Offline
Joined: 2004-03-25
Points: 0

> I'm glad you have it working now ;)
===> Ya, I fel so relief... I think I have been draging this problem for the last 4 months ! Good to know it is the past.

> Please, don't forget the cold beers ;)
====> Ok.

tmilard
Offline
Joined: 2004-03-25
Points: 0

Ok Alessandro, I were right : some variable are not the same.
Here is the list of differences :

APPLET_VIEWER (in dev) / APPLET (in web page)
texture3DHeightMax= 2048 / 128
texture3DDepthMax=256 / 128
textureLodRangeAvailable=false / true
texture3DWidthMax=2048 / 128
compressedGeometry.minorMinorVersionNumber=2 / 1
sceneAntialiasingNumPasses=1 / 8
[b]native.version[/b]=[b]DirectX [/b]9.0 or above, / [b]1.4.0 - Build 7.14.10.1437[/b]
textureBoundaryWidthMax=0 / 1
native.renderer=Mobile Intel(R) 945 Express Chipset Family / Intel 945GM

- Question : Applet_viewer version (left side) is for sur DirectX, but for the Applet-in-webpage, can I consider it is running OpenGl ?
Afterall native.version=1.4.0 - Build 7.14.10.1437 --> it doesn't say it is neither DirectX or OpenGl....

aces
Offline
Joined: 2003-07-17
Points: 0

Hi Thierry

Yes, the Applet (web) version is using version is using OpenGL . That "1.4.0 - Build 7.14.10.1437" string is the signature for OpenGL 1.4.0 on Intel video cards.

As applets runs with SecurityManager activated, it may refuse to accept the statement to use D3D as default renderer:
[code]
System.setProperty("j3d.rend","d3d");
[/code]

Anyway, the safe code for force DirectX is:
[code]
static{
try{
System.setProperty("j3d.rend","d3d");
}catch(Throwable th){
System.err.println("Failed to set D3D as renderer for Java3D");
th.printStackTrace();
}
}
[/code]

tmilard
Offline
Joined: 2004-03-25
Points: 0

Hello Alexandro, 100000 thanks for the tip !
"OpenGl renderer", so that is THE problem ==> On Applet it doesn't ship to DirectX.
Merde alors ....
I will try to catch the error as you said (in the next hours) .

PS:
But I do have to say that I also send a JVM-parameters in the JNLP file. Is there a speling mistake in my arguments ?
java-vm-args="-Djava.security.manager -Xms350m -Xmx1024m [b]-Dj3d.rend=d3d[/b] -Dj3d.optimizeForSpace=true -Dsun.java2d.d3d=false -Dsun.java2d.ddoffscreen=false -Dsun.java2d.noddraw=true -Dj3d.audiodevice=org.jdesktop.j3d.audioengines.joal.JOALMixer"/>

aces
Offline
Joined: 2003-07-17
Points: 0

Thierry

Check if your application is using different renderer (D3D, OGL) when it changes environment.
Use Canvas.queryProperties() and print it at Java console

tmilard
Offline
Joined: 2004-03-25
Points: 0

Yes, afterall I have to check.
Both (are supposed to) use DirectX....
Thanks