Hello Guest

Why org.lwjgl.opengl.GL43 class has no glDrawElements method?

  • 1 Replies
My question is more theoretical than practial. I want to understand idea behind OpenGL API design in LWJGL.

For example in Android OpenGL API each following OpenGL API version just extends previous, I mean:
android.opengl.GLES30 extends android.opengl.GLES20
android.opengl.GLES31 extends android.opengl.GLES30

You can see source code here: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/5.1.1_r1/android/opengl/GLES20.java, http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/5.1.1_r1/android/opengl/GLES30.java, http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/5.1.1_r1/android/opengl/GLES31.java

Why in Lwjgl there is no such concept? What is the reason behind such design when I have to use GL11.glDrawElements(); instead of GL43.glDrawElements(); ?

- Dmitry
« Last Edit: June 05, 2017, 09:01:30 by dmitrykolesnikovich »


Offline spasi

  • *****
  • 2156
    • WebHotelier
Re: Why org.lwjgl.opengl.GL43 class has no glDrawElements method?
« Reply #1 on: June 05, 2017, 12:52:19 »
This has been addressed in #154.

The current design exists in LWJGL since the first version from 15 years ago. It might be slightly annoying if you're trying to write a quick demo outside an IDE. For real applications and real OpenGL work, it works just fine. Desktop OpenGL is a massive API with a lot of complexity and having to explicitly import the appropriate classes protects against misuse.

An idea that I'm considering for LWJGL 4 is to merge classes up to OpenGL 2.1. I don't think there's any relevant driver/hardware that exposes anything less than that.

Another idea is to make GL classes extend earlier versions. Which would abuse Java and is considered a bad practice for static methods/fields.