Our First OpenGL Rendering

With all that setup and data initialization, rendering (for the moment) will be very simple. While our display() routine is only four lines long, its sequence of operations is virtually the same in all OpenGL applications. Here it is once again.

void display(void){    glClear(GL_COLOR_BUFFER_BIT);    glBindVertexArray(VAOs[Triangles]);    glDrawArrays(GL_TRIANGLES, 0, NumVertices);    glFlush();}

First, we begin rendering by clearing our framebuffer. This is done by calling glClear().

Table 1.3. Clearing ...

Get OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 4.3, Eighth Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.