With the final connections in place, we’re now ready to start drawing to the screen! We’ll draw the table first, and then we’ll draw the dividing line and the mallets.
Let’s add the following code after the call to glClear, at the end of onDrawFrame:
glUniform4f(uColorLocation, 1.0f, 1.0f, 1.0f, 1.0f);
glDrawArrays(GL_TRIANGLES, 0, 6);
First we update the value of u_Color in our shader code by calling glUniform4f. Unlike attributes, uniforms don’t have default components, so if a uniform is defined as a vec4 in our shader, we need to provide all four components. We want to start out by drawing a white table, so we set red, green, and blue to 1.0f ...