Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - Pascal

#1
Support / View a simple .3ds model
October 17, 2012, 02:44:42 PM
Hello,
i just tested the HelloWorld Applet and it works well. But when I want to change the Object3D "box" from the given Primitives.getBox(...) to a 3D-model (commented Line below it), after compiling and opening the .html file, there is still the green Box shown and not my 3D-model. Also when I change the Primitives.getBox() to .getCube(15) there is still the green Box from the beginning and no Cube.

Why does this happen?

Thanks for your help,
Pascal


private Object3D box;

    private FrameBuffer buffer = null;
    private World world = null;

    private boolean alive = true;
    private boolean initialized = false;

    @Override
    // Initialize all components of the applet
    public void init()
    {

        world = new World();  // create a new world
        World.setDefaultThread( Thread.currentThread() );

        // Add some light to the scene
        world.setAmbientLight(0, 255, 0);


        // create a new buffer to draw on:
        buffer = new FrameBuffer( getWidth(), getHeight(),
                                  FrameBuffer.SAMPLINGMODE_NORMAL );

// the lines i´m talking about
//**************************************************       
       
        // Create the box:
        box = Primitives.getBox(13f, 2f);
//      box = Loader.load3DS("D:/Temp/Tele.3ds",1)[0];
        box.build();

//**************************************************   

        // add the box our world:
        world.addObject( box );

        // set the camera's position:
        world.getCamera().setPosition( 50, -50, -5 );

        // Look at the box:
        world.getCamera().lookAt( box.getTransformedCenter() );

        // Finished initializing.  Now it is safe to paint.
        initialized = true;

        // Start the main "Game Loop":
        new Thread( this ).start();
    }

    // Main Game Loop:
    @Override
    public void run()
    {
        while( alive )
        {
            // Have the box rotate:
            box.rotateY( 0.01f );

            // Tell the applet to repaint itself:
            this.repaint();

            // Sleep for a bit:
            try
            {
                Thread.sleep( 10 );
            }
            catch( Exception e )
            {}
        }
    }

    // Draw the scene:
    @Override
    public void paint( Graphics g )
    {
        // Make sure jPCT is finished initializing:
        if( !initialized )
            return;

        buffer.clear();   // erase the previous frame

        // render the world onto the buffer:
        world.renderScene( buffer );
        world.draw( buffer );
        buffer.update();

        buffer.display( g, 0, 0 );
    }

    // End the main game loop:
    @Override
    public void destroy()
    {
    alive = false;
    }
}
#2
Hello,
i need to create a 3D-Animation that can be called via the browser. I didn´t find any examples to create a WebService (.war) with jpct. Is it right that this isn´t possible?

The only way is via an Applet? Because of this I wanted to test the AppletExample (http://www.jpct.net/wiki/index.php/Applets) but I get the Error
"Laden: Klasse HelloWorld nicht gefunden
java.lang.ClassNotFoundException: HelloWorld"

I created the Class in an Eclipse-Project an exported it as .jar. But what is the internal path from the HelloWorld-Class. Do i have to choose a special packagePath or what else do I have to consider when creating this .jar. (All three files are in the same folder (HelloWorld.jar, jpct.jar & HelloWorld.html))

Best Regards,
Pascal