Question: Modify Program 8.1 so that the light can be positioned by moving the mouse, similar to Exercise 7.1. You will probably notice that some lighting
Modify Program 8.1 so that the light can be positioned by moving the mouse, similar to Exercise 7.1. You will probably notice that some lighting positions exhibit shadow artifacts, while others look fine.
Program 8.1
![private float[] lightAmbient = new float[] { 0.0f, 0.0f, 0.0f, 1.0f }; private float[] lightDiffuse = new](https://dsd5zvtm8ll6.cloudfront.net/images/question_images/1701/6/7/4/089656d7c69bf7501701674089126.jpg)
![// shadow-related variables private int screen SizeX, screenSize Y; private int [] shadow Tex = new int [1];](https://dsd5zvtm8ll6.cloudfront.net/images/question_images/1701/6/7/4/109656d7c7db381c1701674109057.jpg)


![gl.glBind Texture(GL_TEXTURE_2D, shadow Tex[0]); gl.glTexlmage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32,](https://dsd5zvtm8ll6.cloudfront.net/images/question_images/1701/6/7/4/163656d7cb34535e1701674162572.jpg)









// Much is the same as we have seen before. New sections to support shadows are highlighted. // The imports necessary for lighting, etc., would be included at the start, are the same as before, // and are not shown here. public class Code extends JFrame implements GLEventListener { // variable declarations for rendering programs, buffers, shader sources, etc., would go here. private ImportedModel pyramid = new Imported Model("pyr.obj");// define the pyramid private Torus my Torus = new Torus (0.6f, 0.4f, 48); // define the torus private int numPyramidVertices, num Torus Vertices, num TorusIndices; // locations of torus, pyramid, camera, and light private Vector3f torusLoc = new Vector3f(1.6, 0.0, -0.3); private Vector3f pyrLoc = new Vector3f(-1.0, 0.1, 0.3); private Vector3f cameraLoc = new Vector3f(0.0, 0.2, 6.0); private Vector3f lightLoc = new Vector3f(-3.8f, 2.2f, 1.1f); //properties of white light (global and positional) used in this scene private float[] globalAmbient = new float[] { 0.7f, 0.7f, 0.7f, 1.0f};
Step by Step Solution
3.30 Rating (162 Votes )
There are 3 Steps involved in it
Nurse Staffing Optimization Model Objective To minimize the total number of nurses req... View full answer
Get step-by-step solutions from verified subject matter experts
