Game Development Reference
In-Depth Information
m_Cube = new Cube(iContext,
CubeMesh,
CubeTex,
Material1,
Shader);
// Set Intial Position and Orientation
Vector3 Axis = new Vector3(0,1,0);
Vector3 Position = new Vector3(0.0f, 0.0f, 0.0f);
Vector3 Scale = new Vector3(1.0f,1.0f,1.0f);
m_Cube.m_Orientation.SetPosition(Position);
m_Cube.m_Orientation.SetRotationAxis(Axis);
m_Cube.m_Orientation.SetScale(Scale);
//m_Cube.m_Orientation.AddRotation(45);
}
@Override
public void onSurfaceCreated(GL10 unused, EGLConfig config)
{
m_PointLight = new PointLight(m_Context);
SetupLights();
CreateCube(m_Context);
}
@Override
public void onSurfaceChanged(GL10 unused, int width, int height)
{
// Ignore the passed-in GL10 interface, and use the GLES20
// class's static methods instead.
GLES20.glViewport(0, 0, width, height);
m_ViewPortWidth = width;
m_ViewPortHeight = height;
SetupCamera();
}
@Override
public void onDrawFrame(GL10 unused)
{
GLES20.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
m_Camera.UpdateCamera();
m_Cube.m_Orientation.AddRotation(1);
m_Cube.DrawObject(m_Camera, m_PointLight);
}
}
First the onSurfaceCreated() function is called. In this function, a new light is created and initialized
and the 3D cube object is also created.
Search WWH ::




Custom Search