Conforms to NSObject
Declared in NGLCoreEngine.h

Overview

The NGLCoreEngine protocol defines the basic methods for a engine in NinevehGL.

A NinevehGL engine is responsible for anything related to the render process with a specif OpenGL version. It creates and manages the necessary buffers, the render filters and the viewport.

Tasks

  •   antialias

    Indicates the number of samples at each pixel to create the anti-alias filter. The NGLAntialiasNone value represents that no filter will be used.

    property required method
  •   useDepthBuffer

    Indicates whether the render engine will use or not the Depth Render Buffer.

    property required method
  •   useStencilBuffer

    Indicates whether the render engine will use or not the Stencil Render Buffer.

    property required method
  •   layer

    The CAEAGLLayer used by this instance.

    property required method
  •   offscreenData

    Returns the pointer to the last generated offscreen render.

    property required method
  •   framebuffer

    Gets the current OpenGL framebuffer for this engine.

    property required method
  •   renderbuffer

    Gets the current OpenGL renderbuffer (color) for this engine.

    property required method
  •   width

    Gets the current OpenGL framebuffer width.

    property required method
  •   height

    Gets the current OpenGL framebuffer height.

    property required method
  • – initWithLayer:

    Initiates the NGLCoreEngine class with a CAEAGLLayer.

    required method
  • – defineBuffers

    Constructs the Frame and Render Buffers. Must be called to start the OpenGL buffers.

    required method
  • – clearBuffers

    Clean up all the buffers (Frame and Render Buffers). Must be called to delete the OpenGL buffers.

    required method
  • – preRender

    The first method to be called at each render cycle.

    required method
  • – render

    The last method to be called at each render cycle.

    required method
  • – offscreenRender

    Makes a render data to an offscreen surface, storing the data. The data can be retrieved with offscreenData.

    required method
  • – offscreenRenderFree

    Frees the allocated memory from offscreenRender method.

    required method

Properties

antialias

Indicates the number of samples at each pixel to create the anti-alias filter. The NGLAntialiasNone value represents that no filter will be used.

@property (nonatomic) NGLAntialias antialias

Discussion

Indicates the number of samples at each pixel to create the anti-alias filter. The NGLAntialiasNone value represents that no filter will be used.

The default value is equal to the global antialias.

Declared In

NGLCoreEngine.h

framebuffer

Gets the current OpenGL framebuffer for this engine.

@property (nonatomic, readonly) unsigned int framebuffer

Discussion

Gets the current OpenGL framebuffer for this engine.

Declared In

NGLCoreEngine.h

height

Gets the current OpenGL framebuffer height.

@property (nonatomic, readonly) float height

Discussion

Gets the current OpenGL framebuffer height.

Declared In

NGLCoreEngine.h

layer

The CAEAGLLayer used by this instance.

@property (nonatomic, assign) CAEAGLLayer *layer

Discussion

The CAEAGLLayer used by this instance.

Declared In

NGLCoreEngine.h

offscreenData

Returns the pointer to the last generated offscreen render.

@property (nonatomic, readonly) unsigned char *offscreenData

Discussion

Returns the pointer to the last generated offscreen render.

Renders to offscreen surfaces are produced by calling offscreenRender. Calling this property doesn’t generate any new offscreen render.

Declared In

NGLCoreEngine.h

renderbuffer

Gets the current OpenGL renderbuffer (color) for this engine.

@property (nonatomic, readonly) unsigned int renderbuffer

Discussion

Gets the current OpenGL renderbuffer (color) for this engine.

Declared In

NGLCoreEngine.h

useDepthBuffer

Indicates whether the render engine will use or not the Depth Render Buffer.

@property (nonatomic) BOOL useDepthBuffer

Discussion

Indicates whether the render engine will use or not the Depth Render Buffer.

The default value is NO.

Declared In

NGLCoreEngine.h

useStencilBuffer

Indicates whether the render engine will use or not the Stencil Render Buffer.

@property (nonatomic) BOOL useStencilBuffer

Discussion

Indicates whether the render engine will use or not the Stencil Render Buffer.

The default value is YES.

Declared In

NGLCoreEngine.h

width

Gets the current OpenGL framebuffer width.

@property (nonatomic, readonly) float width

Discussion

Gets the current OpenGL framebuffer width.

Declared In

NGLCoreEngine.h

Instance Methods

clearBuffers

Clean up all the buffers (Frame and Render Buffers). Must be called to delete the OpenGL buffers.

- (void)clearBuffers

Discussion

Clean up all the buffers (Frame and Render Buffers). Must be called to delete the OpenGL buffers.

This method erases all the buffers in this engine and make it empty again.

This method should be called by the NGLCoreEngine owner before release it.

Declared In

NGLCoreEngine.h

defineBuffers

Constructs the Frame and Render Buffers. Must be called to start the OpenGL buffers.

- (void)defineBuffers

Discussion

Constructs the Frame and Render Buffers. Must be called to start the OpenGL buffers.

This method constructs the bridge between OpenGL render and device’s window system. The window system is responsible for drawing the image on the device’s screen.

This method should be called every time the layer change its properties, like size, position or color.

Declared In

NGLCoreEngine.h

initWithLayer:

Initiates the NGLCoreEngine class with a CAEAGLLayer.

- (id)initWithLayer:(CAEAGLLayer *)layer

Parameters

layer

A CAEAGLLayer instance. All the following render settings will be made based on this layer and the render will be shown on it.

Return Value

A new instance of NGLCoreEngine.

Discussion

Initiates the NGLCoreEngine class with a CAEAGLLayer.

This method initializes a NGLCoreEngine instance and set its layer.

Declared In

NGLCoreEngine.h

offscreenRender

Makes a render data to an offscreen surface, storing the data. The data can be retrieved with offscreenData.

- (void)offscreenRender

Discussion

Makes a render data to an offscreen surface, storing the data. The data can be retrieved with offscreenData.

This method doesn’t make new renders, it just retrieve the image from the last rendered frame. The data is stored in the memory, that memory can be freed by: – Calling this method again. The last memory will replaced by the new one; – Deallocking this instance; – Calling offscreenRenderFree method.

The pixel data are in OpenGL format, which means the first pixel is in the lower left corner of the image, reading line by line, the last pixel is in the upper right corner.

Declared In

NGLCoreEngine.h

offscreenRenderFree

Frees the allocated memory from offscreenRender method.

- (void)offscreenRenderFree

Discussion

Frees the allocated memory from offscreenRender method.

This method will automatically be called when the current instance is deallocated.

Declared In

NGLCoreEngine.h

preRender

The first method to be called at each render cycle.

- (void)preRender

Discussion

The first method to be called at each render cycle.

This method should be called to make a clean up and reset any necessary variable to start a new render cycle.

Declared In

NGLCoreEngine.h

render

The last method to be called at each render cycle.

- (void)render

Discussion

The last method to be called at each render cycle.

This method will deal with the Frame and Render Buffers, with the filters and any other necessary process to produce the final image. Then it will output the render’s image to the desired surface previously defined.

Declared In

NGLCoreEngine.h