Main Menu

OpenGL Support

Started by CaseyB, September 16, 2005, 21:43:22

Previous topic - Next topic

elias

Test by creating the AWTGLCanvas then?

- elias

CaseyB

Ok, I found an old P2 350MHz that has an integrated video card with no OpenGL support!  I tried loading the OpenGL version of my class that used the AWTGLCanvas and it loaded without an error, but it puked on the first paint!  So I went back to using the Pbuffer.  What happened there was that when it tried to create the Pbuffer it would throw and exception so I just caught that and used that to decide to load the Java2D version.  Here is my code for that part:
try
{
     System.out.println("Trying OpenGL");
     try
     {
          Pbuffer buff = new Pbuffer(1, 1, new PixelFormat(), null, null);

          if (classLoader == null)
          {
               theClass = Class.forName(openGL);
          }
          else
          {
               theClass = classLoader.loadClass(openGL);
          }
          System.out.println("OpenGL Succeeded");
          buff.destroy();
     }
     catch(ExceptionInInitializerError eiie)
     {
          System.out.println("OpenGL Failed\nTrying Java2D");
          if (classLoader == null)
          {
               theClass = Class.forName(java2D);
          }
          else
          {
               theClass = classLoader.loadClass(java2D);
          }
          System.out.println("Java2D Succeeded");
     }
}
catch (ClassNotFoundException cnfe)
{
     throw cnfe;
}

Whackjack

It seems to me that by doing it this way (trying to create a Display or PBuffer), you're still missing out on what capabilities are available.  For instance, what if I want to use GL15 instead of GL11?  Is this something that has been bugged for LWJGL or are we just out of luck?

CaseyB

Once you create an OpenGL context you should be able to test for an OpenGL 1.5 feature and decide based on that.

Whackjack

*Confused* I thought it was just decided that the getCapabilities() method causes a JVM crash?  Or is there another method that I'm missing?

Oh... are you saying that I should create the Display first, and then call getCapabilities() on the newly created GLContext?  Perhaps I misinterpreted what the original problem was...

CaseyB

Quote from: "Whackjack"are you saying that I should create the Display first, and then call getCapabilities() on the newly created GLContext?

Exactly!  The problem that I was having was that I couldn't be sure that the client machine had an OpenGL capable graphics card so I just wanted to test for OpenGL 1.1 compatability.  In order to do the getCapabilities() test you need an existing OpenGL context.  So you should perform the check on an existing Display... unless I have totally gone off my rocker! :)

Whackjack

Thanks, CaseyB... That does make sense, even if it's a little backwards.  I guess I was thinking along the lines you were in that you could test for OpenGL compatibility before trying to create anything.
I'll keep this in my mind for future reference.  Thanks again!

darkprophet

The bug in the JVM has been resolved in Mustang b62:

Quote
   6342951   Implicit null checks on large objects cause JVM crash

That was quick, I expected a 3 year wait atleast!  :roll:
Edit: 1.5.0_7 seems to have the update too...everybody update!
DP

elias

Quote from: "darkprophet"The bug in the JVM has been resolved in Mustang b62:

Quote
   6342951   Implicit null checks on large objects cause JVM crash

That was quick, I expected a 3 year wait atleast!  :roll:
Edit: 1.5.0_7 seems to have the update too...everybody update!
DP

Nah, anything else than ASAP would have been strange, since this bug is a sure way to issue DOS attacks on a running (shared) JVM.

- elias