Android OpenGL


#1

i’ve been having a go at getting some opengl working on Android.

The plan is to attach a context to a component and implement the usual `paint’ code and hope to get some opengl magic. my simple test is to draw a rotating bitmap.

now, on the windows pc things work suavely. everything ok; rotatarama!

when i try to put the same code onto android, the first problem is that i don’t get any opengl rendering at all - just a grey window! This is on a real device.

i eventually solved this one by setting the component to be `opaque’. this prevents the grey background filling (not necessary anyhow) and, presto, my image appears!

…and it rotates.

but there are some weird things:

weird thing #1: i get two title bars!
shortly after starting, it draws another title bar, a little lower than the first.

weird thing #2: the bitmap colours are wrong.

looks like i’m gettingsblue and red swapped. green is ok. i can reveal that the colours on the PC are correct, only wrong on my phone. maybe this is a bug in the phone opengl. don’t know. this smells like an endian issue?

if i change the code to draw a normal Juce image through opengl, it’s ok. only the images created with `OpenGLImageType’ are wrong.

– hugh.


#2

[quote=“hugh”]
weird thing #2: the bitmap colours are wrong.

looks like i’m gettingsblue and red swapped. green is ok. i can reveal that the colours on the PC are correct, only wrong on my phone. maybe this is a bug in the phone opengl. don’t know. this smells like an endian issue? [/quote]
I think that it’s a probable phone glitch. The colors should b be displayed normally both for a PC and a phone.