![]() The clear color should be set by the application prior to calling glClear on the color buffer. In the example program at the end of Init, the clear color was set to (0.0, 0.0, 0.0, 1.0) so the screen is cleared to black. The buffer will be cleared to the color specified with glClearColor. At the beginning of each frame, we clear the color buffer using the glClear function. We cover these buffers in more detail in Chapter 11, “Fragment Operations.” In the Hello Triangle example, only the color buffer is drawn to. In OpenGL ES, there are multiple types of buffers that are involved in drawing: color, depth, and stencil. We cover glViewport in more detail in Chapter 7, “Primitive Assembly and Rasterization,” when we discuss coordinate systems and clipping.Īfter setting the viewport, the next step is to clear the screen. The viewport is defined by an origin ( x, y) and a width and height. GlViewport(0, 0, esContext->width, esContext->height) In OpenGL ES, the viewport defines the 2D rectangle in which all OpenGL ES rendering operations will ultimately be displayed. The first command that we execute in Draw is glViewport, which informs OpenGL ES of the origin, width, and height of the 2D rendering surface that will be drawn to. The Draw callback function draws the frame. ![]() Now that we have created a rendering surface with EGL and initialized and loaded shaders, we are ready to actually draw something. Learn More Buy Setting the Viewport and Clearing the Color Buffer
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |