My notes on the OpenGL ES hello world triangle

My notes on the OpenGL ES hello world triangle




Table of contents

  1. What is this blog post?
  2. What is open gl es?
  3. What is a vertex?
  4. What is a vertex shader?
  5. What is a fragment?
  6. What is a fragment shader?
  7. Shader and Program objects



Resources



My app on the Google play store



What is this blog post?



What is open gl es?

  • As it open gl es is just a wrapper around open gl to make it more efficient for mobile/memory limited devices



What is a vertex?

const GLfloat triangleVertices[] = {
        0.0f, 1.0f,   //x,y
        -1.0f, -1.0f, // x,y
        1.0f, -1.0f   // x,y
};

Enter fullscreen mode

Exit fullscreen mode

  • Each of the x,y cordinates represent a vertex. So 0.0f, 1.0f is one vertex and so on



What is a vertex shader?

  • Documentation
  • programmable method for operating on vertices.
  • Below is just copy and pasted form the documentation
  • Vertex shaders are the most established and common kind of 3D shader and are run once for each vertex given to the graphics processor. The purpose is to transform each vertex’s 3D position in virtual space to the 2D coordinate at which it appears on the screen (as well as a depth value for the Z-buffer). Vertex shaders can manipulate properties such as position, color and texture coordinates, but cannot create new vertices. The output of the vertex shader goes to the next stage in the pipeline, which is either a geometry shader if present, or the rasterizer. Vertex shaders can enable powerful control over the details of position, movement, lighting, and color in any scene involving 3D models.



What is a fragment?

  • Graphics pipeline documentation
  • In the graphics pipeline there is a non-programmable(we can not touch it) step called Rasterization. Which turns our vertex data into points on the screen. Which it does by creating fragments, which is all the data necessary to generate a single pixel’s worth of a drawing.



What is a fragment shader?

  • fragment shader documentation
  • The fragment shaders give us a programmable method to take the previously mentioned fragment data and alter the fragment data
  • The fragment shaders provides a general-purpose programmable method for operating on fragments.



Shaders and Programs



Conclusion

  • Thank you for taking the time out of your day to read this blog post of mine. If you have any questions or concerns please comment below or reach out to me on Twitter.





Source link
lol

By stp2y

Leave a Reply

Your email address will not be published. Required fields are marked *

No widgets found. Go to Widget page and add the widget in Offcanvas Sidebar Widget Area.