title: How to implement Frustum Culling? (Lag when rendering many blocks)
body: <p>I'm creating a game, in which when I render many blocks. The fps goes seriously down and everything lags. I know why it is lagging, because of many objects being rendered at once, but I can't figure out how to create and implement a frustum culling or any type of culling class to my game.</p>
  
  <p>NOTE: I'm using VBOs.</p>
  
  <p>I just can't find on the net; please help.</p>
  
  <p>Here is some of my code:</p>
  
  <pre><code>//Render Game this were I render my game 
  public void Render_GAME() {
      Update();
      if (isGameRunning == true) {
         Update();
         world.render();
         p1.Update();
         }
   }
  </code></pre>
  
  <p><strong>Flat Class: where I render block</strong></p>
  
  <pre><code>package game.terrain.biomes;
  
  import core.camera.*;
  import core.graphics.*;
  import core.math.*;
  import game.blocks.*;
  import game.Player;
  
  public class Flat{
  
  //Global Variables:
  private int width;
  private int height;
  private int depth;
  
  private SpaceStone[][][] blocks;
  
  public Flat(int width, int height, int depth)
  {
      this.width = width;
      this.height = height;
      this.depth = depth;
  
      blocks = new SpaceStone[width][height][depth];
  
      createBlocks();
  }
  
  //Create Blocks
  private void createBlocks()
  {
      SpaceStone.createBlock();
  
      for(int x = 0; x &lt; width; x += 5)
      {
          for(int y = 0; y &lt; height; y += 5)
          {
              for(int z = 0; z &lt; depth; z += 5)
              {
                  blocks[x][y][z] = new SpaceStone(new Vector3f(x, y, z), new Vector3f(0, 0, 0), new Vector3f(2.5f, 2.5f, 5f));
              }
          }
      }
  }
  
  //Render Blocks
  private void renderBlocks()
  {   
      Shader.BLOCK.Enable();
      SpaceStone.blocktex.bindTexture();
      SpaceStone.block.Bind();
  
      Shader.BLOCK.setUniform1i("tex", 1);
  
      Matrix4f viewMatrix = Player.getViewMatrix(Player.getCamera()); 
      Shader.BLOCK.setUniformMat4f("pr_matrix", Player.getPerspective());
  
      for(int i = 0; i &lt; width; i += 5)
      {
          for(int j = 0; j &lt; height; j += 5)
          {
              for(int k = 0; k &lt; depth; k += 5)
              {
                  Matrix4f transform = new Transformation().getTransform(blocks[i][j][k], viewMatrix);
                  Shader.BLOCK.setUniformMat4f("vw_matrix", transform);
                  SpaceStone.block.Draw();
              }
          }
      }
  
      Shader.BLOCK.Disable();
      SpaceStone.blocktex.unbindTexture();
      SpaceStone.block.Unbind();
  }
  
  //Render Flat Biome
  public void renderFlatBiome()
  {
      //Render Blocks
      renderBlocks();
  }
  }
  </code></pre>
  
  <p>If you want more information, such as classes or the whole project please comment and notify me.</p>