Managed to get the view “cone” to appear (did not look as expected but that’s my a problem with my math) but the grid which was previously visible disappeared, someone mind helping me understand the flow of overlaying?
init_grid( 0, 0, 0, pangle );
do
{
unsigned int VBO = -1, VAO = -1, VIEWAO = -1;
float currentFrame = glfwGetTime();
deltaTime = currentFrame - lastFrame;
lastFrame = currentFrame;
// Clear the screen
glClearColor( 0, 0, 0, 0 );
glClear( GL_COLOR_BUFFER_BIT );
// Draw Stuff
init_grid( 0, grid[0][0], grid[0][1], pangle );
glGenBuffers( 1, &VBO );
glBindBuffer( GL_ARRAY_BUFFER, VBO );
glGenVertexArrays( 1, &VAO );
glGenVertexArrays( 1, &VIEWAO );
glBindVertexArray( VAO );
glBufferData( GL_ARRAY_BUFFER, sizeof(grid), grid, GL_STATIC_DRAW );
glVertexAttribPointer( 0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0 );
glEnableVertexAttribArray( 0 );
glBindVertexArray( VIEWAO );
glBufferData( GL_ARRAY_BUFFER, sizeof(view), view, GL_STATIC_DRAW );
glVertexAttribPointer( 0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0 );
glEnableVertexAttribArray( 0 );
glUseProgram( point_program );
glBindVertexArray( VAO );
glDrawArrays( GL_POINTS, 0, POINTS );
glBindVertexArray( VIEWAO );
glDrawArrays( GL_TRIANGLES, 0, POINTS );
// Swap buffers
glfwSwapBuffers(window);
glfwPollEvents();
}
while ( glfwWindowShouldClose(window) == 0 );
Here’s a screenshot: