[][src]Module fae::renderer

The rendering module.

This module is responsible for the actual drawing procedures, written in OpenGL. Usage in general terms:

  • Create a window and load the OpenGL functions with gl::load_with.
  • Create draw calls for each texture you want to use.
  • Draw with Renderer::draw_quad and similar functions using the draw call index to use specific textures.

Optimization tips

  • Try to define different Z coordinates for your elements, and draw the ones in front first. This way you'll avoid rendering over already drawn pixels. If you're rendering lots of sprites, this is a good place to start optimizing.
  • If possible, make your textures without using alpha values between 1 and 0 (ie. use only 100% and 0% opacity), and disable alpha_blending in your draw call.
  • If this crate is the only place where OpenGL calls are made, or if you're handling OpenGL state properly yourself, set your Renderer's preserve_gl_state to false.

Structs

DrawCallHandle

A handle with which you can draw during a specific draw call. Created during Renderer::create_draw_call, used during Renderer::draw_quad and its variations.

DrawCallParameters

Options which set capabilities, restrictions and resources for draw calls. Used in Renderer::create_draw_call.

Renderer

Contains the data and functionality needed to draw rectangles with OpenGL. Requires a valid OpenGL context.

Shaders

Represents the shader code for a shader. Used in Renderer::create_draw_call.