Skip to content

Object Class

Nolan Burfield edited this page Aug 4, 2016 · 3 revisions

Functions

Object()

Add a list of vertices and indices statically into object. The indices are indexed at 0 so lazy method is do a quick loop. The two arrays need to be pushed into buffers.

~Object()

Clear the list of vertices and indices.

void Update(unsigned int dt)

Updates the angle and will rotate the model accordingly with some help from GLM.

void Render()

The shader code (look in shader.cpp) expects vertex data at location 0 and colors at location 1. These locations must be enabled and disabled at the end. These two locations will then receive the data which was stored in the vertex object. The vertex and index buffers must be bound. The draw call must be made.

glm::mat4 GetModel()

Returns the model of the object.

Variables

glm::mat4 model

The model matrix of 4x4 that represents the object in space.

std::vector Vertices

The buffer of each vertex in the object.

std::vector Indices

The buffer to hold Indices of the cube. All objects are made up of vertices and this list is what connection each vertex has in order to form a triangle.

GLuint VB

The value that will point to the list of vertices in the GPU.

GLuint IB

The value that will point to the list of indices in the GPU.

float angle

Used to rotate the cube throughout time.

Notes

The statics vertices and indices are changed when writing a model loader.

Clone this wiki locally