Modify Program 9.3 so that the object in the scene blends environment mapping with a texture. Use

Question:

Modify Program 9.3 so that the object in the scene blends environment mapping with a texture. Use a weighted sum in the fragment shader, as described in Chapter 7.

Program 9.3public void display(GLAuto Drawable drawable) { // the code for drawing the cube map is unchanged. // the// build the MODEL-VIEW matrix, as before mvMat.identity(); mvMat.mul(vMat); mvMat.mul (mMat);} BUFFER_BIT); // drawing the torus is otherwise unchanged gl.glClear(GL_DEPTH gl.glEnable(GL_CULL_FACE);Vertex shader #version 430 layout (location = 0) in vec3 position; layout (location = 1) in vec3 normal; outvoid main(void) { varyingVertPos } = (mv_matrix * vec4(position, 1.0)).xyz; varying Normal = (norm_matrix *Fragment shader #version 430 in vec3 varyingNormal; in vec3 varyingVertPos; out vec4 fragColor; uniform mat4

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Computer Graphics Programming In OpenGL With JAVA

ISBN: 9781683922193

2nd Edition

Authors: V. Scott Gordon PhD, John L. Clevenger PhD

Question Posted: