Gingerbread NDK Awesomeness

[This post is by Chris Pruett, an outward-facing Androider who focuses on the world of games. —Tim Bray]

We released the first version of the Native Development Kit, a development toolchain for building shared libraries in C or C++ that can be used in conjunction with Android applications written in the Java programming language, way back in July of 2009. Since that initial release we’ve steadily improved support for native code; key features such as OpenGL ES support, debugging capabilities, multiple ABI support, and access to bitmaps in native code have arrived with each NDK revision. The result has been pretty awesome: we’ve seen huge growth in certain categories of performance-critical applications, particularly 3D games.

These types of applications are often impractical via Dalvik due to execution speed requirements or, more commonly, because they are based on engines already developed in C or C++. Early on we noted a strong relationship between the awesomeness of the NDK and the awesomeness of the applications that it made possible; at the limit of this function is obviously infinite awesomeness (see graph, right).

With the latest version of the NDK we intend to further increase the awesomeness of your applications, this time by a pretty big margin. With NDK r5, we’re introducing new APIs that will allow you to do more from native code. In fact, with these new tools, applications targeted at Gingerbread or later can be implemented entirely in C++; you can now build an entire Android application without writing a single line of Java.

Of course, access to the regular Android API still requires Dalvik, and the VM is still present in native applications, operating behind the scenes. Should you need to do more than the NDK interfaces provide, you can always invoke Dalvik methods via JNI. But if you prefer to work exclusively in C++, the NDK r5 will let you build a main loop like this:

void android_main(struct android_app* state) {
    // Make sure glue isn't stripped.
    app_dummy();

    // loop waiting for stuff to do.
    while (1) {
        // Read all pending events.
        int ident;
        int events;
        struct android_poll_source* source;

        // Read events and draw a frame of animation.
        if ((ident = ALooper_pollAll(0, NULL, &events,
                (void**)&source)) >= 0) {
            // Process this event.
            if (source != NULL) {
                source->process(state, source);
            }
        }
        // draw a frame of animation
        bringTheAwesome();
    }
}

(For a fully working example, see the native-activity sample in NDK/samples/native-activity and the NativeActivity documentation.)

In addition to fully native applications, the latest NDK lets you play sound from native code (via the OpenSL ES API, an open standard managed by Khronos, which also oversees OpenGL ES), handle common application events (life cycle, touch and key events, as well as sensors), control windows directly (including direct access to the window’s pixel buffer), manage EGL contexts, and read assets directly out of APK files. The latest NDK also comes with a prebuilt version of STLport, making it easier to bring STL-reliant applications to Android. Finally, r5 adds backwards-compatible support for RTTI, C++ exceptions, wchar_t, and includes improved debugging tools. Clearly, this release represents a large positive ∆awesome.

We worked hard to increase the utility of the NDK for this release because you guys, the developers who are actually out there making the awesome applications, told us you needed it. This release is specifically designed to help game developers continue to rock; with Gingerbread and the NDK r5, it should now be very easy to bring games written entirely in C and C++ to Android with minimal modification. We expect the APIs exposed by r5 to also benefit a wide range of media applications; access to a native sound buffer and the ability to write directly to window surfaces makes it much easier for applications implementing their own audio and video codecs to achieve maximum performance. In short, this release addresses many of the requests we’ve received over the last year since the first version of the NDK was announced.

Awesome Russian Military Trucks!

Russian Military Trucks – part 1 – KAMAZ

Russian Military Trucks – part 2 – BTR 80

Russian Military Trucks – part 3 – URAL

Russian Military Trucks – part 4 – ZIL

Russian Military Trucks – part 5 – BAZ

Russian Military Trucks – part 6 – MAZ

Russian Military Trucks – part 7 – GAZ Tiger

Респект Авторов! Спасибо, большое!

The iOS Video Chat Applications: FaceTime vs. Skype

Obviously, these tests aren’t scientific, but now that FaceTime has some real competition from the biggest name in video chat, we thought we’d do a quick comparison of the two. We know there are other apps out there, but since these are by far the most well-known, we’re just covering these for now. For frame of reference, the tests were performed with either an iPhone 4 and an iPod touch 4G or an iPhone 4 and a Hackintosh running OS X with a Logitech Pro 9000 webcam.

Skype

Unlike Skype on the desktop, which has a lot of configuration settings that allow you to optimize video for different connections, Skype on iOS is a chat-out-of-the-box affair. It handles video chatting pretty well, though, since it limits the video quality of the outgoing video to keep it from sucking up your bandwidth. The audio quality we experienced was very clear, and while your outgoing video on the iPhone might not be the best, the incoming video is of higher quality if your chat partner is on a desktop computer. Quality will be a bit lower on both sides if it’s iOS-to-iOS. We did notice a bit of lag in between the video and the audio as well, though it was nothing unbearable—we still found it to be a pleasurable video chat experience.

Feature-wise, it’s important to note that Skype has a big leg up on FaceTime at the time of this writing (January 2011). Not only does it have the ability to video chat over Wi-Fi and 3G, it’s also cross-platform on the desktop, which means you can chat with any of your friends, whether they have Windows, OS X, or Linux.
FaceTime

While FaceTime doesn’t give you as many options as Skype, seeing as it’s iOS and Mac only (and is limited to Wi-Fi at the moment), it does still provide a good video chat experience. The audio quality was still pretty great, and there was no lag between the video and the audio like there was on Skype. The video quality was a bit better when you stood still, though if you started moving around the framerate would drop (until you stood still again).

Overall, I wouldn’t particularly pick one over the other, as they’re both great apps. If you put a gun to my head, I’d probably pick FaceTime, if only for the lack of lag—but the video quality in Skype, while lower, was a bit less distracting (to me, at least). They’re both great apps, and I wouldn’t push any of my friends to use one or the other while chatting with me. Like I mentioned before, Skype has the distinct advantage of being cross-platform and not being limited to Wi-Fi, so that’s always a big plus.