LWJGL way slower than JSR-231

hi

After I implemented all necessary code to get LWJGL running (esp. with my Canvas3DWrapper) and added an appropriate selector to org.xith3d.test.Xith3DTestStarter I ran the org.xith3d.test.benchmark.MultiCubeBenchmark with both JSR-231 and LWJGL. Here are the results:

Linux, JSR-231: 41 FPS
Linux, LWJGL: 30 FPS
Windows, JSR-231: 27 FPS
Windows, LWJGL: 19 FPS

First of all it is surprising, that the linux implementation is much faster than the windows one (In general the windows driver is a little faster than the linux pendant). But I always thought, LWGJL was a little faster than JSR-231. These results tell a different thing.

Maybe it depends from case to case, but this difference is blatant, isn’t it?

Your’ve f0ked up somewhere in your canvas3d implementation. Im willing to bet your changing contexts every frame somewhere in your code…

Paste your code somewhere and if I have some spare time tonight, i’ll have a look at it

DP

No, I don’t. The context is changed once in the beginning of the render thread before the actual loop.

The code is on the toolkit CVS. You can find it there. It is not a single code block, that I can paste here.

I would love to see you checking my code.

Qudus

Your going to have to guide me through some of the code since I dont know how to use Xith, nor do I know how it works…

So canvas = window ? I can see you’ve released the context, where do you make it current again ? Also, it would be nice if there was a self-contained test case to show how LWJGL is slower than JSR231…

My own engine has support for LWJGL and JSR231 and the FPS is pretty much identical…

DP

The test case I used is this org.xith3d.test.benchmark.MultiCubeBenchmark. It is bretty short and should be easy to understand. Just ignore the waveCubes and initScene methods on that task. This class can be started by its own or by Xith3DTestStarted (which I suggest).

In most cases the Canvas is aproximately equal to a window. Actually a Canvas3D is the plane to draw 3D things on. In most cases the Canvas has an attached window and nothing more or runs exclusively. But I think, you’ll know that.

The MultiCubeBenchmark class extends the ExtRenderLoop class which itself extends RenderLoop. The begin() method of the RenderLoop class starts the Thread and in the run() method of the Thread there is the while-loop. In this run() method before the while-loop begins there is a call of onRenderLoopStarted(). This method calls the checkRenderPreferences() method of all attached instances of RenderEngine. RenderEngine is an interface, which is so far only implemented by Xith3DEnvironment. Xith3DEnvironment implements the checkRenderPreferences() method the way, that it tries to call Display.makeCurrent(). So this call is in the render thread and will be called only once.

Qudus.