Learning lots on here, just have a question about shaders as I am currently learning more about them.
I have a book called “Graphics Shaders: Theory and Practice” which is explaining alot about the graphic pipeline system and how to implement different shaders.
I have one issue though - I have been coming across different custom object such as “globalColor” which is created by OF to allow GLSL to have access to the color that is set in our ofColor application through the globalColor variable.
Where can I learn more about these unique to OF objects that are throwing me a little when learning shaders?
there’s really not much documentation about that but the uniforms created by OF are:
uniform mat4 modelViewMatrix;
uniform mat4 viewMatrix;
uniform mat4 projectionMatrix;
uniform mat4 modelViewProjectionMatrix;
uniform vec4 globalColor;
and the attributes defined by default by OF:
in vec3 position;
in vec3 normal;
in vec2 texcoord;
in vec4 color;
i think the meanings are self explanatory from the names but ask if you need any further explanations
thank you very much for this - i was very confused by this when trying to learn openGL
Just one quick question about this
when creating a shader - what is the [in vec2 texcoord]?
From my experience that would be the texture coordinates for using with a sampler2D texture. If you bind a (one!) texture it’s automatically available as tex0 in the shader - if you have more than one then you need to use setUniformTexture();
Take a look at: