Modify Program 8.1 so that the light can be positioned by moving the mouse, similar to Exercise
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 positions exhibit shadow artifacts, while others look fine.
Program 8.1
Transcribed Image Text:
// 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};
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 50% (2 reviews)
Answered By
Branice Buyengo Ajevi
I have been teaching for the last 5 years which has strengthened my interaction with students of different level.
4.30+
1+ Reviews
10+ Question Solved
Related Book For
Computer Graphics Programming In OpenGL With JAVA
ISBN: 9781683922193
2nd Edition
Authors: V. Scott Gordon PhD, John L. Clevenger PhD
Question Posted:
Students also viewed these Computer science questions
-
Modify Program 7.1 so that the light can be positioned by moving the mouse. After doing this, move the mouse around and note the movement of the specular highlight and the appearance of the Gouraud...
-
Repeat Exercise 7.1, but applied to Program 7.2. This should only require substituting the shaders for Phong shading into your solution to Exercise 7.1. The improvement from Gouraud to Phong shading...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
Find the slopes of the curves at the given points. Sketch the curves along with their tangents at these points. r = sin 2; = /4, 3/4
-
Figure shows the spectrogram of a chirp signal of the form? x[n] = sin (? 0 n + 1/2?n 2 ). Note that the spectrogram is a representation of the magnitude of X[n, k], as defined in Eq. (??), where the...
-
Johns Boat Yard, Inc., repairs, stores, and cleans boats for customers. It is completing the accounting process for the year just ended, November 30, 2015. The transactions for the past year have...
-
XYZ University is a medium-sized tertiary education provider in the state of Queensland, Australia. In undertaking its normal business of teaching, learning, and research, the university collects,...
-
Polly, Molly, and Dolly are all single mothers. They each can earn $10 per hour working for up to 2,000 hours per year. Their government runs a welfare system that gives income benefits of $5,000 per...
-
Lily Corporation has 100,000 shares of $40 par value preferred stock authorized. During the year, it had the following transactions related to its preferred stock. (a) Issued 25,000 shares at $60 per...
-
Modify Program 2.6 so that it calculates the amount of movement for the triangle based on elapsed time, rather than a constant amount as it is currently implemented. One approach for this is to get...
-
Modify Program 2.5 to include the error-checking modules shown in Program 2.3. After you have that working, try inserting various errors into the shaders and observing both the resulting behavior and...
-
The first ionization energies of iron, cobalt, nickel, and the first three platinum metals are all about the same, but the first ionization energies of osmium, iridium, and platinum are substantially...
-
What does following command do? date> date.out date >> date.out date >> date.out Error O Shows today's date 3 times O Shows today's date once O Writes the word date 3 times
-
Identify and explain a problem with this code: double x, y; cout < < "Enter two numbers: "; cin >>x>> y; if(x+y == 2.4) { } cout < < "Their sum is 2.4" < < endl;
-
1. For the circuits on the right, please find I1, I2, VA, and VB. 12V 12V 5A(1 VA 'I 22 I2 122 252 5A Vs 252
-
Look at the following code snippet: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. int numl; int num2; cout < < "Please enter two numbers: "; cin >> num1 >> num2; int result - num182; int...
-
What is the magnitude of A + B + C, where A = 4.60 + -3.30 + 5.10 %, B = 3.90 +3.00 + -4.60% and i = -3.70 +4.50 i ?
-
Sophia Gourmet has the following comparative balance sheet data. Additional information for 2008: 1. Net income was $25,000. 2. Sales on account were $420,000. Sales returns and allowances were...
-
Without solving, determine the character of the solutions of each equation in the complex number system. 3x 2 3x + 4 = 0
-
How do you think a furniture manufacturers buying habits and practices would be affected by the specific type of product to be purchased? Consider fabric for upholstered furniture, a lathe for the...
-
Discuss the importance of target marketing when analyzing organizational markets. How easy is it to isolate homogeneous market segments in these markets?
-
Explain how NAICS codes might be helpful in evaluating and understanding business ma r kets. Give an example.
-
In what ways can we leverage collective expertise and skills to enhance team cohesion and productivity?
-
What role does emotional intelligence play in cultivating a cohesive and high-performing team environment ? Explain
-
Gator Shoes, Incorporated, manufactures a line of stylish waterproof footwear. The following transactions relate to investments in common stock during 2024. March 1 Purchases 2,200 shares (10%) of...
Study smarter with the SolutionInn App