Hello Guest

EGL + Wayland woes

  • 0 Replies
  • 855 Views
EGL + Wayland woes
« on: March 20, 2020, 11:48:47 »
Hi there!

I've been tasked on running my 3d modules under wayland, and I'm running into problems.

The way I'm currently doing stuff, is taking AWT Canvas, getting the DrawingSurface from it, and from that I can get Display and Native Window components.
I can then use EGL to connect those components and GLES, and create a context.

Here's a small code snippet:

Code: [Select]
this.ds = JAWT_GetDrawingSurface(canvas, awt.GetDrawingSurface());
JAWTDrawingSurfaceInfo dsi = JAWT_DrawingSurface_GetDrawingSurfaceInfo(ds, ds.GetDrawingSurfaceInfo());

JAWTX11DrawingSurfaceInfo dsiWin = JAWTX11DrawingSurfaceInfo.create(dsi.platformInfo());

int depth = dsiWin.depth();
long display = dsiWin.display();
long drawable = dsiWin.drawable();

// convert JAWT display handle into EGL display.
eglDisplay = eglGetDisplay(display);
I want to stress that everything until the last line works fine. Everything is set up as it should be, and the handles all seem good and well.

I run into a bit of a snag on the last line.
Here's the thing. It works fine on Desktop Linux PC. It works fine on ARM Debian machine. It seems to work fine on the Wayland ARM machine...
Only it returns Display = 0.
At the same time, it returns EGL_SUCCESS as the error code! So EGL basically thinks that everything went well, only display handle address is 0, which is unusable, obviously.

Because the display is 0, when I get to eglInitialize() - I get null pointer exception.

Another funny thing - I can get past that point if I do this:
Code: [Select]
eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
It works fine, it initializes EGL, it even finds frameBuffers and creates EGL capabilities.
It even creates the context just fine!
But then I need to get SURFACE, and for that I need Native Window, and obviously my Default Display that I used and the drawable that I got from JAWT - are incompatible. Bummer.

Any tips?
« Last Edit: March 20, 2020, 11:52:26 by Aisaaax »