May 2019
Intermediate to advanced
542 pages
13h 37m
English
We're going to compose a simple GLSL vertex shader that we can use for our demo; create a file called vertex_shader.glsl, and copy in the following code:
#version 120
We've begun with a comment indicating the version of GLSL we are using. This is important, as each version of OpenGL is only compatible with a particular version of GLSL, and the GLSL compiler will use this comment to check whether we've mismatched those versions.
A chart showing compatibility between versions of GLSL and OpenGL can be found at https://www.khronos.org/opengl/wiki/Core_Language_(GLSL).
Next, we will need to make some variable declarations:
attribute highp vec4 vertex;uniform highp mat4 matrix;attribute lowp vec4 color_attr;varying lowp ...
Read now
Unlock full access