Question: Modify Program 2.5 so that the vertex shader includes one of the buildRotate() functions from Program 3.1 and applies it to the points comprising the

Modify Program 2.5 so that the vertex shader includes one of the buildRotate() functions from Program 3.1 and applies it to the points comprising the triangle. This should cause the triangle to be rotated from its original orientation. You don’t need to animate the rotation.

Program 2.5Vertex Shader #version 430 void main(void) { if (gl_VertexID == 0) gl_Position = vec4( 0.25, -0.25, 0.0,

Program 3.1// builds and returns a translation matrix mat4 build Translate(float x, float y, float z) { mat4 trans =// builds and returns a matrix that performs a rotation around the Y axis mat4 build RotateY(float rad) {// builds and returns a scale matrix mat4 buildScale(float x,float y, float z) { mat4 scale = mat4(x, 0.0,

Vertex Shader #version 430 void main(void) { if (gl_VertexID == 0) gl_Position = vec4( 0.25, -0.25, 0.0, 1.0); else if (gl_VertexID == 1) gl_Position vec4(-0.25, -0.25, 0.0, 1.0); else gl_Position = vec4(0.25, 0.25, 0.0, 1.0); = } Java/JOGL application - in display() gl.glDrawArrays(GL_TRIANGLES, 0, 3);

Step by Step Solution

3.39 Rating (158 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To modify the vertex shader from Program 25 to include a rotation using the buildRotateZ function fr... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Computer Graphics Programming Questions!