
OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
Posted Tuesday, 30 June, 2009 - 08:44 by the FiddlerOpenGL ES is a subset of the OpenGL API used in embedded devices. It is used by Apple's iPhone, Google's Android, Nokia's Maemo, the Sony Playstation 3, the Pandora handheld and other devices.
OpenTK now offers experimental support for OpenGL ES profiles 1.0, 1.1 and 2.0, which roughly translate to OpenGL 1.3, 1.5 and 2.0 respectively. This includes inline documentation but excludes strongly-typed enums, which will be added at a later time. There is also no support for constructing contexts through EGL, however it should be possible to use an external GL ES context in conjuction with OpenTK. Finally, the bindings are untested - please file any bugs you encounter.
If you are interested in helping out, testing or porting (esp. to iPhone and Android), make a post!
- the Fiddler's blog
- Login or register to post comments


Comments
Re: OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
This is great news!
How would a port to for example IPhone work technically..? Is there a .NET implementation for IPhone?
Re: OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
Novell is working on Mono implementations for both iPhone and Android, but neither is available yet:

For the iPhone, you need to use full AOT compilation into native code (Apple doesn't allow JIT compilers). The biggest technical hurdle for the ports is getting an OpenGL ES context. For Android, this requires Java interop - no idea about the iPhone.
Re: OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
OK so with a suitable bytecode->native compiler for the IPhone (is there a good one..? gcc?) the only problem left is "hooking up" the OpenTK ES context?
For Android, this requires Java interop - no idea about the Android.
I'm not sure I follow - Android or IPhone?
Re: OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
Meant to say 'no idea about the iPhone' :)
Mono includes a bytecode->native compiler (see http://mono-project.com/AOT) and AFAIK they are working to bring it to the iPhone. Unity3d supports the iPhone (which probably means the compiler is working already) and someone mentioned a public beta will begin around August.
Re: OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
Good job, reading the enums I was rather pleased to see a compact GetPName for the first time ever. Enums called ShaderPrecision and ShaderBinary are promising aswell.
Are there any emulators one can use to play with this, or is the hardware required?
Re: OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
AMD distributes an emulator and there are other open-source implementations.
Frankly, the ES API is what OpenGL should have been but isn't: short, clean and to the point. Plus it has shader binaries, which are pretty important in larger applications.
Re: OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
Sweet. I had read about this elsewhere first. I've actually been off working in C++ with an ObjC wrapper making an iPhone game. I'm still working on Golem3D but not as active. Once C# with OpenGL comes out for the iPhone it will be a great thing.
Re: OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
Indeed, this is gonna be great.
Any news regarding this?
Re: OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
We are still on the planning stage, but a Mono developer is helping with the iPhone port.
There is a ton of work left to do:
Of course, additional hands would help things move along faster! The ES bindings could use some love, specifically.
Re: OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
1. & 3. (I like to think of this as "canvas") Isn't it possible to recycle lots of logic from the "desktop" GL classes? I'll take a look at the EGL specs asap, but from the GL ES specs the API appears to be very close to OpenGL.
2. Why don't you move ES-related classes to OpenTK.Handheld or OpenTK.Embedded? It appears "desktop" GL and GL ES cannot each have a context and share textures, display lists etc. with each other, so essentially they are 2 different things that should not be connected in any way. Future handheld devices might support OpenCL, so there should be nothing from OpenTK's side to prevent a programmer from using OpenTK.Compute and OpenTK.EmbeddedGraphics together.
4. In other words, you simply want all functions using OpenTK.Graphics.GLES***.All enums replaced with appropriate ones? The enums themselves look rather clean to me already (but I haven't compared them to spec yet)
Re: OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
1 & 3: EGL itself is pretty clean, and resembles GLX quite a lot. You need a platform-specific stub to get a window handle and a display connection, which you then use to create the platform-independent EGL context. All in all, it fits quite nicely into the IWindowInfo, IGraphicsContext and IGraphicsMode abstractions.
Of course, a) you'd still have to implement the IPlatformFactory interface for a complete port and b) the iPhone doesn't use EGL. Fortunately, getting a simple context up and running looks fairly simple.
2: The issue is that regular OpenTK.Graphics.GL takes up about 1.8MB of disk space. When your hard limit is 10MB, you really can't afford to waste that amount to code you aren't using.
Conceptually, OpenTK is split into a distinct parts:
Right now, the core depends on OpenTK.Graphics. Once this dependency is broken we'd be able to compile each part independently: either into different dlls (as you propose), or into a single one using conditional compilation.
4: Pretty much, yes. The enums are right there, but the C signatures do not use them - I'm afraid we'll have to fix that by hand.
Error checking is simple enough to implement - no problems there!
Re: OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
1&3) The khronos website was down earlier and thus no access to the specs. Got them now, will read the essential pieces this weekend. According to your assessment (and my impression of the situation), no major problem there.
2) Sorry, totally forgot about the size constraints being a problem (the 500GB HDD that came with my PC last year is nowhere near half-full).
Actually I was referring to namespaces, not necessarily dlls. Moving ES closer to the root namespace will make the difference more obvious and I'd also like to suggest not re-use the name GL for ES-related functions (applications may have code-paths for both APIs) and rather name it GLES or ES. So if programmers browse code, they don't have to know which using statements the current file has, but can identify on first sight whether the code is currently related to GL or ES.
I'd prefer to have 1-2 big .dlls (as it currently is) allowing conditional compilation if you feel something is just wasting space (e.g. people might want to use FMOD instead of OpenAL and simply remove it from OpenTK for their projects). For Desktops/Laptops disk space is not a problem, but allowing to shrink OpenTK - when the application is ready to ship - will certainly help if the app is meant to be distributed by internet downloads and not hardcopies.
4) I'll take a look at that, since I've done that for GL already it should be pretty obvious what belongs where.
P.S. Mind my interest in GL ES is fairly limited, although I don't have a PS3 that's the only platform I'd be interested porting my renderer for.
Offtopic, but before I forget it: Who did the OpenCL functions? The person should be slapped for adding tons of meaningful
// OpenCL 1.0comments over the function signatures, rather than c&p the native C. :PRe: OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
2. Agree 100%. I'll fix that.
For the size issues, take a look into ilmerge. It's an awesome little tool that can merge all assemblies into a single executable. There's an open-source alternative, called mono-linker, but it's a little hard to get (it's buried deep into the Mono repository) and it crashed on
[return: ]attributes last time I tried (maybe this is fixed now).4. I actually removed the C signatures on purpose. The C headers changed every couple of weeks (we were at version 43 last time I checked), so the signatures fell out of sync rapidly.
I've given up on the hand-written approach: I'll just translate the C headers into xml and run them through the generator. Ultimately, this will save us a lot of trouble once OpenCL 1.1 is released.
Re: OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
[ILMerge]
If there's a parameter that strips the resulting assembly of unused classes/structs/methods/etc., I cannot see it. (I knew about ILMerge, but that missing feature is why I didn't bother with it)
[OpenCL]
Apologies, so whoever is responsible for the frequent changes should be slapped. :P
Re: OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
[ILMerge]
As far as I can tell, this feature is enabled by default.
Re: OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
Assuming this is true, I take back all statements regarding conditional compilaton of OpenTK. (Waste of our time doing that, if you can simply reduce size by a post-build step).
Re: OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
ILMerge is windows-only, unfortunately, and I don't know if the resulting binaries will work on Mono. (I'll have to check mono-linker again.)
Re: OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
beta in august. release later.
Re: OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
what's mono-linker?
Re: OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
It's a tool that can strip and merge assemblies into a single one. Depends on Mono.Merge and Cecil.
The project exits somewhere deep inside the mono repository.
Edit: or was it Mono.Merge that depends on Mono.Linker? I can never get this right.
Re: OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
ah!
http://mono-project.com/Linker
Re: OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
I'm currently playing around with OpenTK for the iPhone. It looks great, but I really miss those strongly-typed enums (one of great advantages of OpenTK over similar products)...
Do you know when they will be implemented?
Re: OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
Inertia has done most of the research necessary for ES 2.0, but unless someone volunteers to translate the necessary enums into XML we probably won't have strong types ready for the 1.0 release. The main issue is that none of the core developers is using OpenGL|ES right now, so other issues tend to take precedence.
The actual XML is very simple:
Realistically, if everyone that encountered a non-strongly-typed ES function would volunteer a few minutes to post the necessary XML, OpenGL|ES would become strongly-typed by the end of this month.
GetIntegerPName and the rest of the enums are already available:
All that's left is their XML definition.
Re: OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
I will make the necessary changes in formatting, but we need some volunteers who either write some small example applications from scratch or port existing GL examples to ES. They don't have to be groundshaking, but should run without causing any errors and test the most fundamental parts of ES (VBO, FBO, GLSL).
Re: OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
Thanks for your answer. I'd like to lean more about updating those XML definitions.
In "Bind/Specifications/ES10/signatures.xml" a found (for example):
Is all it takes to make the first parameter use the strongly-typed enum a change like the following?
(The "BeginMode"-Enum is already defined in the same file, but the tokens are all upper-case)
Re: OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
Yes, with one caveat: the signatures.xml file is auto-generated and will be overwritten whenever the specs or our converter tool changes. Updated signatures should go to the overrides.xml file.
Inertia has pretty much completed the XML overrides for the 2.0 spec. We still have the 1.1 and 1.0 specs to do (the latter is not very useful nowadays, but the former is).
I'll post some more concrete documentation on the generation process over the next few days.
Re: OpenTK gains support for OpenGL ES 1.0, 1.1 and 2.0
If you intend to work on ES 1.1 (and the extension pack?) my recommendation is using the ES 2.0 cleanup as a basis to start with. This will be alot more efficient than starting from scratch (for example the texture, VBO and fragment ops parts are already done and you could simply delete unsupported tokens and the FBO/GLSL related stuff ), so your work would be limited to cleaning up the fixed-func parts of ES 1.1