omcfadde / dante

idTech4 OpenGL ES2.0 | #dante (irc.freenode.net)
http://omcfadde.blogspot.fi
GNU General Public License v3.0
111 stars 30 forks source link

implement OpenGL api using the EGL interface #16

Open kphillisjr opened 12 years ago

kphillisjr commented 12 years ago

A small update of the OpenGL API on X11 initially to allow the end user to initialize from EGL instead of GLX. This can branch into ultimately allowing native running of either API on Wayland, since Wayland requires EGL.

omcfadde commented 12 years ago

As far as I know, Wayland can run the ES2 branch which is using EGL and GLES2.0 fine. There isn't any real need to change the old X11 code, unless you're concerned about the few remaining issues with ES2 rendering.

kphillisjr commented 12 years ago

Yes, That may be true, however it is also possible by EGL specifications to use EGL to initialize OpenGL Contexts instead of GLX/WGL/(Whatever Mac uses). So this is more of a feature improvement because eventually mesa will be able to handle OpenGL 3.0 and this would mean that having a good example engine using EGL and OpenGL Would be good. This boils down to making use of EGL_OPENGL_BIT use in the EGLConfig parameters.

If anything, Please look at the following for an idea...

EGLBoolean bApiBound;
bApiBound = eglBindAPI(EGL_OPENGL_API);
// bApiBound will be EGL_FALSE if this Failed properly.

// not shown, but normal Configuration steps go here.
// This should look similar to how the Configuration for OpenGL ES is... In fact, it should be Identical.
// The only difference is when context are created

// This next bit will set the version to 3.0.
EGLint myRequestedClientVer[3];
myRequestedClientVer[0] = EGL_CONTEXT_CLIENT_VERSION;
myRequestedClientVer[1] = 3;
myRequestedClientVer[2] = 0;
EGLContext eglContext;
eglContext = eglCreateContext(eglDisplay, eglConfig, EGL_NO_CONTEXT, myRequestedClientVer);
// This should return EGL_NO_CONTEXT if OpenGL 3.0 is not supported.
omcfadde commented 12 years ago

Okay. I will keep this issue opened and assigned to myself, but right now the most high priority things are (in no particular order) Android (including OpenAL or OpenSL), fixing the remaining renderer bugs with ES2.0, SIMD optimization, GNU build system.

I will keep this in mind, however.

kphillisjr commented 12 years ago

I forgot to mention, but you can Initialize the OpenGL 1.5, or 2.x from the egl... just change:

myRequestedClientVer[1] = 3;
myRequestedClientVer[2] = 0;

to the following:

myRequestedClientVer[1] = 2;
myRequestedClientVer[2] = 0;
kkszysiu commented 12 years ago

Hmm, Android is using EGL but it looks quite different than code you pasted above...

kphillisjr commented 12 years ago

That may be the case, but it's actually not that different from how you would use EGL to initialize OpenVG using EGL... For an example, see what is done with the freescale i.MX line of chips...

http://imxdev.org/wiki/index.php?title=Develop_a_simple_OpenVG_application_under_Linux_tutorial

Also, the client version method I specified is well known on how to query for OpenGL ES 2.0, the only real change is that it initializes OpenGL api's instead.

http://www.badadev.com/intoduction-to-opengl-es-2-0-on-bada/