Author Topic: Multiple Environments ?  (Read 2292 times)

Offline mmcrosb

  • Just dropped in
  • Posts: 6
    • View Profile
    • Email
Multiple Environments ?
« on: 01. April 2015, 01:03:13 PM »
Exception in thread "main" java.lang.IllegalStateException: From thread Thread[Thread-1,5,main]: Thread[main,5,main] already has the context current
   at org.lwjgl.opengl.Context.checkAccess(Context.java:179)
   at org.lwjgl.opengl.Context.makeCurrent(Context.java:184)
   at org.lwjgl.opengl.AbstractDrawable.makeCurrent(AbstractDrawable.java:43)
   at org.lwjgl.opengl.Display.makeCurrent(Display.java:730)
   at org.xith3d.render.lwjgl.CanvasPeerImplNative.makeCurrent(CanvasPeerImplNative.java:518)
   at org.xith3d.render.lwjgl.CanvasPeerImplBase.beforeRenderStart(CanvasPeerImplBase.java:203)
   at org.xith3d.render.lwjgl.RenderPeerImpl.renderStart(RenderPeerImpl.java:401)
   at org.xith3d.render.lwjgl.RenderPeerImpl.render(RenderPeerImpl.java:826)
   at org.xith3d.render.lwjgl.CanvasPeerImplBase.doRender(CanvasPeerImplBase.java:331)
   at org.xith3d.render.lwjgl.CanvasPeerImplNative.initRenderingImpl(CanvasPeerImplNative.java:628)
   at org.xith3d.render.DefaultRenderer.doRender(DefaultRenderer.java:524)
   at org.xith3d.render.DefaultRenderer.renderOnceInternal(DefaultRenderer.java:686)
   at org.xith3d.render.DefaultRenderer.renderOnce(DefaultRenderer.java:819)
   at org.xith3d.base.Xith3DEnvironment.render(Xith3DEnvironment.java:501)
   at org.xith3d.loop.RenderLoop.renderNextFrame(RenderLoop.java:619)
   at org.xith3d.loop.RenderLoop.loopIteration(RenderLoop.java:642)
   at org.xith3d.loop.RenderLoop.update(RenderLoop.java:698)
   at org.xith3d.loop.UpdatingThread.nextIteration(UpdatingThread.java:487)
   at org.xith3d.loop.RenderLoop.nextIteration(RenderLoop.java:709)
   at org.xith3d.loop.RenderLoop.loop(RenderLoop.java:762)
   at org.xith3d.loop.UpdatingThread.run(UpdatingThread.java:540)
   at org.xith3d.loop.RenderLoop.run(RenderLoop.java:785)
   at org.xith3d.loop.RenderLoop.begin(RenderLoop.java:841)
   at org.xith3d.loop.RenderLoop.begin(RenderLoop.java:871)


Code: [Select]
public class Environment extends Xith3DEnvironment {
   
    public Environment() throws InputSystemException {
        //Manual Library Installation and Load
        System.load("/usr/java/packages/lib/xith3d/liblwjgl64.so");
        this.setRenderLoop(new Loop());
        this.getRenderLoop().setXith3DEnvironment(this);
        this.addCanvas(Canvas3DFactory.createWindowed("Hola que ase"));
        this.input = new Input();
        this.input.registerNewKeyboardAndMouse(this.getCanvas().getPeer());
        new Thread() {
            @Override
            public void run() {
                getRenderLoop().begin();
            }
        }.start();
    }
   
    private Input input;
    public final Input getInputSystem() { return input; }
   
}

new Environment(); new Environment();

Offline mmcrosb

  • Just dropped in
  • Posts: 6
    • View Profile
    • Email
Re: Multiple Environments ?
« Reply #1 on: 01. April 2015, 02:58:29 PM »
be a great idea to start the environment and loop, not static, and multi-threading available