CS116b/CS216
Chris Pollett
Feb 3, 2014
Which of the following statements is true?
glClearColor(128./255, 200./255, 255./255, 0.); glClearDepth(0.); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_GREATER); glReadBuffer(GL_BACK); //start out using back buffer
#version 330 uniform vec3 uLight; in vec3 vColor; in vec3 vNormal; in vec4 vPosition; out fragColor; void main() { vec3 toLight = uLight - vec3(vPosition); vec3 toV = -normalize(vec3(vPosition)); toLight = normalize(toLight); vec3 h = normalize(toV + toLight); vec3 normal = normalize(vNormal); float specular = pow(max(0.0, dot(h, normal)), 64.0); float diffuse = max(0.0, dot(normal, toLight)); vec3 intensity = vec3(0.1, 0.1, 0.1) + vColor * diffuse + vec3(0.6, 0.6, 0.6) *specular; fragColor = vec4(intensity.x, intensity.y, intensity.z, 1.0); }
#version 330 uniform mat4 uProjMatrix; uniform mat4 uModelViewMatrix; in vec2 aTexCoord; in vec4 aVertex; out vec2 vTexCoord; void main(void) { vTexCoord = aTexCoord; gl_Position = uProjMatrix * uModelViewMatrix * aVertex; }
#version 330 uniform sampler2d uTexUnit0; in vec2 vTexCoord; out fragColor; void main(void) { vec4 texColor0 = texture2D(uTexUnit0, vTexCoord); fragColor = texColor0; }