VVISF & VVGL
Sample Code V- ISFScene renders ISF files

Creating an ISFScene

VVISF::ISFScene is a subclass of VVGL::GLScene, and as such shares its facilities for rendering to texture, simple resizing, etc. Likewise, creating VVISF::ISFScene has the same semantics as creating a VVGL::GLScene- if you don't explicitly provide a VVGL::GLContext for it to use on creation, it will create its own context in the global buffer pool's sharegroup.

// put together a shared context and create the global buffer pool
// create an ISFScene- this line creates an ISFScene that makes a new
// GL context which shares the global buffer pool's context
// another way to create an ISFScene- this line creates an ISFScene that
// uses the shared context directly (it doesn't create a new GL context)
ISFSceneRef tmpScene = CreateISFSceneRefUsing(sharedCtx);
// ...and here's a third way to create a scene- this line creates a new
// GL context and uses it (functionally identical to the first example)
ISFSceneRef tmpScene = CreateISFSceneRefUsing(sharedCtx->newContextSharingMe());

Loading an ISF file and rendering it to a GL texture

Once you have an ISFScene, you can render it to a texture using any of the functions inherited from VVGL::GLScene. ISFScene::createAndRenderABuffer() is perhaps the simplest function- if you have more specific needs, consult the documentation for ISFScene.

// put together a shared context and create the global buffer pool
// create an ISFScene- this line creates an ISFScene that makes a new
// GL context which shares the global buffer pool's context
// configure the ISFScene to throw exceptions during file loading/shader compiling
tmpScene->setThrowExceptions(true);
try {
// tell the ISFScene to load a file
tmpScene->useFile(string("/path/to/ISF_file.fs"));
// tell the ISFScene to render a frame
GLBufferRef tmpFrame = tmpScene->createAndRenderABuffer(VVGL::Size(1920,1080));
}
catch (ISFErr & exc) {
cout << "ERR: caught exception: " << exc.genTypeString() << ": " << exc.general << "- " << exc.specific << endl;
}