Announcing Rajawali: An OpenGL ES 2.0 Based 3D Framework For Android
Posted by Dennis on Aug 23, 2011 in 3D, Android, Rajawali • 77 comments
Rajawali is a 3D framework for Android built on top of the OpenGL ES 2.0 API. Its main purpose is to make things easy and to take away the hard work that’s involved in OpenGL programming.
Rajawali can be used to create live wallpapers and stand alone apps.
Here are some of Rajawali’s features:
- import .obj, .md2, .3ds and .fbx files
- point and directional lights
- fog
- materials: simple, diffuse, phong, gouraud, toon, bump map, environment cube map, sphere map, masked, particle
- skybox
- frustum culling
- object serialisation and compression for optimisation
- easily create custom shaders
- 2D (screen quad) renderer
- (color) object picking
- very easy to create live wallpapers
- animation classes and interpolators
- bezier splines, catmull-rom splines
- particles
- post processing effects (sepia, swirl, or create your own shader-based one)
- vertex animated models
- quaternion based rotations
- cube, sphere, particle, plane and line primitives


If you want to contribute to this project, you’re more than welcome of course!
The name “Rajawali” comes from the Indonesian language. It means “eagle”. It is also the name of a kampung on the island of Banda Neira. Banda Neira is part of the Banda Islands group. Another island from this group is called Pulau Hatta, which used to be called Rozengain. See the connection??
All the files can be found on Github:
- (main library) https://github.com/MasDennis/Rajawali
- (examples project) https://github.com/MasDennis/RajawaliExamples
- (live wallpaper template) https://github.com/MasDennis/RajawaliWallpaperTemplate
You can download the free examples app from Google Play

Here’s a long list of tutorials to help you get started:
- Rajawali Tutorial 1: Basic Setup & a Sphere
- Rajawali Tutorial 2: Creating a live wallpaper and importing a model
- Rajawali Tutorial 3: Materials
- Rajawali Tutorial 4: Optimisation
- Rajawali Tutorial 5: Skybox
- Rajawali Tutorial 6: Adding User Interface Elements
- Rajawali Tutorial 7: Creating a Custom Material / GLSL Shader
- Rajawali Tutorial 8: More About The Initialization Phase & Lost Textures
- Rajawali Tutorial 9: Rajawali Tutorial 9: 2D Renderer
- Rajawali Tutorial 10: Simple Particle System
- Rajawali Tutorial 11: A Better, Faster Particle System
- Rajawali Tutorial 12: Object Picking
- Rajawali Tutorial 13: Animation classes
- Rajawali Tutorial 14: Bump/Normal Mapping
- Rajawali Tutorial 15: MD2 Animation
- Rajawali Tutorial 16: Collision Detection
- Rajawali Tutorial 17: Importing .Obj Files
- Rajawali Tutorial 18: Drawing Lines
- Rajawali Tutorial 19: Catmull-Rom Splines
- Rajawali Tutorial 20: Animated Sprites
- Rajawali Tutorial 21: Fog
- Rajawali Tutorial 22: More Optimisation
- Rajawali Tutorial 23: Custom Vertex Shader
- Rajawali Tutorial 24: Using Geometry Data To Position And Rotate Objects
Documentation can be found here http://masdennis.github.com/rajawali/

that’s very interesting!
– it’s rather promising performance-wise.
I was actually studying openGL ES 1.x lately – mostly for the sake of studying it
the good thing with 1.x is the retro compatibility : the most important methods (such as the MatrixGrabber) are supported from android 1.5+, but the way things are done is indeed quite “old school”
taking advantage of the shaders is crucial, I bet your API is the best way to start playing with it.
thanks!
Nice work, i was just searching for a 3d engine to import stuff from blender and this seems to be very handy, actually i was thinking about using min3d but now that i see this, it seems to be worthwhile to wait a bit and use the newer engine you are building just now. I will take a look at the source as soon as i can find the time.
Thanks!
cool, let me know if you have any questions
Does it support Normal/Bump textures?
does it supports particle systems,physics and shaders.
No, not yet.
This is very awesome indeed. Cant wait to see animation implemented, even just md2. I could make a few pretty awesome live wallpapers at that point. Thanks again for this. I think Live Wallpapers are largely ignored by the developer community… but if you look they are some of the higher grossing apps.
Great work. Can this load mtl files as well?
[...] Blog github [...]
Hello!
Can you add some infos, how to overwrite opengl-es 1.x engine to 2.0?
(pushmatrix, popmatrix, and the others)
Thanks,
Leslie
I’ve been looking for this type of framework for a very long time and I am soooo glad I found it. I will be tinkering with this every chance I get. Thank you!
Amazing framework. I’m looking for it and interested in using it for 3d Live Wallpaper.
Nice framework, salam dari jakarta.
Terima kasih! Kamu akan menggunakan framework ini?
yap, tentu saja, eeeh bisa bahasa indonesia juga!!
when will be fullscreen postprocess?
Did someone manage to launch the different demos on a Galaxy Ace?
Because for me it works perfectly well on my HTC Desire HD, but it doesn’t work at all on a Galaxy Ace with the same Android version 2.3.5.
There isn’t any error, I just get a black screen after the loading. Thanks for your help.
Hi Gabriel,
There are some issues with Galaxy devices. What Galaxy Ace do you have, the first, the Plus or the 2?
Hi Denis,
Thank you for your prompt response. I have just opened an issue on Rajawali repository on Github, it should be more appropriate than on your blog.
I’m trying to switch from using jPCT-AE to this engine (for more features), but the transition is slow due to the Javadoc for this engine having no information about the functions besides where they are located and what types of variables they use. So I have to navigate through the source code to determine what each function accomplishes.
How long till you publish a Javadoc with more info?
Hi Adam,
I will start doing this the coming weeks.
You’re absolutely right, the JavaDoc needs more info. So far I’ve given priority to adding features and stabilising the engine. I guess the time has come to write some documentation
Cheers,
Dennis
Hi Dennis.
I have a Problem with Textures on a simple Cube. On my Iconia A100 (Android 4.0.3) Tablet, I can see the Cube, but it dont have a texture on it. When I use the exact same code on my HTC Evo 3D (Andorid 2.3.4), all is working correctly.
I build with Android 2.2
Do you have an idea what is going wrong?
Thanks for any help.
Danny
Are your textures square power of two textures? Some devices can’t handle npot non square textures.
I’m using your earthtruecolor_nasa_big texture for testing.
do you get any error messages in logcat?
No, I’m getting the same info in logcat as when I’m running it on the other Device without any errors.
Maybe some more info:
I’m trying to map a texture on a cube inside my live wallpaper. When I’m running your Rajawali Examples app, everything is working with textures on the models.
Danny
I just made an run the first example with the Sphere and selera_sari Texture.
Strange, but it works fine. I see the Sphere and Texture on it.
Maybe this is an issue with the Live Wallpapers?!?
Danny
Nevermind. I got it now!
I checked the other Tutorials and found the solution.
Danny
By the way: Nice Framework!
Thanks for that.
Danny
So because no1 answers my question in the issues list, I try to get an answer from here:
Any1 can tell me how I change the texture on a model?
I currently have 4 textures loaded and want to map them when touched a button.
Here is my Renderer code:
public class TextureTestActivityRenderer extends RajawaliRenderer
{
private DirectionalLight mLight;
private Sphere mSphere;
private Number3D axis;
private RotateAnimation3D mAnim;
private Bitmap[] tex;
private TextureInfo[] texInfo;
private SimpleMaterial[] mat;
private boolean touched;
int i = 0;
public TextureTestActivityRenderer(Context context)
{
super(context);
setFrameRate(30);
}
@Override
public void initScene()
{
mLight = new DirectionalLight(); // set the direction
mLight.setColor(1, 1, 1.0f);
mLight.setPosition(.5f, 0, -2);
tex = new Bitmap[4];
texInfo = new TextureInfo[4];
mat = new SimpleMaterial[4];
tex[0] = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.earthtruecolor_nasa_big);
tex[1] = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.talitsch);
tex[2] = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.diff_train_rus01);
tex[3] = BitmapFactory.decodeFile(“/sdcard/Test/1.jpg”);
texInfo[0] = mTextureManager.addTexture(tex[0]);
texInfo[1] = mTextureManager.addTexture(tex[1]);
texInfo[2] = mTextureManager.addTexture(tex[2]);
texInfo[3] = mTextureManager.addTexture(tex[3]);
for(int i=0;i<tex.length;i++)
{
mat[i] = new SimpleMaterial();
mat[i].addTexture(texInfo[i]);
}
mSphere = new Sphere(1, 10, 10);
mSphere.setMaterial(mat[0]);
mSphere.addLight(mLight);
addChild(mSphere);
axis = new Number3D(0, 180, 0);
axis.normalize();
mAnim = new RotateAnimation3D(axis, 360);
mAnim.setDuration(8000);
mAnim.setRepeatCount(Animation3D.INFINITE);
mAnim.setInterpolator(new
AccelerateDecelerateInterpolator());
mAnim.setTransformable3D(mSphere);
mCamera.setZ(-4.2f);
startRendering();
}
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
super.onSurfaceCreated(gl, config);
mAnim.start();
}
@Override
public void onDrawFrame(GL10 glUnused) {
super.onDrawFrame(glUnused);
if(i == 3)
i = 0;
else
i++;
if(touched)
{
Log.d("drin", "" + i);
mSphere.setMaterial(mat[i]);
touched = false;
}
}
public void Touched()
{
touched = true;
}
}
Any help would be much appreciated.
Danny
Hi!,
First of all Thank you very much for the framework.
Im waiting for the bones actualization
and I was testing movements with md2 (your ogro example) in your live wallpaper template, and… I dont know why but when I push the “set wallpaper” botton then the ogro disappears.
I tried again with the ogro and the spacecrafts (of the sphere map example) at the same time and… only the ogro disappears when I press the “set wallpaper” botton.
Can you help me please? Its a bug or I must do something else?
Thank you
Can you help me please? Its a bug or I must do something else?
Thank you
Very nice. I’ll try it soon. I’m very interested in the TODO list features, specially octree to build large worlds. I’ve started to code an octree to my project some time ago (http://irrrpgbuilder.sourceforge.net/forum/viewtopic.php?f=3&t=236), maybe we can adapt it (or rebuild optimizing for android) to rajawali to improve performance.
Hi Andres,
Would be great to have this in Rajawali. I’ve used Irrlicht in the past, great engine. Lets have a chat about this
@KateMoore: this is a known issue, I’m working on a fix.
Hi Dennis and all Rajawali Users.
Where is the best place to get answers for Questions regarding the Rajawali Framework?
I asked a Question inside the Tutorial 11, but I think no1 sees that there is a new comment.
Danny
Rajawali looks great and I’m really looking forward to use Rajawali but this tutorial seems to be outdated. I’ve pulled the most recent source code from git hub and even downloaded the example from the link and I’m having trouble to see the expected results. All I see is a grayish circle that seems to be the sphere rotating(I can tell because the sphere appears to be a oval shaped sphere hence I can see the outline of the sphere moving side by side a bit if you know what I mean).
So my question is… what is the state of the project.
initLoader(); at the last line of the RajawaliActivity extended class of the example and the ((RajawaliExampleActivity) mContext).showLoader(); line in onSurfaceCreated of the render seems to be using methods that are no longer available. please help me~
Hey man, how can I translate an object? which is the custom command to translate a 3d object imported from a .obj?
Hey Henrique. Check this out: http://masdennis.github.com/rajawali/rajawali/ATransformable3D.html
[...] Rajawali Share this:TwitterFacebookLike this:LikeBe the first to like this. [...]
Solved all the problems i had earlier, and now its working like a charm!
This library should be shipped with the Android sdk, its just perfect!
Btw, is there any way to get the normals from two colliding objects?
GPU PowerVR 530 , 540 and mali 400MP use your engine was not work well, some very slowly ,some was error.
Hi Dennis,
Can you please confirm me that it is possible to use the accelerometer feature in a live wallpaper? I’m having a hard time trying to make it work, but if you tell me it is indeed possible I’ll keep trying. Thanks
nevermind, just seen your skull LWP on the market
I start my work to use Rajawali to complete a Rubik’s cube. The question is: i want to know which object i touched ,i use ObjectColorPicker ;but this is not return the object directly ,it is through OnObjectPickedListener callback . It is asynchronous ,so if i want to get the picked object,i must wait the next frame to drawn?
private HashMap mPickObjs=
new HashMap();
public void onObjectPicked(float x,float y,BaseObject3D pickedObj) {
//cache the return object
mPickObjs.put(getPickKey(x,y), pickedObj);
}
Hi Dennis,
if I want to get BaseObject3D’s location in model view, the following code is right or not?
BaseObject3D.java
//new added to get location*mmatrix
public Number3D getLocationVector(){
Number3D result =getPosition().clone();
result.multiply(mMMatrix);
return result;
}
because I want to use like the following:
private BaseObject3D mStartCube;
private BaseObject3D mEndCube;
//get the location vector of the first cube and second cube to
//get the rotate axis
Number3D endCubeLocVec = mEndCube.getLocationVector();
Number3D startCubeLocVec =mStartCube.getLocationVector();
Number3D axis =startCubeLocVec.clone();
axis.cross(endCubeLocVec);//axis is the cross value
Hi,
I am trying to use a plane with texture as the room floor. The issue is that the lines in the texture in the farther Z is blurry. Has anyone seen this issue?
Hi,
I really appriciate your work on this.
Maybe somene else asked this before, but i dindt find it anywhere. Whats the license policy?
Hi Parez,
You can find the license here: https://github.com/MasDennis/Rajawali/blob/master/LICENSE.txt
Hi Dennis,
I have use rajawali drawn a Rubik’s cube. All is very good,but I think the touch event processing is slow.Can you give me some advise? or how can i get your email ?
Hi Dennis, Fantastic engine am learning a lot very quickly but am having a problem I am really banging my head against a wall with.
I am trying to create a sphere which will have a “day” texture and a “night” texture mapped to it which will fade between the two at the two appropriate transitions (dawn/dusk). I thought this would be a simple frag shader and some init code – but for the life of me I can’t get it working.
Any ideas? What am I missing?
Regards
Darren
FRAG SHADER:
precision mediump float;
uniform sampler2D earth_clouds;
uniform sampler2D earth_day;
varying vec2 vTextureCoord;
void main() {
vec4 t1 = texture2D(earth_clouds, vTextureCoord);
vec4 t2 = texture2D(earth_day, vTextureCoord);
gl_FragColor = mix(t1,t2,0.5); //the 0.5 will obviously transition 0>1
}
MAIN CODE PARTIAL:
Bitmap bg = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.earth_day);
Bitmap bg2 = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.earth_clouds);
mSphere = new Sphere(1, 32, 32);
mSphere.addLight(mLight);
mCustomMaterial = new CustomMaterial();
mSphere.setMaterial(mCustomMaterial);
mSphere.addTexture(mTextureManager.addTexture(bg));
mSphere.addTexture(mTextureManager.addTexture(bg2));
addChild(mSphere);
Great work!
Unfortunately you don’t have a Collada parser that would be very nice. Maybe a nice feature for the future?
With kind regards Smek
Hi Dennis, fantastic engine!
I have a question about textured cubes.
—————————————–
// Load texture
Bitmap texture = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.logo);
TextureInfo tinfo = mTextureManager.addTexture(texture);
SimpleMaterial material = new SimpleMaterial();
material.addTexture(tinfo);
mCube = new Cube(5);
mCube.setMaterial(material);
—————————————–
Doing this, the texture is showed with the flipped texture. Why?
Thanks for this great job!
Amazingggggggg!
where can I find source code of .so and jar file of rajwali because I could not find them in github all i found was shared lib(.so) and jar file?
Made a live wallpaper using SerializedObject3D and other features of this great lib. Please download free from thread: http://forum.xda-developers.com/showthread.php?p=30802750#post30802750
I need something like “onVisibiltyChanged” to disable stereoscopic display on evo3d if my wallpaper is hidden, but wallpaper engine seems to stand if invisible.
Is there a suggested way to call something if wallpaper is hidden?
Hey aSiD1712.
Maybe you should post your question here:
https://github.com/MasDennis/Rajawali/issues?direction=desc&sort=created&state=open
Thats the place where most rajawali users answer to questions.
Danny
Hi.
Just wanted you to know, that I just released my first wallpaper using this great framework.
Have a look at:
https://play.google.com/store/apps/details?id=de.danielali.museumwallpaper
Danny
Hi Danny,
Great stuff! That’s a beautiful wallpaper. Thanks for letting me know
Dennis
Nice Tutorials!!!
I want to generate Starfield using this Framework,i thought Tutorial 9 would be useful,,Does it Support Random Generation of Particles using the same ?!
Consider Tutorial No 9 from https://github.com/MasDennis/RajawaliExamples …
Hi Dennis, I’m having some trouble getting started.
The most important part of creating a live wallpaper is animating the screen when you swipe between homescreens. Something DannyDan (above) also clearly had great difficulty with. You did a beautiful job in the autumn grove wallpaper! How did you do this?
There seems to be no tutorial for this.
I’m confident if I had a working example I could jump right in and pick out how it works very quickly. But somehow all of this documentation is lost on me. I feel the tutorials would be better if you provided the working code, and then in the tutorial just went through the code explaining why each part works/is needed. You have clearly spent a lot of time writing the documentation, and I’m sad that I cannot even get the first couple of tutorials to work.
Can you help me figure out how to glide the camera around the scene when I swipe between screens, and can you help me by providing a working example for me to jump into?
I’m just really lost.
Thanks & Best Regards!
Tritaru
Hi Dennis
Do you have a good tutorial on how to swoop the camera around the scene when you swipe between screens like in the Autumn Grove 3D wallpaper?
Also, I think it would aid new users to be able to download a working example to jump in and get our feet wet with. Do you have such a simple example available? Perhaps something as simple as a box that the camera sweeps around when you swipe between homescreens.
Thanks & Best Regards!
Tritaru
Hi Dennis,
Your framework is amazing. Thank you for building and opening it to us! I have released my first wallpaper using it and I wanted to share what we accomplished with your code.
https://play.google.com/store/apps/details?id=com.evvid.wallpapers.aviation3d.lightplane
You rock!
[...] 具体教程在作者的bolg里点这里 [...]
Hi!
This is a very nice framework congrats!
I am new to android programming and i would like to ask you a question, hopping that someone can help me.
I need to hide my 3D object that is on the surfaceView, but i don’t know how to hide this view the method .setvisibility isn’t working… any tips?
thank you
Hello Dennis, thanks for this awesome framework,
It is possible to create ocean shader with this library ?
Why RajawaliActivity is deprecated, we can’t use it ?
Hi Dennis, you export md2 file use which sofeware?
Dennis:
First of all, thank you for this excelent work, even though I do not know anything about OpenGL I was able to create a nice live wallpaper using Rajawali (https://play.google.com/store/apps/details?id=com.onebutton.livewallpaper.budastatuefree&feature=search_result). If we dont take into account the OOM errors; I noticed only one issue: When you bring the LWP from pause state (I think) it takes several seconds to respond to touch , and even the animations are frozen.
What could be the cause? Could you point me where to look in order to try a fix?
Hi. I am a newbie can someone provide code for simple wallpaper with good documentation
Hi, Love the library!!! its the first one that is really helping me get into using OpenGL in my apps.
I noticed in the 360Renderer activity and with the 2000Textures activity that the app doesn’t read the transparency data in a ‘PNG’ file. Is there a way to allow the system to read transparency data? I’m looking especially at Live Wallpapers.
hi what about md3 support?
Can i use setSkyBox in livewallpaper?
I have to say thank you to Mas Dennis.
very interesting to try n try n more for this software.
It’s really hard to make .md2 for my project.
My problem is how to make fasten loading for .md2 object with 612Kb except reduce the vertex of object.
I write simple review in my blog.http://teknologi.kompasiana.com/terapan/2013/03/28/rajawali-framework-3d-android-546045.html
Thank you dan Salam Bahagia.
[...] is free library for using 3D objects in android Rajawali. You can get all information here. It has some very nice tutorials to begin with I hope this will help you. It will also show how to [...]
I got a next problem when i try to parse .obj file: my3dsobj.addLight(light) throws NullPointer exception, but i already have a light in a initScene method:
……..
ALight light = new DirectionalLight();
light.setPower(1);
light.setPosition(0, 0, -5);
mCamera.setPosition(0, 0, -50);
mCamera.setLookAt(0, 0, 0);
……..
Hi, please report your issue here: https://github.com/MasDennis/Rajawali/issues?state=open
Thanks,
Dennis