This variable defines the position that is passed through to the next stage in the pipeline. Every vertex shader must output a position into the gl_Position variable. The body of the shader is very simple it copies the vPosition input attribute into a special output variable named gl_Position. The shader declares a main function that marks the beginning of execution of the shader. Later on, the Draw function in Hello Triangle will send in positions for each vertex that will be placed in this variable. This shader declares one input attribute that is a four-component vector named vPosition. The vertex shader that is given in the program is very simple: GLbyte vShaderStr = The biggest task that the Init function in Hello Triangle accomplishes is the loading of a vertex and fragment shader. To do any rendering at all, an OpenGL ES 2.0 program must have both a vertex and fragment shader. These two shader programs describe the transformation of vertices and drawing of fragments. There you learned about the concepts of a vertex and fragment shader. In Chapter 1, “Introduction to OpenGL ES 2.0,” we covered the basics of the OpenGL ES 2.0 programmable pipeline. In OpenGL ES 2.0, nothing can be drawn unless a valid vertex and fragment shader have been loaded. Learn More Buy Creating a Simple Vertex and Fragment Shader
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |