Extending Sparrow

Sometimes, you want to squeeze out the last bit of performance. You want to make the calls to OpenGL yourself. In Sparrow, that's easy to do. Just override the “render:” method that is implemented by any display object.

- (void)render:(SPRenderSupport *)support
{
    [support bindTexture:mTexture];
 
    glEnable(GL_POINT_SPRITE_OES);
    // ...
    glDisable(GL_POINT_SPRITE_OES);
}

In that sample, the developer wants to use OpenGL point sprites. By overriding the “render:” method, Sparrow will use this custom code to draw the object.

  • When the render method is executed, OpenGL's transformation matrices are already pointing to the local coordinate system.
  • The “support” object contains some methods that help during rendering, e.g. a “bindTexture:” method that only forwards the call to OpenGL if another texture is bound.

If you want to take this path, I recommend you have a look at Sparrow's default rendering code, and find some orientation there.

  manual_v1/extending_sparrow.txt · Last modified: 2013/03/05 10:19 by 127.0.0.1
 
Powered by DokuWiki