A plugin is able to take over the main rendering loop and have the application render to one or more back buffewrs instead of the screen so that the plugin can modify the render output before drawing it to screen. If betray_plugin_callback_set_image_warp is called a separate OpenGL context will be created to the plugin so that it can set state and draw indipendently from the application. If the application sets the betray_plugin_callback_set_image_warpcallback, it needs to in that call back to call betray_plugin_application_draw to signal to the application that it needs it to draw its graphics to a specific FBO. betray_plugin_callback_set_image_warp can only be called once and only inside the betray_plugin_init function.
void betray_plugin_callback_set_image_warp(boolean (*image_warp)(BInputState *input, char *name));Description: Set a callback to give you access to the image as a texture, and lets you return a different texture for screen drawing. If the given callback returns false, betray will ignore it and itself trigger the application to draw. This call must be called BEFORE any openGL calls can be made, since it is responcible for creating a separate OpenGL context.
void betray_plugin_application_draw(uint fbo, uint x_size, uint y_size, float *vantage, boolean vantage_modify, float *matrix);Description: issues a draw call to the application to draw to a specific FBO, to a specific screen size. If the aplication binds FBO 0, this FBO will be bound instead. The plugin can modify the vantage and transformation matrix in order to produce multiple different vantages in order to support cave, or sterioscopic applications.