-
Notifications
You must be signed in to change notification settings - Fork 87
Remove direct libGL linkage from OpenGL 3 and OGLES 2 Drivers #232
Conversation
This profile does not allow any pre-modern OpenGL practices, making it a good way to make sure the OpenGL 3 video driver is resilient to different OpenGL implementations (especially the ones that only support modern practices).
There are still major graphical glitches that make it unplayable, but the GUI is rendering as well as many game objects.
The game is now playable and the driver is working correctly!
I added a minor optimization that removed the allocation of new VBOs every beginDraw call. Instead there is a global VBO used by all beginDraw calls except ones called by drawHardwareBuffer. Still inefficient and can be vastly improved, but at least it's better than before.
I changed how the OpenGL 3 Driver compiled so that it no longer required you to link to libGL when linking. In order to do this, I changed all OpenGL calls to use the calls defined in mt_opengl.h.
Makes it so that using the OGLES2 Driver does not require linking to the system's libGL library.
This commit is not completely necessary, but it removes searching for the OpenGL package in the case of the new OpenGL 3 driver and asserts that the core profile is used when using the new OpenGL 3 driver.
void debugCb(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message); | ||
static void APIENTRY debugCb(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *userParam); | ||
void debugCb(unsigned int source, unsigned int type, unsigned int id, unsigned int severity, int length, const char *message); | ||
static void APIENTRY debugCb(unsigned int source, unsigned int type, unsigned int id, unsigned int severity, int length, const char *message, const void *userParam); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changing all these types certainly doesn't seem ideal.
do our gl bindings not provide them? if so that should be fixed instead
see also #168, maybe we should switch to something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changing all these types certainly doesn't seem ideal.
And isn’t even required to avoid linking to libGL
. They only need headers.
Likewise with constants, although they are fine when used via GL.
cc @numberZero |
A few lines needed to be changed for Debug mode to compile
I would be happy using glad. It would make things pretty simple and we would keep a lot more bindings. Right now the gl bindings don't provide those types. |
Superseded. |
This pull request does three things: 1. It changes the OpenGL 3 video driver to use a Core 3.3 Profile; 2. It decouples the legacy OpenGL driver from the modern OpenGL 3 and OGLES 2 drivers; that is, it allows you to compile Irrlicht without it; and 3. It removes the need to directly link to libGL when only compiling the modern OpenGL 3 driver or OGLES 2 driver without the legacy OpenGL driver.
The current OpenGL 3 video driver does not work with a Core profile, since the Core profile requires a Vertex Array Object and a Vertex Buffer Object to be bound to draw anything, which is not always the case currently. So the (inefficient) way that I made it work was I created a single global Vertex Array Object and a single global Vertex Buffer Object that are used when the renderer does not have other ones to use. The way to make this driver more efficient would be to reuse Vertex Array Objects and Vertex Buffer Objects as much as possible, hopefully reducing the communication between the CPU and GPU as much as possible.