Android mobile 3D engine research 1

Source: Internet
Author: User

Because Android phones support OpneGL ES, 3D features are a major feature of Android phones. However, there are still relatively few materials for 3D application development on Android phones. Therefore, many people are exploring 3D application development on Android phones through the iPhone 3D tutorial. Recently, it was accidentally discovered that min3d, an open-source 3D engine on Android, is very small and has only a few hundred kb. It basically implements all functions on OpenGL ES and can also read Obj and 3ds files, at the same time, this project must use a relatively free MIT license model, so it can be used as the basis for the development of 3D applications.

First download the project from googlecode: http://min3d.googlecode.com/svn/trunk. Create a new Android project, copy the src content under the min3d directory to the source file directory of the current project, and refresh it (Press F5). At this time, eclipse will recompile the entire project, at this point, the compilation should be successful.

The following is the first 3D program. First, a new class is created to inherit the RendererActivity class of min3d and add it to the ApplicationManifest. xml file. The Code is as follows:

Public class Lesson01 extends RendererActivity {
@ Override
Public void initScene (){}

@ Override
Public void updateScene (){}
}

Add the 3D object to be displayed in initScene and process 3D animation in the updateScene function.

In this tutorial, we want to display the simplest cube and rotate it. So we need to add the following code to add the cube to the scene:

Public void initScene (){
Scene. lights (). add (new Light (); // add a Light source
Cube = new Box (1.0f, 1.0f, 1.0f, null, false, true, false); // displays the gray cube with no color or texture
Cube. colorMaterialEnabled (false );
Cube. position (). x = 0.0f;
Cube. position (). y = 0.0f;
Cube. position (). z = 0.0f;
Cube. rotation (). x = 45.0f;
Cube. rotation (). y = 30366f;
Cube. rotation (). z = 10.0f;
Scene. addChild (cube); // Add to scene
}

In min3d, 3D objects are organized by scenario. The above Code creates a gray cube at the origin.

Let's make it rotate around the Y axis:

Public void updateScene (){
Cube. rotation (). y + = 2.0f;
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.