Display not showing anything, but not throwing an exception either

Started by Daggerbot, January 25, 2011, 00:21:07

Previous topic - Next topic

Daggerbot

The title is pretty self-explanatory. I'm trying to get my first LWJGL app running in the form of an applet. I set it up to print the stack trace to a JTextArea when an exception is caught, which I've tested and confirmed to work, but that's not happening. The screen freezes on the "switching applet" step of the AppletLoader. I guess the only other info I can offer is some code. Maybe there's something obvious mistake in here that I'm missing. Any help is appreciated.

public void run ()
{
  try
  {
    // Make sure everything is visible
    m_parent.setVisible(true);
    m_canvas.setSize(m_parent.getWidth(), m_parent.getHeight());
    m_canvas.setVisible(true);
    m_canvas.requestFocus();

    // Creates the OpenGL display
    Display.setParent(m_canvas);
    Display.setVSyncEnabled(true);
    Display.create();
    Display.makeCurrent();

    // Configure OpenGL
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(0.0, (double) m_canvas.getWidth(), (double) m_canvas.getHeight(),
      0.0, -1.0, 1.0);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();

    // Main loop
    while (m_active)
    {
      Display.update();
      GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
      GL11.glColor3f(1.0f, 0.0f, 0.0f);
      GL11.glBegin(GL11.GL_TRIANGLES);
      GL11.glVertex2i(10, 10);
      GL11.glVertex2i(160, 10);
      GL11.glVertex2i(10, 160);
      GL11.glEnd();
    }

    // Destroy OpenGL display
    Display.destroy();
  }
  catch (Throwable e)
  {
    panic(e);
  }
}