Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.threed.jpct
Interface IRenderHook

All Known Implementing Classes:
  GLSLShader

public interface IRenderHook

Provides a hook into the rendering pipeline of compiled Object3Ds. For any other object, the methods of this interface will never be called even if an implementation of it is attached to that object. This is meant to be used for executing your own OpenGL (or whatever...) code directly in the render pipeline. Can be useful to set up your own vertex and/or fragment shaders for an Object3D for example.
A render hook is attached to an Object3D. However, this doesn't mean that it's only called once per object. In fact, an object can be compiled into hundreds of display lists/vertex arrays. These methods will be called for each of them, if they are going to be rendered in this frame.

Method Summary
`void` | `afterRendering(int polyID)` Will be called immediately after the actual rendering takes place.
`void` | `beforeRendering(int polyID)` Will be called immediately before the actual rendering takes place.
`void` | `clear()` Will be called if this IRenderHook implemention has been used to render the current object-(part) but won't be used for the next one.
`void` | `onDispose()` Will be called, if the underlying compiled structures get disposed.
`boolean` | `repeatRendering()` If this returns true, the same geometry that was rendered will be rendered again using the exact same settings. beforeRendering() won't be called again. afterRendering() won't be called yet.
`void` | `setCurrentObject3D(Object3D obj)` Sets the currently rendered object.

Method Detail

### beforeRendering

    public void beforeRendering(int polyID)

  Will be called immediately before the actual rendering takes place. It is guaranteed that this happens within the thread that is bound to the OpenGL context, i.e. you can execute OpenGL commands within here. Texture stages, blending modes, lighting and all is already set up as the object's configuration demands it.

  Parameters:
    `polyID` - the ID of the polygon that is first in the current list that is about to render.

### afterRendering

    public void afterRendering(int polyID)

  Will be called immediately after the actual rendering takes place. It is guaranteed that this happens within the thread that is bound to the OpenGL context, i.e. you can execute OpenGL commands within here.

  Parameters:
    `polyID` - the ID of the polygon that is first in the current list that is about to render.

### setCurrentObject3D

    public void setCurrentObject3D(Object3D obj)

  Sets the currently rendered object. This will be called before calling beforeRendering()

  Parameters:
    `obj` - the current Object3D

### onDispose

    public void onDispose()

  Will be called, if the underlying compiled structures get disposed. It's not guaranteed that this will happen in an application and depending on the object's compiled structure, it may happen several times.

### repeatRendering

    public boolean repeatRendering()

  If this returns true, the same geometry that was rendered will be rendered again using the exact same settings. beforeRendering() won't be called again. afterRendering() won't be called yet.
  The rendering will be redone as often as this method returns true. If this method always returns true, you've created an infinite loop.

  Returns:
    true, if the rendering should be redone, false otherwise.

### clear

    public void clear()

  Will be called if this IRenderHook implemention has been used to render the current object-(part) but won't be used for the next one. This can be used to optimize some things. The idea is optimize setup/teardown work that would otherwise have to take place in every call to before- and afterRendering(). If you are not sure how to deal with this, just implement an empty method.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD