Table of contents
- What is this blog post?
- What is open gl es?
- What is a vertex?
- What is a vertex shader?
- What is a fragment?
- What is a fragment shader?
- 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 aroundopen gl
to make it more efficient for mobile/memory limited devices
What is a vertex?
- A vertex is nothing more than a coordinate in a 2d or 3d space. So each point on a tringle is considered to be a vertex
- In the open gl es triangle tutorial we create the vertices for the triangle in this array:
const GLfloat triangleVertices[] = {
0.0f, 1.0f, //x,y
-1.0f, -1.0f, // x,y
1.0f, -1.0f // x,y
};
- Each of the
x,y
cordinates represent a vertex. So0.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 creatingfragments
, 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