# Android OpenGL

**URL:** <https://forum.juce.com/t/android-opengl/8747>\
**Category:** Android\
**Created:** [May 29, 2012, 12:26am UTC](https://forum.juce.com/t/android-opengl/8747 "2012-05-29T00:26:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hugh](https://avatars.discourse-cdn.com/v4/letter/h/c5a1d2/32.png) [@hugh](https://forum.juce.com/u/hugh)\
**Post date:** [May 29, 2012, 12:26am UTC](https://forum.juce.com/t/android-opengl/8747/1 "2012-05-29T00:26:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![roversburn](https://avatars.discourse-cdn.com/v4/letter/r/50afbb/32.png) [@roversburn](https://forum.juce.com/u/roversburn)\
**Post date:** [June 22, 2012, 5:58am UTC](https://forum.juce.com/t/android-opengl/8747/2 "2012-06-22T05:58:51Z")

</div>

[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.
