video.glrenderer - ICE 0.1 API documentation

ICE 0.1 API documentation

# video.glrenderer

OpenGL draw cache/renderer.

struct GLRenderer;

  Caches rendering commands and executes them at the end of the frame.

  GLRenderer works as a rendering cache. Every draw call generates vertices which are stored in buffers passed to OpenGL at the end of the frame. State changes (shader, texture, scissor) are also recorded. Everything is rendered in order of draw calls used.

  this(const(GLDrawMode) mode);

    Construct a GLRenderer.

    Parameters:

    const(GLDrawMode) mode | Draw mode to use.

  void reset();

    Reset all frame state. (end the frame)

  const @property uint vertexCount();

    Get number of vertices used during the frame so far.

  const @property uint indexCount();

    Get number of indices used during the frame so far.

  const @property uint vertexGroupCount();

    Get number of vertex groups created during the frame so far.

  @property void drawMode(const GLDrawMode mode);

    Set draw mode. Should not be called during a frame.

  const pure @property bool initialized();

    Is the GLRenderer initialized?

  pure void setShader(GLShader* shader);

    Set shader to use in following draw calls.

  pure void setTexturePage(TexturePage!(BinaryTexturePacker,GLTextureBackend)* page);

    Set texture page to use in following draw calls.

  void scissor(ref const Recti scissorArea);

    Set scissor area to use in following draw calls. Only this area will be drawn to.

  pure void disableScissor();

    Disable scissor test for following draw calls.

  pure @property void viewZoom(const float zoom);

    Set view zoom for following draw calls.

  const pure @property real viewZoom();

    Get view zoom.

  pure @property void viewOffset(const Vector2f offset);

    Set view offset for following draw calls.

  const pure @property Vector2f viewOffset();

    Get view offset.

  pure @property void lineWidth(const real width);

    Set line width for following draw calls.

  pure @property void lineAA(const bool aa);

    Set line antialiasing (on or off) for following draw calls.

  void drawLine(const Vector2f v1, const Vector2f v2, const Color c1, const Color c2);

    Draw a line.

    Color will be linearly interpolated from start to end point.
    Line start and end point should never be the same - passing identical start and end point will result in undefined behavior.

    Parameters:

    Vector2f v1 | Start point of the line.
    Vector2f v2 | End point of the line.
    Color c1 | Color at the start point of the line.
    Color c2 | Color at the end point of the line.

  void drawRect(const Vector2f min, const Vector2f max, const Color color);

    Draw a rectangle.

    Parameters:

    Vector2f min | Minimum dimensions of the rectangle.
    Vector2f max | Maximum dimensions of the rectangle.
    Color color | Rectangle color.

  void drawTexture(const Vector2f min, const Vector2f max, const Vector2f tMin, const Vector2f tMax, const Color color = rgb!("FFFFFF"));

    Draw a textured rectangle.

    Parameters:

    Vector2f min | Minimum dimensions of the rectangle.
    Vector2f max | Maximum dimensions of the rectangle.
    tMix | Minimum texture coordinates of the rectangle.
    Vector2f tMax | Maximum texture coordinates of the rectangle.
    Color color | Base rectangle color.

  void render(const uint screenWidth, const uint screenHeight);

    Render out data specified with previous draw calls.

    Parameters:

    uint screenWidth | Video mode width.
    uint screenHeight | Video mode height.

Copyright © Ferdinand Majerech 2011. | Page generated by AutoDDoc and Ddoc.