PDA

View Full Version : Porting Help



prasmkul
07-27-2015, 11:15 AM
I have a C++ 11 app that uses OpenGLES 2.0, I need to port this app on a device that doesn’t have OpenGL support but DirectFB. What are my options here? Any help will be deeply appreciated.

Alfonse Reinheart
07-27-2015, 11:27 AM
OpenGL and DirectFB do two entirely separate things. DirectFB is all about dealing with framebuffers. OpenGL is about 3D rendering. You can't port an OpenGL application to DirectFB without writing a software renderer.

GClements
07-27-2015, 01:41 PM
I have a C++ 11 app that uses OpenGLES 2.0, I need to port this app on a device that doesn’t have OpenGL support but DirectFB. What are my options here?

Mesa (http://www.mesa3d.org/) provides a software implementation of OpenGL, including OpenGL ES 2.0. It uses LLVM to compile GLSL shaders to native machine code. At one point it included a DirectFB driver, but that has since been removed. Writing a DirectFB driver for a current version of Mesa wouldn't be a trivial task, but it would be far simpler than writing your own OpenGL implementation.

Also, if the application is fairly demanding in terms of rendering performance, there won't be any viable solution for a platform which doesn't have hardware acceleration.

prasmkul
07-27-2015, 02:31 PM
Thank you very much Alfonse and GClements !!

Actually my application uses only 2D rendering.
I will check this Mesa!

Thanks a lot!

GClements
07-27-2015, 03:18 PM
Actually my application uses only 2D rendering.
In which case,consider porting the application to use a different API, e.g. OpenVG or cairo or ... whatever the device supports natively.

Dark Photon
07-28-2015, 07:52 AM
Mesa (http://www.mesa3d.org/) provides a software implementation of OpenGL, including OpenGL ES 2.0.

Actually, Mesa3D supports OpenGL ES 3.0, along with Open VG (both are advertised in EGL_CLIENT_APIS). However, as mentioned Mesa3D is a software implementation which is slower than one which uses the system's GPU.

Another good option for OpenGL ES on desktop is the PVRVFrame OpenGL ES emulator libraries (http://community.imgtec.com/developers/powervr/tools/pvrvframe/) in the Imagination Tech PowerVR SDK. It implements OpenGL ES 3.1libraries by mapping them to raw OpenGL, making use of the underlying native hardware-accelerated GPU drivers on the desktop.

Yet another option for OpenGL ES on the desktop is ANGLE (https://code.google.com/p/angleproject/). It maps OpenGL ES to Direct3D, again making use of the underlying native hardware-accelerated GPU drivers on the desktop.

NVidia also has OpenGL ES support in their Linux OpenGL drivers. Not sure if this is supported in their Windows drivers.

prasmkul
07-31-2015, 03:17 PM
Thanks a lot GClements & Dark Photon !
I checked PowerVR cairo ANGLE but couldn't find exact solution.

I am looking for a facade pattern which will sit in between my App which has OpenGL API calls and a DirectFB running on embedded system.
Either a readily available lib which i will link statically or I will write one if its not available.

what step should I do to achieve this?

Alfonse Reinheart
07-31-2015, 04:25 PM
I am looking for a facade pattern which will sit in between my App which has OpenGL API calls and a DirectFB running on embedded system.

OpenGL is a 3D API. DirectFB is a framebuffer API. There's no mere facade that can automatically convert one to the other. There are no OpenGL APIs that are strictly 2D which would map to DirectFB APIs (well, except maybe glBlitFramebuffer). Even sticking exclusively to glVertex2i could still apply 3D transformations via matrices.

The only way to do what you want is to build that "facade" into your application itself. That is, refactor all of the code that talks to OpenGL, building a clear API out of it. That API would then either make the original OpenGL calls or use DirectFB.

prasmkul
08-07-2015, 10:59 AM
Hi,

Now I have cross-compiled latest MESA(10.6.3) for mips-linux and statically compiled MESA’s ‘LibGLESv2’ and ‘LibEGL’ libraries with my app to resolve all OpenGL link issues.
Now I have a standalone executable that should run on the new device. But the app crashed as soon as it started, it didn’t even get into the app main(). I assume that I missed some MESA-DirectFB interface that I need to use to make my app talking to DirectFB.
I hope that somebody might have gone through this situation before and should be able to shed some light.

Any help on this will be greatly appreciated.

GClements
08-07-2015, 11:32 AM
Any OpenGL commands require a valid context to have been created and set. For a default build of Mesa, this is probably going to require an X server. If it's still maintained, you may be able to use the OSMesa library to direct rendering to client memory which can then be copied to the framebuffer.

If DirectFB was a supported target, it would presumably be an EGL driver.

Other than that, you're probably better off asking questions on the Mesa mailing list.