Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3508 Members - Latest Member: NevilleKemp

26. May 2012, 06:48:24 pm
Xith3D CommunityGeneral CategorySupport (Moderator: Marvin Fröhlich)rl.begin(true) yields Not Responding in win7
Pages: [1]
Print
Author Topic: rl.begin(true) yields Not Responding in win7  (Read 151 times)
minikidder
Just dropped in

Offline Offline

Posts: 7



View Profile
« on: 06. December 2011, 05:22:32 pm »

Hi! I'm not sure what I'm doing wrong, I'm beginner & learning, but I tried the normal and working Chapter07a.java with rl.begin(true); and it will ignore all inputs and become Not Responding application under windows 7 and I can choose to have windows Close it. To fix it, I just have to use rl.begin();

But why would this not work?

Here's the code with "true":
Code:
package org.xith.tests;

import org.jagatoo.input.*;
import org.jagatoo.input.devices.components.*;
import org.jagatoo.input.events.*;
import org.xith3d.base.*;
import org.xith3d.loop.*;
import org.xith3d.render.*;
import org.xith3d.resources.*;
import org.xith3d.scenegraph.*;
import org.xith3d.scenegraph.primitives.*;
import org.xith3d.utility.interpolate.*;



/**
 * XIN - Animation example coding.
 *
 * @author Marvin Froehlich (aka Qudus)
 */
public class Chapter07a
extends InputAdapterRenderLoop
{

private Transform3D t3d;
private TransformGroup tg;
private AngleInterpolater angleX;
private AngleInterpolater angleY;


@SuppressWarnings( "incomplete-switch" )
@Override
public void onKeyReleased( final KeyReleasedEvent e, final Key key ) {
System.out.println( key.getName() + " " + e.getWhen() );
switch ( key.getKeyID() ) {
case ESCAPE:
end();
break;
}
}


@Override
public void onMouseButtonReleased( final MouseButtonReleasedEvent e, final MouseButton button ) {
System.out.println( "button=" + button + " " + e.getWhen() );
if ( button == MouseButtons.RIGHT_BUTTON ) {
end();
}
}


private BranchGroup createScene() {
final Cube cube = new Cube( 3.0f, "stone.jpg" );

t3d = new Transform3D();
tg = new TransformGroup( t3d );

tg.addChild( cube );

return ( new BranchGroup( tg ) );
}


@Override
protected void onRenderLoopStarted() {
angleX = new AngleInterpolater( 1.0f );
angleY = new AngleInterpolater( 1.0f );

angleX.startIncreasing( getGameMicroTime() );
angleY.startIncreasing( getGameMicroTime() );
}


@Override
protected void prepareNextFrame( final long gameTime, final long frameTime, final TimingMode tm ) {
super.prepareNextFrame( gameTime, frameTime, tm );

final long micros = tm.getMicroSeconds( gameTime );

t3d.rotXYZ( angleX.getValue( micros ), angleY.getValue( micros ), 0.0f );
tg.setTransform( t3d );
// try {
// Thread.sleep( 100 );
// } catch ( final InterruptedException e ) {
// throw Q.rethrow( e );
// }
}


public Chapter07a() throws Exception {
super( 120f );

final Xith3DEnvironment env = new Xith3DEnvironment( this );

final Canvas3D canvas = Canvas3DFactory.createWindowed( 800, 600, "Animation - Rotation" );
env.addCanvas( canvas );

InputSystem.getInstance().registerNewKeyboardAndMouse( canvas.getPeer() );

final ResourceLocator resLoc = ResourceLocator.create( "test-resources/" );
resLoc.createAndAddTSL( "textures" );

env.addPerspectiveBranch( createScene() );
}


public static void main( final String[] args ) throws Exception {
final Chapter07a rl = new Chapter07a();

rl.begin( true );
}
}
Logged

defaults man, they are evil ...
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #1 on: 07. December 2011, 09:36:29 am »

IIRC there was a problem with LWJGL using a separate thread. But you should be fine with using the main thread. Well, you could start a separate thread to initialize and start the whole render stuff though.
Logged
jeffhoye
developers
Enjoying the stay
***
Offline Offline

Posts: 32


View Profile Email
« Reply #2 on: 29. December 2011, 12:19:56 pm »

Hi minikidder,
  I had the same problem.  I just posted a solution in another thread.  I'm curious if it works in win7.

http://xith.org/forum/index.php/topic,1838.msg12294.html#msg12294

-Jeff

Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic