Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #version 330
- uniform mat4 transformationMatrix;
- uniform mat4 projectionMatrix;
- uniform mat4 viewMatrix;
- layout(location = 0) in vec3 position;
- layout(location = 1) in vec2 textureCoordinates;
- out vec3 colour;
- out vec2 pass_textureCoordinates;
- void main() {
- gl_Position = projectionMatrix * viewMatrix * transformationMatrix * vec4(position,1.0);
- pass_textureCoordinates = textureCoordinates;
- }
- #version 330
- uniform sampler2D modelTexture;
- in vec3 colour;
- in vec2 pass_textureCoordinates;
- //use your own output instead of gl_FragColor
- out vec4 out_Color;
- void main() {
- out_Color = texture(modelTexture,pass_textureCoordinates);
- }
- #version 330 compatibility
- attribute vec3 aVertexTangent;
- varying vec3 vvLocalSurfaceNormal ;
- varying vec3 vvLocalSurfaceToLightDirection;
- void main()
- {
- vec3 vLightModelPosition = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz;
- vvLocalSurfaceToLightDirection = normalize(vLightModelPosition – gl_Vertex.xyz);
- vvLocalSurfaceNormal = normalize(gl_Normal);
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- }
- #version 330 compatibility
- varying vec3 vvLocalSurfaceNormal;
- varying vec3 vvLocalSurfaceToLightDirection;
- void main()
- {
- vec3 vNormalisedLocalSurfaceNormal = normalize(vvLocalSurfaceNormal);
- vec3 vNormalisedLocalSurfaceToLightDirection = normalize(vvLocalSurfaceToLightDirection);
- float fLightIntensity = max(dot(vNormalisedLocalSurfaceToLightDirection, vNormalisedLocalSurfaceNormal), 0.0);
- vec3 rgbFragment = vec3(1.0);
- rgbFragment *= fLightIntensity;
- gl_FragColor.rgb = rgbFragment;
- gl_FragColor.a = 1.0 ; // TODO : Worry about materials which allow transparency!
- }
- gl_ModelViewMatrixInverse
Add Comment
Please, Sign In to add comment