Derelict3 icon indicating copy to clipboard operation
Derelict3 copied to clipboard

Add EGL module

Open jpf91 opened this issue 12 years ago • 6 comments

Initial attempt at a EGL module, which is necessary for OpenGL ES support. This is probably not ready to be merged yet, as there are still some open questions:

  1. GLX, WGL etc are placed in static if(Platform) blocks, but EGL is cross platform, so I think it should be compiled in always?
  2. EGL can also be used to create OpenGL contexts. How should EGL be integrated with GLX/WGL and OpenGL in derelict?
  3. EGL is always in it's own library, so loadPlatformGL really doesn't fit EGL. Therefore EGL currently has it's own Loader.
  4. The EGL documentation says eglGetProcAddress should only be used to load extension functions, not core functions. So I'm not sure if it can be used to implement loadGLFunc

jpf91 avatar Mar 29 '12 14:03 jpf91

  1. You've implemented it as a separate package, so this is irrelevant. It won't be "compiled in" to anything but its own DerelictGLES library.
  2. I have no idea. I've never looked at EGL. Is it not enough to just link with DerelictGLES and DerelictGL, then use the appropriate functions?
  3. As it should, since you've implemented it as a separate package.
  4. Then don't. Just use bindFunc.

Since it's a separate package, I think you can just drop the loadPlatformGL, loadGLFunc, and hasValidContext. Let the users call DerelictEGL.load and load everything you need to from there. Or am I missing something?

mdparker avatar Mar 31 '12 11:03 mdparker

  1. OK
  2. Yes this is possible, but right now loading DerelictGL will also load glx/wgl using the loadPlattformGL function. However, using egl+opengl shouldn't require glx or wgl (there are already implementations for linux where glx is not available, but EGL is: Wayland and KMS).
  3. Questions 3 and 4 are related to Question 2: Sure, for OpenGL ES this is not a problem. But for (normal) OpenGL this could require some changes in Derelict.

I think I'll just add headers for OpenGL ES first and make sure EGL + OpenGL ES works. Integrating EGL+OpenGL can still be done at a later time.

jpf91 avatar Apr 01 '12 17:04 jpf91

I see. How about if I add something like this to the GL loader:

DerelictGL.loadWithoutPlatform()

The normal load() method would continue to load the core API, platform functions, and extensions. The new function would only load the core API. For extension loading... maybe another method that accepts a function pointer? Then you could do something like

DerelictGL.loadExtensions(&eglGetProcAddress);

Thoughts?

mdparker avatar Apr 02 '12 06:04 mdparker

Yes, this sounds like a good idea. I need some time to finish the OpenGL ES stuff, I'll update this pull request when it's finished.

jpf91 avatar Apr 02 '12 08:04 jpf91

I there any update on it? Having OGLES support would be really cool for platforms like the Raspberry Pi or smartphones.

Leonidas-from-XIV avatar Mar 08 '13 21:03 Leonidas-from-XIV

I'm going to give a go at getting this implemented, using the original pull request as a starting point. It may be a while yet before I find the time to get it completed, but I think it will be a useful addition.

mdparker avatar May 28 '13 10:05 mdparker