Posted by
Sven Gothel on
Feb 21, 2012; 3:01pm
URL: https://forum.jogamp.org/Using-Ogre-1-8-with-JOGL-and-OpenGL-ES-2-0-tp3754215p3763782.html
On 02/21/2012 03:29 PM, seahorse [via jogamp] wrote:
>
>
> ok thanks for the response
>
> correct me if i am wrong but
> I am assuming JOGL has its EGL interface seperated out into seperate classes
> which is unrelated to the opengl classes.
EGL, GLX, WGL, .. and OpenGL are 'unrelated' yes.
> And I am assuming these seperate classes for SWT would be
> GLCanvas, GLCapabilites (set's EGL configs independent of GL)
> GLWindow(set's up EGL Surface independent of GL)
EGL surface is a detail of the jogamp.opengl.egl.EGLDrawable
and manages the special native-handle versus EGL-handle
like eglDisplay and eglSurface.
Some platforms have a 1:1 mapping (Android, ..)
where we use a native egl configuration in the NativeWindow.
Other platforms, eg. w/ X11/GLX or WGL, will map
their native handle to egl.
GLX, WGL, .. use a straight 1:1 mapping of the
drawable/surface handle.
> and the swap buffers call - Swapbuffers
> and for eglcontext?
EGLContext is a specialization of GLContext,
so is X11GLXContext, etc ..
>
> Is there a strict one to one mapping betwenn
> eglconfig, egldisplay, eglsurface, eglcontext and the JOGL classes?
These details are hidden within the egl package, see above.
In the end, a GLContext instance will have it's unique
handle, whether it's GLES or desktop GL.
The OpenGL function wrapping don't really care, as long the association
is properly and the function exist. Our framework takes care
of the proper mapping
NativeWindow -> EGL/GLX/WGL -> GLProfile/GLContext -> ..
Hope this helps a bit.
For your simple 'reuse' of the GL context in native code,
you would just need to either:
- call a native 'draw' method from java within:
makeCurrent();
try {
myNativeDraw();
} finally {
releaseContext();
}
this is recommended!
Here your native application doesn't need to worry about
whether you use EGL, GLX, ..
and you have also some sanity regarding context management.
- Native management (won't work well w/ AWT):
- Java: Lock the surface/gl-drawable
- Java: Pass the gl-context and the gl-drawable-handle
to your native code,
w/o having the context current.
- Native: do your stuff in native code, knowing which binding you use
EGL, GLX, ..
- Java: unlock surface
~Sven