/**
   * Renders entieis to the shadow map. Each model is first bound and then all of the entities using
   * that model are rendered to the shadow map.
   *
   * @param entities - the entities to be rendered to the shadow map.
   */
  protected void render(Map<TexturedModel, List<Entity>> entities) {
    for (TexturedModel model : entities.keySet()) {
      RawModel rawModel = model.getRawModel();
      bindModel(rawModel);
      GL13.glActiveTexture(GL13.GL_TEXTURE0);
      GL11.glBindTexture(GL11.GL_TEXTURE_2D, model.getTexture().getID());
      if (model.getTexture().hasTransparency()) MasterRenderer.disableCulling();

      for (Entity entity : entities.get(model)) {
        prepareInstance(entity);
        GL11.glDrawElements(GL11.GL_TRIANGLES, rawModel.getVertexCount(), GL11.GL_UNSIGNED_INT, 0);
      }

      if (model.getTexture().hasTransparency()) MasterRenderer.enableCulling();
    }
    GL20.glDisableVertexAttribArray(0);
    GL20.glDisableVertexAttribArray(1);
    GL30.glBindVertexArray(0);
  }
 /**
  * Binds a raw model before rendering. Only the attribute 0 is enabled here because that is where
  * the positions are stored in the VAO, and only the positions are required in the vertex shader.
  *
  * @param rawModel - the model to be bound.
  */
 private void bindModel(RawModel rawModel) {
   GL30.glBindVertexArray(rawModel.getVaoID());
   GL20.glEnableVertexAttribArray(0);
   GL20.glEnableVertexAttribArray(1);
 }