@ -100,8 +100,8 @@ The preferred workflow is to specify attribute location for vertex shader
input attributes and fragment shader output attributes explicitly in the
input attributes and fragment shader output attributes explicitly in the
shader code , e . g . :
shader code , e . g . :
@ code
@ code
# version 330
// GLSL 3.30, or
// or #extension GL_ARB_explicit_attrib_location: enable
# extension GL_ARB_explicit_attrib_location: enable
layout ( location = 0 ) in vec4 position ;
layout ( location = 0 ) in vec4 position ;
layout ( location = 1 ) in vec3 normal ;
layout ( location = 1 ) in vec3 normal ;
layout ( location = 2 ) in vec2 textureCoordinates ;
layout ( location = 2 ) in vec2 textureCoordinates ;
@ -147,8 +147,8 @@ bindFragmentDataLocationIndexed(1, 1, "ambient");
The preferred workflow is to specify uniform locations directly in the shader
The preferred workflow is to specify uniform locations directly in the shader
code , e . g . :
code , e . g . :
@ code
@ code
# version 430
// GLSL 4.30, or
// or # extension GL_ARB_explicit_uniform_location: enable
# extension GL_ARB_explicit_uniform_location: enable
layout ( location = 0 ) uniform mat4 transformation ;
layout ( location = 0 ) uniform mat4 transformation ;
layout ( location = 1 ) uniform mat4 projection ;
layout ( location = 1 ) uniform mat4 projection ;
@ endcode
@ endcode
@ -168,8 +168,8 @@ GLint projectionUniform = uniformLocation("projection");
The preferred workflow is to specify texture layers directly in the shader
The preferred workflow is to specify texture layers directly in the shader
code , e . g . :
code , e . g . :
@ code
@ code
# version 420
// GLSL 4.20, or
// or #extension GL_ARB_shading_language_420pack: enable
# extension GL_ARB_shading_language_420pack: enable
layout ( binding = 0 ) uniform sampler2D diffuseTexture ;
layout ( binding = 0 ) uniform sampler2D diffuseTexture ;
layout ( binding = 1 ) uniform sampler2D specularTexture ;
layout ( binding = 1 ) uniform sampler2D specularTexture ;
@ endcode
@ endcode
@ -181,7 +181,6 @@ layout(binding = 1) uniform sampler2D specularTexture;
If you don ' t have the required extension ( or if you want to change the layer
If you don ' t have the required extension ( or if you want to change the layer
later ) , you can set the texture layer uniform using setUniform ( GLint , GLint ) :
later ) , you can set the texture layer uniform using setUniform ( GLint , GLint ) :
@ code
@ code
use ( ) ;
setUniform ( DiffuseTextureUniform , DiffuseTextureLayer ) ;
setUniform ( DiffuseTextureUniform , DiffuseTextureLayer ) ;
setUniform ( SpecularTextureUniform , SpecularTextureLayer ) ;
setUniform ( SpecularTextureUniform , SpecularTextureLayer ) ;
@ endcode
@ endcode