Install Android SDK and Eclipse.
Use real device for debug.
Download AquaMotion3D.zip and copy to Eclipse Workspace. On Eclipse 'File'→'Import' menu,'General'→'Existing Projects into Workspace', 'Select root directory' select Workspace, Projects select AquaMotion3D.
Coding AquaMotion3D.java like this, display character.
package jp.vixar.aquamotion3d;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
import android.content.Context;
import android.opengl.GLES20;
import android.opengl.GLSurfaceView;
import android.opengl.Matrix;
import com.roxiga.aquamotion3d.*;
import com.roxiga.models.*;
class AquaMotion3D implements GLSurfaceView.Renderer
{
private Scene3D _scene = new Scene3D();
private Context _context;
public int _width;
public int _height;
private Model3D _obj = new Tonia();//①Genrerate model instance
public AquaMotion3D(Context context)
{
_context = context;
}
public void onDrawFrame(GL10 glUnused)
{
GLES20.glClearColor(0.2f, 0.6f, 1, 1.0f);
GLES20.glClear(GLES20.GL_DEPTH_BUFFER_BIT|GLES20.GL_COLOR_BUFFER_BIT);
GLES20.glUseProgram(_scene._program);
Matrix.setLookAtM(_scene._vMatrix, 0,
500, 500, 500,
0, 100, 0,
0, 1, 0);
_obj.draw(_scene);//②Draw model
}
public void onSurfaceChanged(GL10 glUnused, int width, int height)
{
GLES20.glViewport(0, 0, width, height);
_scene.perspective(45,(float) width / height,1,10000);
Matrix.orthoM(_scene._orthoMatrix, 0, 0, width, height, 0, 100, -100);
}
public void onSurfaceCreated(GL10 glUnused, EGLConfig config)
{
_scene.onSurfaceCreated();
_obj.setTexture(_context.getResources(),R.drawable.tonia);//③Import Texture
}
public void actionDown(float x,float y)
{
}
public void actionMove(float x,float y)
{
}
public void actionUp(float x,float y)
{
}
}
Just coding red ①~③, you can display character.
①Model3D class is exported from TransMotion or Vixar Motion.
Tonia() is girl, export to 'AquaMotion3D\src\com\roxiga\models' folder.
②Display girl.
③Set texture. Texture must be copy to 'AquaMotion3D\res\drawable' folder. texture is 'tonia.jpg'.