Sd3d is a simple library to use aiming at achieving 3D graphics with very few lines of code.
1. Start a new Android project, let say a simple Activity project.
2. Add Sd3d as a project library.
3. In the activity class file, replace the generated onCreate by the following code.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Sd3dRessourceManager.init(this);
if (GameHolder.mGame == null)
{
GameHolder.mGame = new Sd3dGame();
GameHolder.mGame.init(this);
}
setContentView(R.layout.activity);
Sd3dGLSurfaceView mGLSurfaceView =
(Sd3dGLSurfaceView) findViewById(R.id.glsurfaceview);
mGLSurfaceView.setRendererGame(GameHolder.mGame.mRenderer, GameHolder.mGame);
GameHolder.mGame.setMGLSurfaceView(mGLSurfaceView);
}
Ok the code is a bit ugly and not self explanatory but it'll do the job of initializing the project.
4. Edit the generated layout file in the "layout/" directory.
It should be something like that :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<org.nicolasmy.sd3d.Sd3dGLSurfaceView android:id="@+id/glsurfaceview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</RelativeLayout>
5. Copy the "config/" and "shaders/" directory that are in the "assets" directory of the sd3d project to the assets directory in your project directory.
VoilĂ ! your application is ready to run, showing something like a black screen (not of death hopefully).