luca-piccioni / OpenGL.Net

Modern OpenGL bindings for C#.
MIT License
570 stars 109 forks source link

ANGLE DLL's #29

Closed equinox2k closed 7 years ago

equinox2k commented 7 years ago

Hi,

I understand in order to get ANGLE working you need the two dll's libEGL + libGLESv2 however Ive tried adding the dll's from the nugget packages mentioned here https://github.com/Microsoft/angle, however the sample app says they are not correct for application. Do the dll's come from somewhere else?

luca-piccioni commented 7 years ago

I currently use the Google branch of ANGLE. However, I think this is not the source of the problem.

What is the actual exception you get? Probably the error is caused by missing dependencies or architecture mismatch.

equinox2k commented 7 years ago

I'm not at computer at moment but is basically saying the EGL environment is not available. I.e no difference in error if I copy dlls to project bin folder or not. I've just started to try and compile googles ANGLE so will see if that makes any difference

luca-piccioni commented 7 years ago

Read the wiki: https://github.com/luca-piccioni/OpenGL.Net/wiki/OpenGL-ES-using-ANGLE

Il gio 15 dic 2016, 09:44 Peter Tribe notifications@github.com ha scritto:

I'm not at computer at moment but is basically saying the EGL environment is not available. I.e no difference in error if I copy dlls to project bin folder or not. I've just started to try and compile googles ANGLE so will see if that makes any difference

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/luca-piccioni/OpenGL.Net/issues/29#issuecomment-267270408, or mute the thread https://github.com/notifications/unsubscribe-auth/AEe6CUoGRRSTRsj1Pmrrm3kQ0cYpIQu5ks5rIP3igaJpZM4LNmTo .

equinox2k commented 7 years ago

I read the wiki but got confused as search paths mentioned WinRT where I thought that was Arm based rather than 32/64 also wasn't sure if the Angle path was relevant to exe ...

Sent from my iPhone

On 15 Dec 2016, at 00:46, Luca Piccioni notifications@github.com<mailto:notifications@github.com> wrote:

Read the wiki: https://github.com/luca-piccioni/OpenGL.Net/wiki/OpenGL-ES-using-ANGLE

Il gio 15 dic 2016, 09:44 Peter Tribe notifications@github.com<mailto:notifications@github.com> ha scritto:

I'm not at computer at moment but is basically saying the EGL environment is not available. I.e no difference in error if I copy dlls to project bin folder or not. I've just started to try and compile googles ANGLE so will see if that makes any difference

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/luca-piccioni/OpenGL.Net/issues/29#issuecomment-267270408, or mute the thread https://github.com/notifications/unsubscribe-auth/AEe6CUoGRRSTRsj1Pmrrm3kQ0cYpIQu5ks5rIP3igaJpZM4LNmTo .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/luca-piccioni/OpenGL.Net/issues/29#issuecomment-267270762, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AAoCQ3RPKNk0nImwgrrr_yRtuYudU8Fsks5rIP5PgaJpZM4LNmTo.

luca-piccioni commented 7 years ago

The search path are relative to the current working directory. The directory structure is currently derived by the ANGLE output.

I've never tested on ARM architecture since I have no Win10 on ARM. However, ANGLE is available for ARM also.

equinox2k commented 7 years ago

Still having problems getting ANGLE working.

I have created an archive of the HelloTraiangle.ANGLE sample https://www.dropbox.com/s/zgwymy9w1c4x11q/HelloTriangle.ANGLE.zip?dl=0

inside it in the bin\Debug folder you will see hello_triangle.exe which is a exe compiled from googles ANGLE + dependant dll's and runs fine.

However running the HelloTriangle.ANGLE.exe produces error "EGL/ANGLE platform not available"

Hope you can help...

luca-piccioni commented 7 years ago

angle

You miss to build the directory tree for supporting ANGLE on x86/x64 - debug/release. See the picture: you need to provide ANGLE\winrt10\x64\libEGL.dll and ANGLE\winrt10\x64\libGLESv2.dll to support an EGL+GLES2 implementation. Files are relative to the executable path. If you run on x86, you must provide ANGLE\winrt10\x86\ directory structure. Follow patterns found in wiki to create the directory structure, and the provide the libraries specified in wiki platform page.

See the Egl source code.

If you profile the following directory structure in the project root, the HelloTriangle.ANGLE post build script will let you run seamlessy the sample:

C:\Users\Luca\Source\Repos\OpenGL.Net>dir /S /B ANGLE
C:\Users\Luca\Source\Repos\OpenGL.Net\ANGLE\LICENSE
C:\Users\Luca\Source\Repos\OpenGL.Net\ANGLE\README.md
C:\Users\Luca\Source\Repos\OpenGL.Net\ANGLE\winrt10
C:\Users\Luca\Source\Repos\OpenGL.Net\ANGLE\winrt10d
C:\Users\Luca\Source\Repos\OpenGL.Net\ANGLE\winrt10\arm
C:\Users\Luca\Source\Repos\OpenGL.Net\ANGLE\winrt10\x64
C:\Users\Luca\Source\Repos\OpenGL.Net\ANGLE\winrt10\x86
C:\Users\Luca\Source\Repos\OpenGL.Net\ANGLE\winrt10\arm\libEGL.dll
C:\Users\Luca\Source\Repos\OpenGL.Net\ANGLE\winrt10\arm\libGLESv2.dll
C:\Users\Luca\Source\Repos\OpenGL.Net\ANGLE\winrt10\x64\d3dcompiler_47.
C:\Users\Luca\Source\Repos\OpenGL.Net\ANGLE\winrt10\x64\libEGL.dll
C:\Users\Luca\Source\Repos\OpenGL.Net\ANGLE\winrt10\x64\libGLESv2.dll
C:\Users\Luca\Source\Repos\OpenGL.Net\ANGLE\winrt10\x86\d3dcompiler_47.
C:\Users\Luca\Source\Repos\OpenGL.Net\ANGLE\winrt10\x86\libEGL.dll
C:\Users\Luca\Source\Repos\OpenGL.Net\ANGLE\winrt10\x86\libGLESv2.dll
C:\Users\Luca\Source\Repos\OpenGL.Net\ANGLE\winrt10d\x64
C:\Users\Luca\Source\Repos\OpenGL.Net\ANGLE\winrt10d\x86
C:\Users\Luca\Source\Repos\OpenGL.Net\ANGLE\winrt10d\x64\d3dcompiler_47
C:\Users\Luca\Source\Repos\OpenGL.Net\ANGLE\winrt10d\x64\libEGL.dll
C:\Users\Luca\Source\Repos\OpenGL.Net\ANGLE\winrt10d\x64\libGLESv2.dll
C:\Users\Luca\Source\Repos\OpenGL.Net\ANGLE\winrt10d\x86\d3dcompiler_47
C:\Users\Luca\Source\Repos\OpenGL.Net\ANGLE\winrt10d\x86\libEGL.dll
C:\Users\Luca\Source\Repos\OpenGL.Net\ANGLE\winrt10d\x86\libGLESv2.dll
luca-piccioni commented 7 years ago

Can you explain why it wasn't clear how the library loads ANGLE libraries? I tried to re-read the wiki, and it seems so clear to myself. :-/ Otherwise you can improve the wiki page, cannot you?

equinox2k commented 7 years ago

Ok ive now found out what was happening.. I was following the wiki, and trying all sorts of combinations but when I did try the potentially correct way as per wiki, I was using the nuget repo version of OpenGL .Net v0.3.3 which isn't working. However using the compiled dll's from this git repository works.

Steps to reproduce open the Samples\HelloTriangle.ANGLE project, remove references to the OpenGL.Net + OpenGL.Net.Winforms then add the lastest version via nuget.

I assume this should work using the off screen method recently created. (trying to get direct x warp to trigger via ANGLE)

Another note: in the HelloTriangle.ANGLE app Program.cs it also threw me off because doing the following..

// Force using EGL, indeed ANGLE OpenGL.Egl.IsRequired = true;

var available = OpenGL.Egl.IsAvailable; var isRequired = OpenGL.Egl.IsRequired;

available is false and isRequired even returns false

equinox2k commented 7 years ago

Investigated further and turns out the bind Api in Egl.cs below throws exception "unable to load library at libEGL.dll"

LogComment("Querying EGL from {0}", platformLibrary); BindAPI(platformLibrary, OpenGL.GetProcAddress.GetProcAddressOS);

Due to error I thought maybe something wrong with the dll's compiled and made sure I generated the dll's as per... https://github.com/google/angle/blob/master/doc/BuildingAngleForWindowsStore.md

But kept getting same error. I have attached the ANGLE dll's ive compiled, can you verify with your own copy of the ANGLE dll's the above line does now throw exception...

https://www.dropbox.com/s/8jzbw5y3hhfw1sh/ANGLE.zip?dl=0

equinox2k commented 7 years ago

Further findings and I'm not sure if this is to be expected in private static void BindAPIFunction(string path, FunctionContext functionContext, FieldInfo function, GetAddressDelegate getAddress) for KhronosApi.cs the line importAddress = getAddress(path, importName); throws exception due to eglSetBlobCacheFuncsANDROID not available I'm not sure if this is due to my ANGLE dll's as seems to happen with all importNames after further checking

luca-piccioni commented 7 years ago

Just downloaded you ANGLE (please, use github attachments: dropbox is sooo slow). They substitute my precompiled libraries, HelloTriangle.ANGLE is not running because it complains a missing msvcp140D_APP.dll!!`. I suppose because you're following another build target (I'm running on Windows 7; I don't know what WindowsStore is).

Indeed I cannot help you directly. Normally any error on loading library is when the library is dependent on another library: in this case you should load it manually before loading libEGL.dll (this is the case of EGL on Raspberry PI).

A lot of function pointers could be null. Loading is performed using P/Invoke: how an exception is thrown? Can you give me the exact exception information (i.e. the ToString() output, which should include stacktrace and messages)?

Just for the record, I've build ANGLE using this.