#version 410 core // Pseudocode for incorporating texture mapping into // a Phong lighting model // Per-vertex attributes from vertex shader in PVA { vec3 ecPosition; // position in eye coordinates vec3 ecNormal; // normal vector in eye coordinates vec2 texCoords; } pvaIn; uniform sampler2D textureMap; // You will also likely need a couple other uniforms as // discussed in class... // Output: out vec4 fragColor; // ... vec4 composeColor(vec4 lmColor, vec4 tColor) { // What color arithmetic do we want to perform? // Most common is to multiply the two together since this // simulates the lighting model acting on the texture color. // But you can always explore other options... vec4 combinedColor = the result of that color arithmetic return combinedColor; } void main (void) { vec4 lightModelColor = computePhongModel(); if using a texture map vec4 textureColor = texture(textureMap, pvaIn.texCoords); fragColor = composeColor(lightModelColor, textureColor); else fragColor = lightModelColor; }