Modify Program 7.1 so that the light can be positioned by moving the mouse. After doing this,
Question:
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 shading artifacts. You may find it convenient to render a point (or small object) at the location of the light source.
Program 7.1
Transcribed Image Text:
public class Code extends JFrame implements GLEventListener { private GLCanvas myCanvas; // declarations for building shaders and rendering program, as before. // declaration of one VAO, two VBOS, Torus object, and Torus and camera location as before. // Utils.java class now has gold, silver, and bronze material accessors added. // allocate variables for display() function private FloatBuffer vals = Buffers.newDirectFloatBuffer(16); private Matrix4f pMat = new Matrix4f(); private Matrix4f vMat = new Matrix4f(); private Matrix4f mMat = new Matrix4f(); private Matrix4f invTrMat = new Matrix4f(); // perspective matrix // view matrix // model matrix // inverse-transpose matrix for converting normals private int mLoc, vLoc, pLoc, nLoc; private int globalAmbLoc, ambLoc, diffLoc, specLoc, posLoc, mAmbLoc, mDiffLoc, mSpecLoc, mShiLoc; // locations of shader uniform variables
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 100% (2 reviews)
Answered By
Michael Owens
I am a competent Software Engineer with sufficient experience in web applications development using the following programming languages:-
HTML5, CSS3, PHP, JAVASCRIPT, TYPESCRIPT AND SQL.
5.00+
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
-
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...
-
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...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Find the derivative of the function. y = e x-4
-
Find the Hilbert transforms x i [n] = Hx r [n]} of the following sequences: (a) x r [n] = cos 0 n (b) x r [n] = sin 0 n (c) x r [n] = sin( c n)/n
-
The coefficients of static and kinetic friction between the drum and brake bar are ? s? = 0.4 and ? k? = 0.3, respectively. If M = 50N ? m and P = 85 N determine the horizontal and vertical...
-
1 Despus de escuchar una presentacin de ventas reciente, Mary Smith se inscribi como socia del club deportivo local. Al llegar a las instalaciones, se enter de que haba que pagar una cuota adicional...
-
Determining the Effects of Credit Sales, Sales Discounts, Credit Card Sales, and Sales Returns and Allowances on Income Statement Categories Brazen Shoe Company records Sales Returns and Allowances,...
-
Excerpts from Starbucks Corporations tax note from the companys Form 10-K for the year ended September 27, 2015, follow. page 793 Sep. 27, 2015 Sep. 28, 2014 Deferred tax assets: Property, plant and...
-
Learn the basics of how to use Blender to create a 3D object of your own. To make full use of Blender with your OpenGL applications, youll want to learn how to use Blenders UV-unwrapping tools to...
-
In Figure 16.28 (the center image), the Sugita/Takehashi blending of red and green produces black. Is this a reasonable result? If not, can you devise a workaround that doesnt compromise other color...
-
Ann Moore receives a $1,000 monthly payment from her former husband Bill. How much of the $12,000 annual receipt is included in Anns AGI under each of the following assumptions? a. The monthly...
-
14. (3 points) Using our model of the egg and vinegar (part one), what is the causal account in this model? Refer to your model and work through the components and relationships that cause this...
-
D. Rewrite the following statements from an "I Approach" to a "You Approach". (5 marks) 1. We have not received your signed invoice so we cannot process payment. 2. I need to know what type of model...
-
AP Precalculus Unit 1 Study Guide: Polynomials Name: Date: 19. The graph of an ODD function is given for the interval -6x0. Use the properties of odd functions to sketch the graph of the function on...
-
Step 1 of 5: Determine the lower class boundary for the second class. Scores on a Test Class Frequency 30-47 11 48-65 14 66-83 11 84-101 9 102-119 12
-
Write a 1,500-2,000-word evaluation paper using the following instructions to complete this assignment. Go to the FBI Uniform Crime Reporting Program website (See link in the Class Resources). Search...
-
Sue is 30 years old and is president and a 51% shareholder of C Corporation. She informs you that C Corporation has 10 shareholders, all unrelated. Other than herself, no shareholder owns more than...
-
Graph the following conic sections, labeling vertices, foci, directrices, and asymptotes (if they exist). Give the eccentricity of the curve. Use a graphing utility to check your work. 10 5 + 2 cos 0
-
Define the functions of marketing in your own words. Using an example, explain how they can be shifted and shared.
-
Online computer shopping at websites makes it possible for individual consumers to get direct information from hundreds of companies they would not otherwise know about. Co n sumers can place an...
-
Explain why a small producer might want a marketing research firm to take over some of its informationgathering activities.
-
A family has a $117,443, 25-year mortgage at 5.4% compounded monthly. (A) Find the monthly payment and the total interest paid. (B) Suppose the family decides to add an extra $100 to its mortgage...
-
Comparing the actual and planned cost of a consulting engagement completed by an engineering firm such as Allied Engineering.
-
What is the NPV of a project that costs $34,000 today and is expected to generate annual cash inflows of $11,000 for the next 7 years, followed by a final inflow of $14,000 in year 8. Cost of capital...
Study smarter with the SolutionInn App