jPCT - a 3d engine for Java > Support

How to create an Applet

(1/3) > >>


First, excuse me for my english, I'm a french developper. ^^

I just find out the jpct 3D engine, and I want to create a basic applet : I just want to create a scene where I can see a 3DSmax object. I want to use hardware rendering (OpnGl).

But, unfortunatelly, I can't find any tutorial or exemple for this... So, for exemple, if I want to convert the "fps" demo in a Applet, how can I do that ?


I have a simple applet that should help you get started.  It demonstrates how to load and set up 3DS models, how to use hardware rendering in an applet, and how to switch between hardware and software rendering modes on the fly.

Here is a link to the source code:

To use hardware rendering in an applet, you must load it with the lwjgl applet loader, which you can download from:

Here are some instructions for using the applet loader, in case you have problems figuring out how to make it work:

You must place the following files (plus your program jar) somewhere online:

--- Code: ---jpct.jar
--- End code ---
Plus the two loader image files (in this example I am using paulscodelogo.png and paulscodeprogress.gif)

Next you need to create an html file to load the applet.  Here is the html I used in the gears demo example:

--- Code: ---<html><body>
    <applet code="org.lwjgl.util.applet.AppletLoader"
            codebase="." width="640" height="480">
            <param name="al_title" value="jPCTGears">
            <param name="al_main" value="jPCTGears">
            <param name="al_logo" value="">
            <param name="al_progressbar" value="">
            <param name="al_jars"
            <param name="al_windows" value="">
            <param name="al_linux" value="">
            <param name="al_mac" value="">
            <param name="al_solaris" value="">
            <param name="al_version" value="1.0">
--- End code ---

Just substitute your own files and class names.

Create a text file named ".htaccess".
If you are running Windows, it will complain, because that is not a valid filename, according to Bill.  You'll have to name it something like ".htaccess.txt", then rename it later after uploading it.

Edit the file you created, with notepad or other text editor.  Add the line:
AddType application/x-lzma .lzma

Save your file, and FTP it to wherever lwjgl_util_applet.jar and lzma.jar are located.  If necessary, rename your file ".htaccess" (remove the ".txt" extension)
Make sure you are allowed to use .htaccess before doing this!  Some of the things that .htaccess is able to do can compromise a server configuration.  For this reason, some web hosting companies may require them to be set up by an admin, so don't get in trouble.  You should CHMOD your .htaccess file to 644 (RW-R--R--) to prevent people from messing with it

That's it.  Let me know if you need any further clarification.

And for reference, here is a link to the working gears demo applet:

hey Paul. I think you should put together a comprehensive jpct + applets post|tutorial. Then ask Egon for it to be stickied.


--- Quote from: .jayderyu on November 29, 2008, 12:54:34 am ---hey Paul. I think you should put together a comprehensive jpct + applets post|tutorial. Then ask Egon for it to be stickied.

--- End quote ---
This thread would work fine for that.

U can use Eclipse as IDE it's a good IDE and u can found more than java editor. u can also write the java applet in a bloc note and name the file the same name as the class in(extension .java)
and then compile this file using javac to have the compiled (extension .class)
which u can run using java program
suppose the name of the first file is
u can in command line in the fiolder containing this file write :
u will have myclass.class
u can use java to run it if it' defined as application (using main method):
java myclass.class
if ur file is an applet (using paint method) :
u will create a html page that contains the class created by javac using the applet tag as bellow :

<APPLET code="myclass.class" width="500" height="200">
myfirst applet

here bellow an applet structure:

import java.applet.*;
import java.awt.*;

public class myclass extends Applet
public void paint(Graphics g)
g.drawString("Hi to all !!!", 30, 30);


[0] Message Index

[#] Next page

Go to full version