OpenGL version-checking code update

Not sure whether to post this here or on the SF forums. Where is the correct place for bug-reports?

The current OpenGL version-checking routine in org.lwjgl.opengl.GL doesn’t properly set the OpenGL11 boolean, and omits an OpenGL10 variable. This variable isn’t strictly needed, but could be added for completeness.

Current CVS advertises the following code as lines 1631 to 1640 (but may be different in your version):

if (c == '2') {
      OpenGL12 = true;
} else if (c == '3') {
      OpenGL12 = true;
      OpenGL13 = true;
} else if (c == '4') {
      OpenGL12 = true;
      OpenGL13 = true;
      OpenGL14 = true;
}

Replace with something like:


// Warning - each case intentionally falls through!
switch (c) {
      case '4':
            OpenGL14 = true;
      case '3':
            OpenGL13 = true;
      case '2':
            OpenGL12 = true;
      case '1':
            OpenGL11 = true;
      case '0':
            OpenGL10 = true;
            break ;
      default:
            // Unexpected character - ignore
}

And add the new variable somewhere around line 1585:

public boolean OpenGL10;

(Looking ahead, something more clever needs to be done with this check by the time OpenGL2.0 comes along.)

Thanks, it has been committed to CVS.

  • elias

Excellent, thanks! 8)

I’m probably one of the few around here still using OpenGL 1.1 drivers, so I’m really not surprised noone else had noticed it… ;D