[quote=“Tipam, post:1, topic:22880”]
Does anyone know of such?[/quote]
Yes, I’ve got code for animating 3D objects using SDL2 and ES 1.1 on Android. Here’s a YouTube video of it running on four devices.
The only snag, from your point of view, is that it’s written in BBC BASIC! It would be pretty straightforward to convert it to a more ‘familiar’ programming language but I expect you would prefer not to have to.
Wow! - Absolutely love the BBC demos on your APK! … brings back so many memories! (I used to have several BBC computers then an Archimedes etc… I also remember programming in 6502 (that will give away my age!))
So, I did manage to get a cube rotating but the z-buffer is very limited -1 to +1 in range. This is despite setting zNear and zFar using glFrustumf, glOrthof and glDepthRangef! Is this a bug?
[quote=“Tipam, post:3, topic:22880”]
Is this a bug?[/quote]
Not that I’m aware of. For example in ‘teapot.bbc’ the eye-object distance is 9 and zFar is 1000, and everything seems to work as expected. Setting zFar to 9 has the expected effect of clipping the teapot to that plane.
[quote=“Tipam, post:5, topic:22880”]
Would you mind checking this code out on my GitHub?[/quote]
I think you need to delete the call to glDepthRangef, then the depth range you set in glFrustumf should work as expected.
[quote=“Tipam, post:7, topic:22880”]
I’ll keep trying - thanks again for looking[/quote]
As you are - or were - familiar with BBC BASIC you can compare your code with mine. In my Android app tap on @lib$ then long-press on gleslib.bbc and then select Edit from the menu. The relevant code is in PROC_render().
[quote=“Tipam, post:9, topic:22880”]
I’ll admit that I’m very impressed with your full-blown BBC code editor on my phone!![/quote]
Itself entirely written in BBC BASIC of course (touchide.bbc in the tools folder)!
Looking at your code I can’t figure out where the 800 comes from in:
Yes, its a form of perspective scaling - a technique that’s used in the Marmalade SDK (although it took me some time to figure it out!) The 800.f value is a little random, but it roughly determines a field of view around 60 deg.