Step 8 initTriangle()
Define function initTriangle()
In main.cpp, define a function initTriangle(), define the triangle:
void initTriangle()
{
}Add trangle data
Inside the function, adding
GLfloat verts[] = {
-1.0f, -1.0f,
1.0f, -1.0f,
0.0f, 1.0f,
};Create the vertex buffer
inside initTriangle(), adding code to create the buffer for holding the triangle vertex
Set vertex attributes
Set the buffer data to triangle vertex
Specify that each vetex has two coordinate components
Last updated