O'Reilly logo

OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 4.3, Eighth Edition by Bill M. Licea-Kane, John M. Kessenich, Graham Sellers, Dave Shreiner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required