CubeRenderer

class CubeRenderer(val context: Context, var onSurfaceChangedListener: CubeTextureView.OnSurfaceChangedListener? = null) : GLSurfaceView.Renderer

Renderer class in charge of rendering a cube.

Constructors

Link copied to clipboard
constructor(context: Context, onSurfaceChangedListener: CubeTextureView.OnSurfaceChangedListener? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
var camera: PinholeCamera?

Gets or sets camera defining point of view to draw the scene. This camera does not take into account Android view coordinates, in Layman terms this means that y coordinates increase upwards.

Link copied to clipboard
var cameraCenter: Point3D?

Gets or sets camera center position.

Link copied to clipboard
var cameraIntrinsicParameters: PinholeCameraIntrinsicParameters?

Gets or sets camera intrinsic parameters.

Link copied to clipboard
var cameraRotation: Rotation3D?

Gets or sets camera rotation.

Link copied to clipboard

Color to clear the scene.

Link copied to clipboard

context.

Link copied to clipboard
var cubePosition: Point3D

Cube position.

Link copied to clipboard
var cubeRotation: Rotation3D

Cube rotation.

Link copied to clipboard

Cube size.

Link copied to clipboard

Diffuse color to be used for lighting purposes. This is only taken into account if normals are used.

Link copied to clipboard

Far plane value. Any vertex further from the camera than this value is ignored and not drawn.

Link copied to clipboard
val height: Int?

Height of the scene expressed in pixels. Notice that OpenGL uses normalized coordinates between -1.0f and 1.0f, but this field contains the actual view height expressed in pixels. This value is only available once the surface to draw has been created.

Link copied to clipboard

Near plane value. Any vertex nearer to the camera than this value is ignored and not drawn.

Link copied to clipboard

listener to notify when surface has changed.

Link copied to clipboard
var orientation: CameraToDisplayOrientation

Gets or sets orientation to compute a pinhole camera expressed in view coordinates. If orientation is unknown, view camera is not used.

Link copied to clipboard
var viewCamera: PinholeCamera?

Gets or sets camera that defines point of view to draw the scene expressed in Android view coordinates. This is only available or can only be set if surface is initialized and orientation is defined (not unknown).

Link copied to clipboard
var viewCameraCenter: Point3D?

Gets or sets view camera center position.

Link copied to clipboard
var viewCameraIntrinsicParameters: PinholeCameraIntrinsicParameters?

Gets or sets view camera intrinsic parameters.

Link copied to clipboard
var viewCameraRotation: Rotation3D?

Gets or sets view camera rotation.

Link copied to clipboard
val width: Int?

Width of the scene expressed in pixels. Notice that OpenGL uses normalized coordinates between -1.0f and 1.0f, but this field contains the actual view width expressed in pixels. This value is only available once the surface to draw has been created.

Functions

Link copied to clipboard
fun destroy()

Destroys OpenGL context only if it has not already been destroyed.

Link copied to clipboard
open override fun onDrawFrame(gl: GL10?)

Called when a frame needs to be drawn into the surface. Sets camera and draws the cube.

Link copied to clipboard
open override fun onSurfaceChanged(gl: GL10?, width: Int, height: Int)

Called when size of surface where drawing occurs changes.

Link copied to clipboard
open override fun onSurfaceCreated(gl: GL10?, config: EGLConfig?)

Called when surface where drawing occurs has been created in order to initialize OpenGL.

Link copied to clipboard
fun setNearFarPlanes(nearPlane: Float, farPlane: Float)

Sets near and far plane values. Any vertex nearer to the camera than the near plane, or any vertex further from the camera than the far plane is ignored and not drawn.

Link copied to clipboard
fun setValues(nearPlane: Float, farPlane: Float, camera: PinholeCamera)

Sets all required values to compute the scene camera matrices.