title: Creating a hidden Canvas with LWJGL
body: <p>I'm beginning to write a special use graphing program and I'm leaning towards using OpenGL to generate the graphics. The ultimate goal is an architecture that accommodates both 2D and 3D graphs with the basic framework.</p>
  
  <p>Exporting the generated graphs as images is a critical feature, and eventually I'm going to write the code to generate vector images of the graphs' 2D projections. However, in the mean time, I want to be able to export the graphs as high resolution images--images significantly larger than the application window.</p>
  
  <p>I'm writing this application in Java and using the LWJGL OpenGL wrapper. I've figured out how to take screenshots of the display window, but I haven't been successful creating larger images. I've tried to make invisible Canvases, but I can't make it work.</p>
  
  <p>The documentation says <a href="http://lwjgl.org/javadoc/org/lwjgl/opengl/Display.html#setParent%28java.awt.Canvas%29" rel="nofollow">here</a> that the Canvas's isDisplayable() method must return true, and to that end I've overridden the isDisplayable() method to always return true, so that it shouldn't care whether or not it's in a Frame, but this doesn't work. Instead, it throws the following error:</p>
  
  <pre><code>java.lang.RuntimeException: No OpenGL context found in the current thread.
          at org.lwjgl.opengl.GLContext.getCapabilities(GLContext.java:124)
          at org.lwjgl.opengl.GL20.glDeleteProgram(GL20.java:311)
  </code></pre>
  
  <p>The problem seems to be that it also needs some properties from the top-level window, but even when I make a dummy Frame class I get the same error as before, until I call setVisible(true) on the frame.</p>
  
  <p>Does anyone know how to fake these graphics properties into thinking it has a visible top-level window? Does anyone know an easier way?</p>