title: Image won't draw, Canvas+double Buffering+Buffered Image used
body: <p>Okay, so here's the deal: I'm trying to simply draw an object (in this case a tornado) onto my main canvas. I'm using JFrames, a canvas, a buffer strategy, and a buffered image to draw on. As far as I can figure I'm using the "game loop" correctly and from what I've been previously able to find my order of operations in the rendering is correct. Is there some thing I'm missing about the nature of using buffer strategies perhaps? I can't tell why i get just a grey screen.</p>
  
  <p>Basically I'm trying to get this tornado program working using as many "proper" graphical and coding techniques as possible. Ultimately all I want is a little city that has a tornado moving through it, with each component existing as an object (the tornado, buildings, people, etc). However I find myself unable to continue util I can actually draw the blasted! The code below should show you whatever else you need to know, I'm fairly new to programming and this is a high school project, so any other pointers are welcome but <strong>mostly I want to know why the tornado wont draw!</strong></p>
  
  <p>I'm using eclipse, by the way. and so far I've followed these toutorials and posts to get where I am now:</p>
  
  <p><a href="http://www.gamedev.net/page/resources/_/technical/general-programming/java-games-active-rendering-r2418" rel="nofollow">http://www.gamedev.net/page/resources/_/technical/general-programming/java-games-active-rendering-r2418</a></p>
  
  <p><a href="http://examples.javacodegeeks.com/desktop-java/awt/image/drawing-on-a-buffered-image/" rel="nofollow">http://examples.javacodegeeks.com/desktop-java/awt/image/drawing-on-a-buffered-image/</a></p>
  
  <p><strong>This is the main class:</strong></p>
  
  <pre><code>import java.awt.Canvas;
  import java.awt.Color;
  import java.awt.Graphics;
  import java.awt.Graphics2D;
  import java.awt.GraphicsConfiguration;
  import java.awt.GraphicsDevice;
  import java.awt.GraphicsEnvironment;
  import java.awt.Transparency;
  import java.awt.image.BufferStrategy;
  import java.awt.image.BufferedImage;
  import javax.swing.*;
  
  
  public class Main {
  
      static BufferStrategy BuffStrat;
      static Thread t1;
      static BufferedImage backbuff;
      static JFrame mainframe;
  
      static Tornado tornado;
  
      public static void main(String[] args) {
          Simulation();
      }
  
  
      public static void Setup() {
          mainframe = new JFrame("Tornado Ally");
          mainframe.setIgnoreRepaint(true);
          mainframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  
          Canvas maincanvas = new Canvas();
          maincanvas.setIgnoreRepaint(true);
          maincanvas.setSize(750, 600);
  
          mainframe.add(maincanvas);
          mainframe.pack();
          mainframe.setVisible(true);
  
          maincanvas.createBufferStrategy(2);
          BuffStrat = maincanvas.getBufferStrategy();
  
          GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
          GraphicsDevice gd = ge.getDefaultScreenDevice();
          GraphicsConfiguration gc = gd.getDefaultConfiguration();
  
          backbuff = gc.createCompatibleImage(750, 600, Transparency.BITMASK);
          tornado = new Tornado (0, 0, 0, 0, 0, backbuff);
      }
  
      public static void Simulation() {
          Setup();
  
          while (true) {
              Render();
              delay(10);
          }
      }
  
      public static void Render() {
  
          Graphics2D g = null; 
  
          g =  backbuff.createGraphics();
  
          g.setBackground(Color.LIGHT_GRAY);
          g.clearRect(0, 0, 750, 600);
          tornado.drawTornado(g);
  
          Graphics gI = BuffStrat.getDrawGraphics();
          gI.drawImage(backbuff, 0, 0, null);
  
          BuffStrat.show();
          gI.dispose();
          g.dispose();
  
      }
  
      public static void delay(int ms) {
          try {
              Thread.sleep(ms);
          } catch (InterruptedException e) {
  
          }
      }
  }
  </code></pre>
  
  <p><strong>This is the Tornado Object:</strong></p>
  
  <pre><code>import java.awt.Dimension;
  import java.awt.Graphics2D;
  import java.awt.GraphicsConfiguration;
  import java.awt.Image;
  import java.awt.geom.Dimension2D;
  import java.awt.image.BufferedImage;
  import java.io.File;
  import java.io.IOException;
  
  import javax.imageio.ImageIO;
  
  public class Tornado {
  
      int x, y, z;
      int mag;
      double velocity;
      Dimension2D hitbox;
  
      GraphicsConfiguration gc;
      Image t;
      BufferedImage backbuff;
  
  
      public Tornado(int x, int y, int z, int mag, double velocity, BufferedImage backbuff) {
          this.x = x;
          this.y = y;
          this.z = z;
          this.mag = mag;
          this.velocity = velocity;
          this.backbuff = backbuff;
  
          {
              try {
                  t = ImageIO.read(new File("Sprites.Tornado/TornadoFull.png"));
              } catch (IOException e) {
              }
          }
  
  
      }
  
      public void drawTornado(Graphics2D g) {
  
          g.drawImage(t, 0, 0, null);
      }
  
  }
  </code></pre>