Closed vinodkhare closed 7 years ago
I've already considered to solve this issue to reduce the size of the executable. The options that comes in my mind:
ObsoleteAttribute
, but I've already tried it for compatibility profile functions/constants, and I find it quite dirty (just removed al attributes). However, it requires conditional compilation for each configuration (GL, GL ES, GL ES2, GL SC?, GL SC2?). And the sources compiles and executes anyway.Or maybe all above is over-engineered: Gl.BindApi() should reset the function pointers depending on the current context. However, nobody can grant a GLES2-only implementation: probably the same library contains GLES functions that would be loaded anyway. Indeed a fast & effective solution could be a modified function-loader module that uses field attributes for excluding those function that cannot be implemented by the context; but this is detectable only at run-time, and constants are not excluded.
Indeed? IL generator?
Yes, it seems possible using Mono.Cecil: very useful tool. I'll work on it and I'll let you know.
Hmm, I'm not familiar enough with the project to comment on how it can be achieved from a technical point of view.
From a functional point of view, I was imagining something like this - different OpenGL versions are split into different namespaces. For example, namespace GLES2 contains all the OpenGL ES 2 functions. This would be quite enough for my use case.
This may not be the best way to refactor your library... just brainstorming here.
Sadly, this option would increase the binary size, and make more difficult to have common code for OpenGL and OpenGL ES (which is one of my "requirements").
I've already tested ES2-only library against the HelloTriangle.ANGLE example, and it works pretty well. The only remaining thing is the removal of enumeration fields.
Just uploaded nuget package. Tell me what you think about; feedbacks are welcome.
I have a Linux STB(VuDuo2) only Framebuffer no X11, and i try to use OpenGL. The Box have a mips BCM7424 CPU, but no OpenSource... I have libGLES2 but no X11, so the "Initialize" run into "GetProcAddressX11" and like to load "libGL.so.1" and use a "glxGetProcAddress" with are not present. Is there a way to solve this?
Probably it does not detect any EGL library. Any chance to find a libEGL.so?
Yes the EGL library is present, in source i just change the "glxGetProcAddress" to "eglGetProcAddress" and the private const string Library = "libGL.so.1" to private const string Library = "libGLESv2.so"; and it seems to work. So if Linux is not fix assumed to have X11, it will be running on every other non X11/RPI machine?!
I run samples on RPi and Android. It shoild detect EGL automatically. Try to set Egl.IsRequired to true, and it will work.
Il lun 24 apr 2017, 14:16 wolfgangmauer notifications@github.com ha scritto:
Yes the EGL library is present, in source i just change the "glxGetProcAddress" to "eglGetProcAddress" and the private const string Library = "libGL.so.1" to private const string Library = "libGLESv2.so"; and it seems to work. So if Linux is not fix assumed to have X11, it will be running on every other non X11/RPI machine?!
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/luca-piccioni/OpenGL.Net/issues/39#issuecomment-296643310, or mute the thread https://github.com/notifications/unsubscribe-auth/AEe6CW843uDgoTlE7TvffGwqKQoA5eerks5rzJKKgaJpZM4M9_r8 .
I have... As i described Linux and no X11! If you take a look.... What i need is (CurrentPlatformId=Linux && GetProcAddress=GetProcAddressEgl)
private static IGetProcAddress CreateOS() { switch (Platform.CurrentPlatformId) { case Platform.Id.WindowsNT: return new GetProcAddressWindows(); case Platform.Id.Linux: return new GetProcAddressX11(); case Platform.Id.MacOS: return new GetProcAddressOSX(); case Platform.Id.Android: return new GetProcAddressEgl(); default: throw new NotSupportedException(String.Format("platform {0} not supported", Platform.CurrentPlatformId)); } }
I'll check this tonight. In the meanwhile, you should undestand that there are two kind of loaders: OS and GL.
OS loaders are used for loading platform pointers (and on linux it means using dlsym). This kind of loaders are returned by GetProcAddressOS.
GL procedures are loaded using a separate API, returned with GetProcAddressGL. This kind of loader depends on the platform API.
Indeed, you need dlsym for loading EGL procedures, and eglProcAddress for loading GL procedures.
Il lun 24 apr 2017, 14:31 wolfgangmauer notifications@github.com ha scritto:
I have... As i described Linux and no X11! If you take a look.... What i need is (CurrentPlatformId=Linux && GetProcAddress=GetProcAddressEgl)
private static IGetProcAddress CreateOS() { switch (Platform.CurrentPlatformId) { case Platform.Id.WindowsNT: return new GetProcAddressWindows(); case Platform.Id.Linux: return new GetProcAddressX11(); case Platform.Id.MacOS: return new GetProcAddressOSX(); case Platform.Id.Android: return new GetProcAddressEgl(); default: throw new NotSupportedException(String.Format("platform {0} not supported", Platform.CurrentPlatformId)); } }
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/luca-piccioni/OpenGL.Net/issues/39#issuecomment-296648962, or mute the thread https://github.com/notifications/unsubscribe-auth/AEe6CUa1A5GA69mEuZHEISv-dEiwlZIwks5rzJYMgaJpZM4M9_r8 .
FYI you should read the static constructor of Egl class, since probably the EGL library is cannot be found by the code.
Il lun 24 apr 2017, 14:44 Luca Piccioni luca.piccioni@gmail.com ha scritto:
I'll check this tonight. In the meanwhile, you should undestand that there are two kind of loaders: OS and GL.
OS loaders are used for loading platform pointers (and on linux it means using dlsym). This kind of loaders are returned by GetProcAddressOS.
GL procedures are loaded using a separate API, returned with GetProcAddressGL. This kind of loader depends on the platform API.
Indeed, you need dlsym for loading EGL procedures, and eglProcAddress for loading GL procedures.
Il lun 24 apr 2017, 14:31 wolfgangmauer notifications@github.com ha scritto:
I have... As i described Linux and no X11! If you take a look.... What i need is (CurrentPlatformId=Linux && GetProcAddress=GetProcAddressEgl)
private static IGetProcAddress CreateOS() { switch (Platform.CurrentPlatformId) { case Platform.Id.WindowsNT: return new GetProcAddressWindows(); case Platform.Id.Linux: return new GetProcAddressX11(); case Platform.Id.MacOS: return new GetProcAddressOSX(); case Platform.Id.Android: return new GetProcAddressEgl(); default: throw new NotSupportedException(String.Format("platform {0} not supported", Platform.CurrentPlatformId)); } }
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/luca-piccioni/OpenGL.Net/issues/39#issuecomment-296648962, or mute the thread https://github.com/notifications/unsubscribe-auth/AEe6CUa1A5GA69mEuZHEISv-dEiwlZIwks5rzJYMgaJpZM4M9_r8 .
Sorry, but all GLES2/EGL libraries are found! The exception is like "cannot find libGL.so.1" and that's right, because i don't have it.
Evidently, since I've run on Linuxes having GL.so I always been able to run without issues (my Rpi has X11 installed).
The solution would be to avoid loading GL.so, or masking the exception if reasonable. I wonder where and why it's tryong to use GL.so even once it has found EGL platform. 😤
Il lun 24 apr 2017, 15:51 wolfgangmauer notifications@github.com ha scritto:
Sorry, but all GLES2/EGL libraries are found! The exception is like "cannot find libGL.so.1" and that's right, because i don't have it.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/luca-piccioni/OpenGL.Net/issues/39#issuecomment-296674696, or mute the thread https://github.com/notifications/unsubscribe-auth/AEe6CU6NOv6eSnDa7OinwIBtJ-_tLs8kks5rzKjTgaJpZM4M9_r8 .
I think i write a libGL.so witch maps the "glxGetProcAddress" to "eglGetProcAddress" ....
Ok, I got it. I'll fix it soon, checking on my RPi. In the meanwhile, your solution is a valid workaround, but to make it correct you should define glXGetProcAddress returning always IntPtr.Zero.
P.s: maybe next time create an issue about
Is there a way to restrict the API to use a particular OpenGL version? For example, I want to develop using only OpenGL ES 2. How can I make sure that only OpenGL ES 2 functions are available?