com.threed.jpct
Interface IRenderer

All Known Implementing Classes:
AWTGLRenderer, GLRenderer, LegacyRenderer, SoftGLRenderer

public interface IRenderer

jPCT supports different renderers in different modes. For the time being, jPCT offers support for software rendering in legacy mode (default and equal to every version prior to 0.83) and OpenGL mode (still software, but using OpenGL's lighting model). In addition, jPCT offers support for hardware acceleration via OpenGL by using the LWJGL. Hardware OpenGL-support is available in OpenGL mode only.
Renderers can be enabled/disabled via the FrameBuffer class.
The methods defined by this Interface shouldn't be called directly by an application.

See Also:
FrameBuffer.enableRenderer(int,int), FrameBuffer.disableRenderer(int), FrameBuffer.enableGLCanvasRenderer()

Field Summary
static int MODE_LEGACY
          The legacy jPCT lighting model should be used (valid for software mode only)
static int MODE_OPENGL
          The standard OpenGL lighting model should be used (default)
static int RENDERER_OPENGL
          jPCT should use hardware accelerated rendering using OpenGL
static int RENDERER_SOFTWARE
          jPCT should use software rendering (default)
 
Method Summary
 void dispose()
          Disposes the renderer and all its resources if it's not used any longer.
 void drawPolygon(VisList visList, int ind, FrameBuffer buffer, World world)
          Draws a polygon.
 void drawStrip(VisList visList, int ind, int length, FrameBuffer buffer, World world)
          Draws a triangle strip.
 void drawVertexArray(VisList visList, int start, int end, FrameBuffer buffer, World world)
          Draws a vertex array.
 void drawWireframe(VisList visList, int ind, int color, FrameBuffer buffer, World world)
          Draws a polygon's wireframe.
 void execute(int mode, java.lang.Object[] params)
          Executes the renderer specific function.
 VideoMode[] getAvailableVideoModes()
          Get all available video modes.
 void init(int x, int y, int cbpp, int zbpp, int samples)
          Initialize the renderer.
 boolean isInitialized()
          Returns true, if the Renderer has been initialized and false otherwise.
 void setPaintListener(IPaintListener listener)
          Sets a listener that will be called before the actual painting starts and after it has finished.
 

Field Detail

RENDERER_SOFTWARE

public static final int RENDERER_SOFTWARE
jPCT should use software rendering (default)

See Also:
Constant Field Values

RENDERER_OPENGL

public static final int RENDERER_OPENGL
jPCT should use hardware accelerated rendering using OpenGL

See Also:
Constant Field Values

MODE_OPENGL

public static final int MODE_OPENGL
The standard OpenGL lighting model should be used (default)

See Also:
Constant Field Values

MODE_LEGACY

public static final int MODE_LEGACY
The legacy jPCT lighting model should be used (valid for software mode only)

See Also:
Constant Field Values
Method Detail

init

public void init(int x,
                 int y,
                 int cbpp,
                 int zbpp,
                 int samples)
Initialize the renderer. This method is called by the FrameBuffer class and there should be no need to call it directly.

Parameters:
x - the width of the videomode/framebuffer
y - the height of the videomode/framebuffer
cbpp - the minimal colordepth
zbpp - the minimal depthbuffer-depth
samples - the number of samples to take when using multi sampling AA

dispose

public void dispose()
Disposes the renderer and all its resources if it's not used any longer. Will be called automatically if needed...there's no need to call it directly from inside an application.


drawPolygon

public void drawPolygon(VisList visList,
                        int ind,
                        FrameBuffer buffer,
                        World world)
Draws a polygon. No need to call this method directly.

Parameters:
visList - the VisibilityList
ind - the index of the polygon
buffer - the current FrameBuffer
world - the current instance of World

drawVertexArray

public void drawVertexArray(VisList visList,
                            int start,
                            int end,
                            FrameBuffer buffer,
                            World world)
Draws a vertex array. No need to call this method directly.

Parameters:
visList - the VisibilityList
start - the index of the first polygon
end - the index of the last polygon
buffer - the current FrameBuffer
world - the current instance of World

drawStrip

public void drawStrip(VisList visList,
                      int ind,
                      int length,
                      FrameBuffer buffer,
                      World world)
Draws a triangle strip. No need to call this method directly.

Parameters:
visList - the VisibilityList
ind - the index of the strip
length - the length of the strip
buffer - the current FrameBuffer
world - the current instance of World

drawWireframe

public void drawWireframe(VisList visList,
                          int ind,
                          int color,
                          FrameBuffer buffer,
                          World world)
Draws a polygon's wireframe. No need to call this method directly.

Parameters:
visList - the VisibilityList
ind - the index of the polygon
color - the wireframe's color
buffer - the current FrameBuffer

execute

public void execute(int mode,
                    java.lang.Object[] params)
Executes the renderer specific function. As usual, there is no need to call this directly so the functions are not documented here.

Parameters:
mode - the mode
params - the parameters for this mode

getAvailableVideoModes

public VideoMode[] getAvailableVideoModes()
Get all available video modes. Will be called from the FrameBuffer class when calling getVideoModes(int). For the OpenGL renderer, the returned z-buffer value is NOT what the driver tells but simply the value from Config.glZBufferDepth. The reason for this is, that LWJGL (which is used for the OpenGL binding) doesn't return this value anymore since version 0.6.

Returns:
the video modes the renderer supports (only valid for OpenGL at the moment, software renderer will return an empty array).
See Also:
FrameBuffer.getVideoModes(int)

isInitialized

public boolean isInitialized()
Returns true, if the Renderer has been initialized and false otherwise.

Returns:
initialized...or not

setPaintListener

public void setPaintListener(IPaintListener listener)
Sets a listener that will be called before the actual painting starts and after it has finished.

Parameters:
listener - IPaintListener the listener or null to remove it