The different renderers

From JPCT
Revision as of 23:30, 1 February 2013 by Admin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The different renderers

jPCT comes with four different renderers:

Software renderers

The software renderers are Java 1.1 compatible. There are two them, but one is considered as deprecated.

  • the legacy software renderer: It's deprecated, don't use it
  • the OpenGL-alike software renderer: This is the default renderer when creating a new frame buffer

The software renderers don't support all features that the hardware ones do, especially multi-texturing isn't supported.

Hardware renderers

The hardware renderers require at least Java 1.4, Java5 or 6 are recommended. They are both using OpenGL via LWJGL, so your driver has to support this. The Microsoft OpenGL drivers that come with Windows don't support OpenGL properly. Use a driver from your card's vendor instead. The two renderers are:

  • the native OpenGL renderer: Renders into a native (i.e. not using AWT/Swing) OpenGL window. AWT or Swing aren't possible in this window
  • the AWTGLRenderer: Based on LWJGL's AWTGLCanvas, this renderer renders into an AWT canvas. All painting is done in the awt event dispatch thread. jPCT takes care of this.

Because the AWTGLRenderer uses the awt event dispatch thread to paint (like Swing/AWT), your application will automatically run multi-threaded and benefit from multi-cores. The native OpenGL renderer can do this too. To enable it, set Config.useMultipleThread to true. But keep in mind that from now on, all OpenGL/window/keyboard/mouse related code should be executed in the render thread too, which isn't your application's main thread any longer. To do this, have a look at the IPaintListener-interface. It's methods are ensured to be called in the render thread.

JOGL support

jPCT supports JOGL 1.1 from version 1.18 on. The support for JOGL is different from what other engines do. jPCT doesn't really provide an additional renderer for it (well, there is such a class mentioned in the docs, but it doesn't contain rendering code itself but relies on the implementation of AWTGLRenderer). What applies to the AWTGLRenderer applies to the JOGL renderer too. The support for a native window just isn't there when using the JOGL option (Have a look at How to install to learn how to activate JOGL support). Keep in mind that JOGL isn't jPCT's first target platform. By heart, it's a LWJGL based engine. I suggest to go with LWJGL if possible and use JOGL only if you have to. If you are using JOGL, keep in mind that only jPCT's core components are JOGL compatible, i.e. if you are using GL commands in your own code, you have to use the underlying binding instead, in this case JOGL. jPCT uses JOGL 1.1.1. If you are having problems downloading it, here's a zipped version: JOGL 1.1.1