3DzzD, JOGL support planned

I just finished some tests to add JOGL support to 3DzzD that I want to show.

first of all the last jogl.jar file must be in the …/jrexxx/lib/ext/ folder and
the three native library must be in the …/jrexxx/bin/ folder

Window ex:

put the jogl.jar there:
C:\Program Files\Java\jre1.5.0_02\lib\ext\jogl.jar

put the library there:
C:\Program Files\Java\jre1.5.0_02\bin\jogl.dll
C:\Program Files\Java\jre1.5.0_02\bin\jogl_awt.dll
C:\Program Files\Java\jre1.5.0_02\bin\jogl_cg.dll

now you are ready to run the online demo:
EDIT: http://dzzd.net/demo/3DzzDAP1.205/
http://dzzd.net/demo/3DzzDAP1.206/

ATI: there is a bug with ATI video card, demo will hang every 5-10s for 5-10s :frowning:

For now, It is only a test (excluding empty methods, the whole JOGL renderer is made of no more than 40 opengl lines), the good thing is that hardware support is transparent for the developper and hardware to software switching can be made even at runtime (if jogl installed of course).

it is a simple test,and so it only render untextured and without material. also FOV is not well handled and object diseaper on the border of the applet.

there is only two main methods in this new renderer, because all new renderer will benefit of all the 3DzzD scene processing made in the renderer super class.

called once each frame:


protected void startFrame

	gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
	gl.glEnable(GL.GL_DEPTH_TEST );
	gl.glEnable(GL.GL_LIGHTING );
	gl.glEnable(GL.GL_CULL_FACE );
	gl.glCullFace(GL.GL_FRONT);
	gl.glEnable(GL.GL_LIGHT0);
	gl.glLightf(GL.GL_LIGHT0, GL.GL_AMBIENT,1);
	gl.glShadeModel(GL.GL_SMOOTH);
	gl.glMatrixMode(GL.GL_PROJECTION);
	gl.glLoadIdentity();
        	float ratio=(float)((double)this.viewPixelWidth/(double)this.viewPixelHeight);
        	glu.gluPerspective(45,ratio,(float)Math.max(Float.MIN_VALUE,this.zMin),(float)Math.min(Float.MAX_VALUE,this.zMax));


Called for each visible mesh


protected void setFaces3DToZBuffer        
     	gl.glMatrixMode(GL.GL_MODELVIEW);
	gl.glLoadIdentity();
	gl.glScalef(1,1,-1);
	gl.glTranslatef(0,0,0);
	gl.glTranslatef(px,py,pz);
	gl.glRotatef(-ry,0,1,0);		
	gl.glRotatef(-rz,0,0,1);
	gl.glRotatef(-rx,1,0,0);
	gl.glBegin(GL.GL_TRIANGLES);
	for(int nf=0;nf<faceList.length;nf++)
	{
		float c=(float)(((double)nf)/faceList.length);
		gl.glColor3f(c,c,c);
		Face3D f=faceList[nf];
		IPoint3D v0=f.getVertex3D0();
		IPoint3D v1=f.getVertex3D1();
		IPoint3D v2=f.getVertex3D2();
			
		gl.glNormal3f(f.p0nx,f.p0ny,f.p0nz);
		gl.glVertex3f((float)v0.getX(),(float)v0.getY(),(float)v0.getZ());
		gl.glNormal3f(f.p1nx,f.p1ny,f.p1nz);
		gl.glVertex3f((float)v1.getX(),(float)v1.getY(),(float)v1.getZ());
		gl.glNormal3f(f.p2nx,f.p2ny,f.p2nz);
		gl.glVertex3f((float)v2.getX(),(float)v2.getY(),(float)v2.getZ());
	}
	gl.glEnd();

this is all code added to 3DzzD to begin supporting hardware with JOGL.

ps: I made it as fast as i can so i know that code is really bad and can be greatly optimized …

Bruno

Please don’t recommend dropping JOGL into the JRE directly. This defeats the ability of others to deploy JOGL via Java Web Start.

If you want to deploy an applet using JOGL, please look at the JOGLAppletLauncher which is in the current JSR-231 beta 2 as well as the current nightly builds. It allows you to deploy unsigned applets using JOGL without any manual installation step.

How, I did not know that.

But I do not want to deploy an applet using only JOGL, it is why I cannot use the JOGLAppletLauncher, JOGL is an option wich is not required ( and i dont want to use a signed applet wich require the user to accept each time he open the applet), if the user do not have it in his jre, the API will use the software mode, and if JOGL (or an other java-opengl binding) is installed in the jre the API will use it.

Can you explain me more about why webstart do not works when jre is “patched” ?

Bruno

I see. You may still be able to instantiate the JOGLAppletLauncher from your unsigned applet on demand and launch the 3D portion of your applet through it. Not sure though.

The presence of jogl.jar on the extension class path prevents Java Web Start from overriding the jogl.jar with the one downloaded along with any JOGL-based application. Given that there are multiple versions of jogl.jar in existence this can cause other peoples’ apps to break.

I made a new demo that is able to switch between Software and hardware (JOGL) renderer at runtime using the right mouse button

http://dzzd.net/demo/3DzzDAP1.206/

Framerate is limited to 30 fps for both software and hardware renderer
Use right mouse button to switch between software and hardware renderer (open the console to see result), if jogl can not be found nothing will happend when clicking right mouse button.

this demo, its source code, current alpha API and its documentation can be downloaded there : http://dzzd.net/demo/3DzzDAP1.206/APIDzzD.zip

you still need jogl jar and native library installed as explained erlier to use hardware renderer, dont forget to remove those files if you dont want to have trouble running jogl by webstart

know bugs:

software renderer:

  • alpha is disabled
  • some error on zbuffer
  • ambient is hardcoded

hardware render:

  • alpha is disabled
  • skybox is visible
  • if you switch two times from software renderer to hardware textures will be “mixed”.

api:

  • the SolidSphere3D have a hardcoded radius
  • alpha is disabled
  • switching two times from software renderer to hardware “result in mixed texture”.
  • frustrum culling trouble if camera FOV is set greater than 45%.

missing features wich will be available in nest version:

  • Terrain engine is disabled
  • getRendereMesh3D at x,y is disabled
  • getRendereFace3D at x,y is disabled
  • software ambient is hardcoded
    feedbacks about the API are welcome

Bruno

maybe it is not asociated with Dzzd project but i was thinking is it possible to lunch joglappletloncher from unsigned applet , for example lets imagine that i have my own unsigned applet in a jar file that have my own software renderer and i have inside it an option for user to choose jogl support if he wants to. So i have two options i can open in the same window other “link” with a page that contains joglappletlancher and redirect user to this page (other that my own applet with software renderer) or theoreticaly in my unsigned applet download manually jar file (open connection to server download jogl.jar file etc) and here is my question if i initalize joglappletlancher INSIDE applet will it work, will it download native ogl libs etc becouse jogl.jar is signed file and THIS jar use file fuctions on client computer. Of course this jogl appletlancher will conect again to server for my applet with jogl support , but it can be solved in a simple way , becouse it can be stored with my unsigned jar file(there were is software renderer). I have not tried it but i was wondering if it is possible and if yes it will be funy becouse unsigned applet will download jogl.jar initalize joglAppletlancher which will also initalize applet , so we have three in one applets :o . Yes i now that it is complicated and maybe a liitle crazy but jogl.jar is quite huge- about 1mb or 200kb in pack.gz my applet in softwere mode will be maximally 150kb and downloading additional 1mb it can take lots of time.

What do you think

This might work as I speculated above, but I haven’t tried it. Could you give it a try and see whether it works?

I was thinking about it during going to work and post it from office ;D, but when i will back home i will try to make it

kylix999, I am strongly interrested if you found a good working solution.

I will do some tests my side and will tell you about the results.

Bruno

Finish my research :slight_smile:

No need to install jogl anymore !!

http://dzzd.net/demo/3DzzDAP1.206/

For now should only works for windows (need to put other platform library)

This applet will work even with the microsoft JVM 1.1 in software and is able to switch to JOGL by right clicking

Bruno

i have not start anything and you have already found a solution :o

what does it mean that it only works on windows, jogl is crossplatform, and could you please give here how you have implemented this, of course i am not intrested in your software renderer (those functions you could omit) bu in DzzDDemoApplet.class

Exception in thread “Thread-7” java.lang.UnsatisfiedLinkError: no jogl in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at com.sun.opengl.impl.NativeLibLoader$1.run(NativeLibLoader.java:65)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.opengl.impl.NativeLibLoader.loadCore(NativeLibLoader.java:63)
at com.sun.opengl.impl.windows.WindowsGLDrawableFactory.(WindowsGLDrawableFactory.java:62)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at javax.media.opengl.GLDrawableFactory.getFactory(GLDrawableFactory.java:106)
at javax.media.opengl.GLCanvas.(GLCanvas.java:110)
at javax.media.opengl.GLCanvas.(GLCanvas.java:82)
at dzzd.J.(Unknown Source)
at dzzd.DzzD.newRender3D(Unknown Source)
at dzzd.a.a(Unknown Source)
at dzzd.a.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Sorry

Lilian

@clilian: Damn for this error but I ask some other guys to test and it seems it is working ? are you using window?

@kylix999 :
you can download the full api and this demo source code, it is now updated with the jogl support, the zip file contain the same demo that the one online:

http://dzzd.net/demo/3DzzDAP1.206/APIDzzD.zip

@Ken Russell :
I put jogl files in the downloadable zip is it legal? if no i will remove it and explain user where to download

Bruno

i have the same problem like c_lilian and you know why DzzD?, becouse probably you have not removed jogl native files jogl.dll etc from your java runtime etc, we do not have jogl.jar in ext folder and jogl.dll in bin etc so no jogl error ocurs, JoglAppletLancher downloads from itself native dlls and install them in some folder, probably when you remove your dll jogl files you will have the same exception like we, i wiill now see the source and tell more…

I remove all dll: I do a “find files” and delete all jogl*.* file from my computer and it still works??

Bruno

well it is hard to tell anything from that code in zip file DzzD but your 3d api is really intresting, anyway you have interface for 3d drawing IRender3d (am i right ) and second for changing renderer IScene3DRender from software and opengl, software rendere you can implement as you wish but jogl you have probably made like this:

// file kylix_IRender3d.java

import … // all imports for appplet etc
import javax.media.opengl.; //// ABSOLUTLY YOU CAN not DO THAT
import com.sun.opengl.utils.
; //// ABSOLUTLY YOU CAN not DO THAT too

kylix_IRender3d implements IRender3d{

renderScene3D( … )
{
… some jogl functions…
}

}

am i right DzzD?

Here the full source code of the JOGL renderer, “be induldgent” I made it in about 4hours (including opengl learning) because I never use opengl before.

There is no other file in the API using JOGL, further API version will allow custom renderer implementation to allow LWGL suppport or advanced opengl features, so this part and and all related will not be ofuscated anymore.

EDIT: Planned optimisation are displaylist compilation and recompilation for texture and mesh when updated


package dzzd;

import java.awt.*;
import java.awt.event.*;
import javax.media.opengl.*;
import javax.media.opengl.glu.*;
import java.nio.*;

public final class Render3DJOGL extends Render3D implements GLEventListener 
{	
	private GLCanvas canvas;
	private GL gl;
	private GLU glu;
	private IScene3D scene;
	private Point3D rotation;
	private float light0Pos[];
	private float light0Val[];
	private float matAmbient[];
	private float matDiffuse[];
	private float matSpecular[];

	
	public Canvas getCanvas()
	{
		return this.canvas;
	}
	
	public Render3DJOGL()
	{
		super();
		GLCapabilities glCaps = new GLCapabilities();
		glCaps.setRedBits(8);
		glCaps.setBlueBits(8);
		glCaps.setGreenBits(8);
		glCaps.setAlphaBits(8);
		this.canvas = new GLCanvas(glCaps);
		this.glu=new GLU();
		this.canvas.addGLEventListener(this);
		this.directInput=new DirectInput(this.canvas);
		rotation=new Point3D();
		light0Pos=new float[4];
		light0Val=new float[4];
		matAmbient=new float[4];
		matDiffuse=new float[4];
		matSpecular=new float[4];
	}
	

	
	public void setSize(int viewPixelWidth,int viewPixelHeight,int maxAntialias)
	{
		super.setSize(viewPixelWidth,viewPixelHeight,maxAntialias);
		this.canvas.setSize(viewPixelWidth,viewPixelHeight);
	}		
	
	public void renderScene3D(IScene3D scene)
	{	
		this.scene=scene;
		this.canvas.display();
		
	}
	

	/**
	 * Called once for each scene render.
	 * 

	 * new renderer should overload this method to perform initialisation needed for render the given scene3D.
	 *
	 * @param scene scene3D to prepare for a new render
	 */
	protected void startFrame(IScene3D scene)
	{
		/**
		 * Perform OGL renderer initialisation
		 */	
		gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);	//Clear color buffer & z buffer
		gl.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);		//Sets perpective mode
		
		gl.glEnable(GL.GL_DEPTH_TEST );									//Enable zBuffer
		gl.glEnable(GL.GL_CULL_FACE );									//Enable faces culling
		gl.glEnable(GL.GL_COLOR_MATERIAL );
		gl.glCullFace(GL.GL_FRONT);										//Sets type of culled faces
		
		gl.glColorMaterial ( GL.GL_FRONT_AND_BACK, GL.GL_DIFFUSE ) ;
		gl.glColorMaterial ( GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT ) ;
		gl.glColorMaterial ( GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR ) ;
		//gl.glEnable(GL.GL_NORMALIZE);

		//gl.glEnable(GL.GL_LIGHT0);									
		//gl.glLightf(GL.GL_LIGHT0, GL.GL_AMBIENT,1);
		//gl.glShadeModel(GL.GL_FLAT );

		/**
		 * Perform camera initialisation
		 */
		gl.glMatrixMode(GL.GL_PROJECTION);	//Sets current matrix (Projection => Camera)
        gl.glLoadIdentity();				//Reset matrix
        double ratio=this.viewPixelHeight;
		ratio/=this.viewPixelWidth;
		gl.glFrustum(-1,1,-1*ratio,1*ratio,this.focus,(float)Math.min(Float.MAX_VALUE,this.zMax));
					
		/**
		 * Sets current matrix (Modelview => Ready to draw scene)
		 */
        gl.glMatrixMode(GL.GL_MODELVIEW);

	}
	
	protected void renderFrame(IScene3D scene)
	{
		super.renderFrame(scene);
		float rot=this.numImage;	
	}

	protected void endFrame(IScene3D scene)
	{
		
	}
	
	protected void setFaces3DToZBuffer(Mesh3D ob,Face3D faceList[],int faceNum)
	{
		ob.getAxis3D().getRotationXZY(rotation);
		float rx=(float)(rotation.getX()*180.0/Math.PI);
		float ry=(float)(rotation.getY()*180.0/Math.PI);
		float rz=(float)(rotation.getZ()*180.0/Math.PI);

		IPoint3D pos=ob.getAxis3D().getOrigin();
		float px=(float)pos.getX();
		float py=(float)pos.getY();
		float pz=(float)pos.getZ();

		IPoint3D pivot=ob.getPivot();
		float pivotx=(float)pivot.getX();
		float pivoty=(float)pivot.getY();
		float pivotz=(float)pivot.getZ();
		
							
		gl.glLoadIdentity();
		gl.glScalef(1,1,-1);
		gl.glTranslatef(0,0,0);
		gl.glTranslatef(px,py,pz);
		gl.glRotatef(-ry,0,1,0);		
		gl.glRotatef(-rz,0,0,1);
		gl.glRotatef(-rx,1,0,0);

		if(scene.getSkyBoxMesh3DId()!=ob.getId())
		{
			gl.glEnable(GL.GL_LIGHT1);
			light0Val[0]=1.0f;
			light0Val[1]=1.0f;
			light0Val[2]=1.0f;
			light0Val[3]=1.0f;
			gl.glLightfv(GL.GL_LIGHT1, GL.GL_DIFFUSE,light0Val,0);	
			
			light0Pos[0]=(float)-mesh3DLocalLight3DBuffer[0].azx;
			light0Pos[1]=(float)-mesh3DLocalLight3DBuffer[0].azy;
			light0Pos[2]=(float)-mesh3DLocalLight3DBuffer[0].azz;
			light0Pos[3]=0.0f;		
			gl.glLightfv(GL.GL_LIGHT1, GL.GL_POSITION,light0Pos,0);
			
			gl.glLightModeli(GL.GL_LIGHT_MODEL_LOCAL_VIEWER, GL.GL_TRUE); 
			gl.glEnable(GL.GL_LIGHTING );
		}
		else
		{
			gl.glDisable(GL.GL_LIGHTING );
		}
		

		for(int nf=0;nf<faceList.length;nf++)
		{
			
			
			Face3D f=faceList[nf];
			
			
			IMaterial fm=f.getMaterial();
			if(fm!=null)
			{
				//float mcolor[] = { 1.0f, 0.0f, 0.0f, 1.0f };
				//glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mcolor);
				matAmbient[0]=((float)(fm.getAmbientColor()>>16&0xFF))*1.0f/255.0f;
				matAmbient[1]=((float)(fm.getAmbientColor()>>8&0xFF))*1.0f/255.0f;
				matAmbient[2]=((float)(fm.getAmbientColor()&0xFF))*1.0f/255.0f;
				matAmbient[3]=1;
				gl.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT, matAmbient,0);
				
				
				matDiffuse[0]=((float)(fm.getDiffuseColor()>>16&0xFF))*1.0f/255.0f;
				matDiffuse[1]=((float)(fm.getDiffuseColor()>>8&0xFF))*1.0f/255.0f;
				matDiffuse[2]=((float)(fm.getDiffuseColor()&0xFF))*1.0f/255.0f;
				matDiffuse[3]=1;
				gl.glMaterialfv(GL.GL_FRONT, GL.GL_DIFFUSE, matDiffuse,0);
				
				matSpecular[0]=((float)(fm.getSpecularColor()>>16&0xFF))*1.0f/255.0f;
				matSpecular[1]=((float)(fm.getSpecularColor()>>8&0xFF))*1.0f/255.0f;
				matSpecular[2]=((float)(fm.getSpecularColor()&0xFF))*1.0f/255.0f;
				matSpecular[3]=((float)(fm.getSpecularLevel()>>16&0xFF))*1.0f/255.0f;
				gl.glMaterialfv(GL.GL_FRONT, GL.GL_SPECULAR, matSpecular,0);
				
				
				gl.glMateriali(GL.GL_FRONT, GL.GL_SHININESS, fm.getSpecularPower()>>2);
			}
		
			
			IPoint3D v0=f.getVertex3D0();
			IPoint3D v1=f.getVertex3D1();
			IPoint3D v2=f.getVertex3D2();
						
			if(f.material!=null && f.material.diffuseTexture !=null && f.material.diffuseTexture.loaded==1 && f.material.diffuseTexture.error==0)
			{
				gl.glEnable(GL.GL_TEXTURE_2D);									//Enable texture
				this.setTexture2D(f.material.diffuseTexture);
				gl.glBegin(GL.GL_TRIANGLES);
				gl.glNormal3f(f.p0nx,f.p0ny,f.p0nz);
				gl.glTexCoord2f(f.u0,-f.v0);
				gl.glVertex3f((float)v0.getX(),(float)v0.getY(),(float)v0.getZ());
				
				gl.glNormal3f(f.p1nx,f.p1ny,f.p1nz);
				gl.glTexCoord2f(f.u1,-f.v1);
				gl.glVertex3f((float)v1.getX(),(float)v1.getY(),(float)v1.getZ());
				
				gl.glNormal3f(f.p2nx,f.p2ny,f.p2nz);
				gl.glTexCoord2f(f.u2,-f.v2);
				gl.glVertex3f((float)v2.getX(),(float)v2.getY(),(float)v2.getZ());
				gl.glEnd();
			}
			else
			{
				gl.glDisable(GL.GL_TEXTURE_2D);									//Enable texture
				gl.glBegin(GL.GL_TRIANGLES);
				gl.glNormal3f(f.p0nx,f.p0ny,f.p0nz);
				gl.glVertex3f((float)v0.getX(),(float)v0.getY(),(float)v0.getZ());
				gl.glNormal3f(f.p1nx,f.p1ny,f.p1nz);
				gl.glVertex3f((float)v1.getX(),(float)v1.getY(),(float)v1.getZ());
				gl.glNormal3f(f.p2nx,f.p2ny,f.p2nz);
				gl.glVertex3f((float)v2.getX(),(float)v2.getY(),(float)v2.getZ());
				gl.glEnd();
			}		
		}
			
	}
	



	public void init(GLAutoDrawable drawable) 
	{	
	}
	
	public void display(GLAutoDrawable drawable)
	{
		if(this.scene==null)
			return;
		this.gl=drawable.getGL();
		super.renderScene3D(scene);
	}

	public void reshape(GLAutoDrawable drawable, int i, int i1, int i2, int i3) 
	{
	}

	public void displayChanged(GLAutoDrawable drawable, boolean b, boolean b1) 
	{
	}
	
	private void setTexture2D(ITexture texture)
	{
		Texture t=(Texture)texture;
		if(t.pixels==null)
			return;
		
		int id=t.idGL;
		//gl.glEnd();		
		if(gl.glIsTexture(id))
		{//	System.out.println("tid"+id);
			gl.glBindTexture(GL.GL_TEXTURE_2D ,id);
			//gl.glBegin(GL.GL_TRIANGLES);
			return;
		}
		//System.out.println("tid="+id);


		IntBuffer n=IntBuffer.allocate(1);

		gl.glGenTextures(1,n);
		n.rewind();
		id=n.get();

		System.out.println("tid"+id);
		t.idGL=id;
		
		gl.glBindTexture(GL.GL_TEXTURE_2D ,id);
		gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_REPEAT);
		gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_REPEAT);	
		gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NICEST);
		gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NICEST);//GL_NEAREST);
		//gl.glTexImage2D(GL.GL_TEXTURE_2D,0,4,t.largeurImage,t.hauteurImage,0,GL.GL_BGRA,GL.GL_UNSIGNED_BYTE,IntBuffer.wrap(t.pixels));
		glu.gluBuild2DMipmaps(GL.GL_TEXTURE_2D,3,t.largeurImage,t.hauteurImage,GL.GL_BGRA,GL.GL_UNSIGNED_BYTE,IntBuffer.wrap(t.pixels));
		System.out.println("larg="+t.largeurImage);
		System.out.println("haut="+t.hauteurImage);
		//gl.glBegin(GL.GL_TRIANGLES);	
		/*gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST);
*/
	}
	
	private void deleteTextureById(ITexture texture)
	{
		int n[]=new int[1];
		n[0]=texture.getId()+1;
		gl.glDeleteTextures(1,IntBuffer.wrap(n));	
	}
	
	public String getImplementationName()
	{
		return "JOGL";
	}

	
}


Bruno

ok wait a moment in this post i will give in five minuts an explenation i know how to do that be patient…

my example will work if YOU have jogl.jar jogl.dll etc installed by yourself in your computer in bin/ext directories etc, you said that it works even when deleated them maybe jre has cahed them or something i was thinking about something other solution that will work for those who HAVE nOT installed jogl so this example in your code would look like this:

   
// file kylix2_IRender3d.java

import ....  // all imports for appplet etc

 // no imports to jogl absolutly not , it is simple class without any reference to software or jogl renderer 

kylix2_IRender3d implements IRender3d{



kylix2_IRender3d()  // all initalization of jogl we will make in consructor
{
      // first step we must download jogl.jar file from server, in that code can be errors i gave it only to show how it could be made...
      
      URL url = new URL( new String(applet.getCodeBase() +"jogl.jar" ));
      URLConnection urlConnection = url.openConnection();  // locate jogl.jar on server

       byte buffer[];
       int size = urlConnection.getContentLength();
       buffer = new byte[size+1024];
       InputStream input = urlConnection.getInputStream();
       
                    int l=0;
                    while( (l=input.read(buffer))!= -1 )  // loading jogl.jar
                    {
                       bytesLoaded+=l;
                    }
     // ok so now lets say that we will have jogl jar in byte buffer
    // i will omit changing this buffer to JarInputStream or some other class to access content of this jogl.jar file
    // lets say that i have some magic function that can get JoglAppletLancher.class , this function name 
    //will be lets say giveJoglApplet() ok!

    Class  joglAppletLancher = giveJoglApplet(  "jogl.jar"  ,  "com.sun.opengl.util.JoglAppletLancher"  );   
    // so we have refernce in class  to JoglAppletLancher
    
    Applet trueWorkingJoglApplet =  (Applet)joglAppletLancher.newInstance(); // now it is working applet
    trueWorkingJoglApplet .setStub ( ... )  // important for solving problems - functions like 
    // getCodeBase etc, not important now...

   // So now we haveworking joglAppletLancher inside your applet
  // now inside jogl applet we initalize your first applet!!!  like in that example you gave me at first 
  // time in source code - zip  etc
  // but note as earlier in param you mast have as your applet DzzDDemoApplet.class specified

  trueWorkingJoglApplet.init();  

  trueWorkingJoglApplet .start();   // in this function everything should start working ,
  //  joglAppletLancher should start 
   // downloading native libs , then install it , next download 
  // DzzDDemoApplet.class file and initalize it and in the same way like for Render3DJOGL 
  // source that you have posted to this topic ,
  // and now errors of no jogl should not occure even with your version of Render3DJOGL 
  // becouse it will be initalized after downloading 
  // native libs etc
   
}
  
}  

 

IMPORTANT

That example above will not probably or even for shure work becouse there can be problem for example with classLoader (or maybe not if in
archive html param we will give the name of jogl.jar, i have not tested it anyway), another problem is that JoglAppletLancher must have acces
to screen like true applet etc, JoglAppletLancher should work like on top oh him (his lets say father) is java plugin not NEXT OUR applet, so many problems should be made i this way and probably DzzD you had to change some functions in your api to provide it working ,

now i have not much time to code it becouse i am busy so i make my office work , thinks about thosuends of things and looks some times to this forum , but this above code is POSTED AS IDEA NOT FINAL CODE TO IMPLEMENT,

ok DzzD say what you think…

Iremove all dll from my computer, delete temporary internet files using internet explorer and jvm plugin and it still works! I dont understand why it doesn’t works on your computer :frowning: can you tell me your exacte configuration : JVM, OS etc…

maybe the difference in configuration will show where the probleme come from.

When I right click on the applet in my computer there is a popup asking me if i want to accept sun certificat if I answer yes the applet run well without error and use opengl via JOGL.

Bruno