Announcing Rajawali: An OpenGL ES 2.0 Based 3D Framework For Android

Posted by on Aug 23, 2011 in 3D, Android, Rajawali77 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?? :P

All the files can be found on Github:

You can download the free examples app from Google Play

Here’s a long list of tutorials to help you get started:

Documentation can be found here http://masdennis.github.com/rajawali/



Tags: , , , ,


77 comments

» Comments RSS Feed
  1. that’s very interesting!
    I was actually studying openGL ES 1.x lately – mostly for the sake of studying it :) – it’s rather promising performance-wise.

    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!

  2. 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!

  3. cool, let me know if you have any questions

  4. Does it support Normal/Bump textures?

  5. does it supports particle systems,physics and shaders.

  6. No, not yet.

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

  8. Great work. Can this load mtl files as well?

  9. [...] Blog github [...]

  10. Hello!

    Can you add some infos, how to overwrite opengl-es 1.x engine to 2.0?

    (pushmatrix, popmatrix, and the others)

    Thanks,
    Leslie

  11. 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!

  12. Amazing framework. I’m looking for it and interested in using it for 3d Live Wallpaper.

  13. Nice framework, salam dari jakarta.

  14. Terima kasih! Kamu akan menggunakan framework ini?

  15. yap, tentu saja, eeeh bisa bahasa indonesia juga!!

  16. when will be fullscreen postprocess?

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

  18. Hi Gabriel,
    There are some issues with Galaxy devices. What Galaxy Ace do you have, the first, the Plus or the 2?

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

  20. 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?

  21. Hi Adam,
    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 :-) I will start doing this the coming weeks.
    Cheers,
    Dennis

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

  23. Are your textures square power of two textures? Some devices can’t handle npot non square textures.

  24. I’m using your earthtruecolor_nasa_big texture for testing.

  25. do you get any error messages in logcat?

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

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

  28. Nevermind. I got it now!

    I checked the other Tutorials and found the solution.

    Danny

  29. By the way: Nice Framework!

    Thanks for that.

    Danny

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

  31. Hi!,
    First of all Thank you very much for the framework.

    Im waiting for the bones actualization :P 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

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

  33. 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 :-)

  34. @KateMoore: this is a known issue, I’m working on a fix.

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

  36. 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~

  37. Hey man, how can I translate an object? which is the custom command to translate a 3d object imported from a .obj?

  38. Hey Henrique. Check this out: http://masdennis.github.com/rajawali/rajawali/ATransformable3D.html

  39. [...] Rajawali Share this:TwitterFacebookLike this:LikeBe the first to like this. [...]

  40. 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?

  41. GPU PowerVR 530 , 540 and mali 400MP use your engine was not work well, some very slowly ,some was error.

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

  43. nevermind, just seen your skull LWP on the market

  44. 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);
    }

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

  46. 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?

  47. Hi,
    I really appriciate your work on this.
    Maybe somene else asked this before, but i dindt find it anywhere. Whats the license policy?

  48. Hi Parez,
    You can find the license here: https://github.com/MasDennis/Rajawali/blob/master/LICENSE.txt

  49. 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 ? :)

  50. 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);

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

  52. 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! ;)

  53. Amazingggggggg!

  54. 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?

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

  56. 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?

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

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

  59. Hi Danny,
    Great stuff! That’s a beautiful wallpaper. Thanks for letting me know :)
    Dennis

  60. 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 ?!

  61. Consider Tutorial No 9 from https://github.com/MasDennis/RajawaliExamples

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

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

  64. 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!

  65. [...] 具体教程在作者的bolg里点这里 [...]

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

  67. 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 ?

  68. Hi Dennis, you export md2 file use which sofeware?

  69. 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?

  70. Hi. I am a newbie can someone provide code for simple wallpaper with good documentation

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

  72. hi what about md3 support?

  73. Can i use setSkyBox in livewallpaper?

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

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

  76. 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);
    ……..

  77. Hi, please report your issue here: https://github.com/MasDennis/Rajawali/issues?state=open
    Thanks,
    Dennis

Leave a comment