Game Development Reference
In-Depth Information
Next, the onSurfaceChanged() function is called. In this function, the camera is created and initialized.
The camera's properties, such as position, orientation, and camera lens qualities, are defined.
In the onDrawFrame() function, the background is cleared to the color white. The camera is then
updated. Next, the cube is rotated by one degree, and finally, the cube object is drawn.
Class Overview
In this topic, the base class for 3D objects is the Object3d class. Other 3D objects, such as the Cube
class, derive or extend directly or indirectly from the Object3d class.
The Object3d class contains other key classes, such as the Orientation class, MeshEx class, Texture
class, Material class, and Shader class.
The Orientation class holds a 3D object's position, rotation, and scaling data.
The MeshEx class defines one type of OpenGL 3D mesh that is used to represent a 3D object.
The Texture class defines a texture that consists of a bitmap image that can be applied across a
3D object.
The Material class defines an object's Material properties, which define the color and lighting
properties of an object. The properties are Emissive, Ambient, Diffuse, Specular, Specular_Shininess,
and Alpha.
Emissive refers to the light emitted by the object itself.
Ambient refers to the color the material reflects when hit with ambient light. Ambient
light is constant all over the object and is not affected by the light's position or the
viewer's position.
The Diffuse property refers to the color the material reflects when hit with diffuse
light. The intensity of diffuse light across an object depends on the angle the object's
vertex normals make with the light direction.
The Specular property refers to the specular color the material reflects. The
specular color depends on the viewer's position, the light's position, as well as the
object's vertex normals.
The Specular_Shininess property refers to how intense specular light reflections on
the object will be.
The Alpha value is the object's transparency.
The Shader class defines how a 3D object will be drawn and lighted. It consists of vertex shaders
and pixel or fragment shaders. Vertex shaders determine where the object's vertices are located in
the 3D world. Fragment shaders determine the color of the object being shaded.
The Camera class represents the view into the OpenGL 3D world. Position, orientation, and the
camera lens properties are all contained within this class.
The Cube class contains vertex position data, vertex texture data, and vertex normal data that are
needed to render a 3D cube with textures and lighting.
 
Search WWH ::




Custom Search