Difference between revisions of "The different renderers"

From JPCT
Jump to: navigation, search
(Hardware renderers)
Line 17: Line 17:
  
 
* 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 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 thread. jPCT takes care of this.
+
* 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.

Revision as of 19:33, 7 April 2009

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 drivers that come with Windows XP and Vista don't support OpenGL. 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.