Rendering Performance in Canvas Very Bad

Hi again.



On my journey in creating an embedded 3d view I constructed a model yesterday, which serves as a foundation for updating JME’s geometry.



Next I started a separate thread to actively render 3D. This thread first changes the world model (by simply rotating some lines), then updates the corresponding nodes and finally calls canvas.paint(null).



In summary, I have three lines in my canvas; each related to a quad containing a texture. Every pass I simply calculate some sin() and cos() values and update the .y and .z position. The canvas is embedded in a swing panel.



Unfortunately, the performance of this approach is less than satisfying. It feels as if there are no more than 10FPS at max. I also did a profiling run, and the top two time-eaters are:



.


  1. Does anyone have an idea how to improve this?


  2. What would be the best option to mix active (OpenGL) and passive (Swing) rendering to archive the highest performance? (The OpenGL canvas must be able to smoothly render i.e., >> ~30 FPS) and also every Swing widget must be usable nicely.


  3. What might I be doing wrong?



    Posting code is a bit difficult, as the appropriate lines are scattered among lot of classes. But maybe at least the rendering code:


 
@Override
    public void doRender() {
        this.renderer.setBackgroundColor(ColorRGBA.black);
        this.renderer.clearBuffers();
        this.renderer.draw(this.rootNode);

        if (this.fengGuiDisplay != null) this.fengGuiDisplay.display();

        this.renderer.displayBackBuffer();
    }



And the repaint code:

 ((LWJGLCanvas) JMEAdapter.this.canvas).paint(null);