Join Professor Bill Tomlinson for an engaging Fall 2005 course on programming for interactivity. This course covers essential topics such as graphics, animation, and object-oriented programming using Java. We will address common issues, provide resources for the first assignment, and explore key concepts including framebuffers, update loops, and exception handling. The curriculum emphasizes writing robust and extensible code, alongside practical examples. Enhance your programming skill set while enjoying a collaborative and interactive learning environment.
01 / 54Interactive Programming with Java: Fall 2005 Course Overview and Resources
1 / 17
Télécharger la présentation
Interactive Programming with Java: Fall 2005 Course Overview and Resources
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation
Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement.Téléchargez la présentation en cliquant sur ce lien.Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.
Logistics • Logins • Resources for Assignment 1 • Do you have everything you need?
Answers to Last Week’s Questions Argument ADDITIONS SERIES 1997 argument, n. Add: [2.] b.Math. and Computing. An independent variable of a function (e.g. x and y in z = f(x, y)). 1865BRANDE & COXDict. Sci., Lit., & Art I. 768 Any trigonometrical function of phi is termed an elliptic function, having the argument u and modulus k. 1879Encycl. Brit. IX. 818/1 In each case u is the independent variable or argument of the function. 1946Nature 12 Oct. 503/2 The ENIAC has three function tables.., each of which comprises an array of switches on which 6-figure values of two functions, with signs, or a 12-figure value of one function, can be set up for each of 104 values of an argument. 1974 A. V. AHO et al. Design & Anal. Computer Algorithms i. 37 After a function procedure has been defined, it can be invoked in an expression by using its name with the desired arguments. 1984Computerworld 5 Mar. 54 Use of Boolean commands to connect a segment search argument with the next argument list in the..search field list.
Answers to Last Week’s Questions • JOGL book – Asked my students. Answer: Didn’t use a book. It’s very similar to OpenGL. They used online resources, esp. those for OpenGL.
Answers to Last Week’s Questions • System.err.println - Typically this stream corresponds to display output or another output destination specified by the host environment or user. By convention, this output stream is used to display error messages or other information that should come to the immediate attention of a user even if the principal output stream, the value of the variable out, has been redirected to a file or other destination that is typically not continuously monitored. • http://java.sun.com/j2se/1.3/docs/api/java/lang/System.html#err
Reading • Lynn Stein • The rest of her online book is recommended if you’re just getting up to speed with Java and/or object-oriented programming.
Java API Specification • How to use it. • http://java.sun.com/j2se/1.5.0/docs/api/index.html • Example: java.awt.Graphics.drawOval
Exceptions • Null Pointer Exception • Objects and pointers • Happen when code tries to act on the object that a pointer is pointing to, but the pointer is not pointing to an object. • ArrayOutOfBoundsException • Happens when code asks for data from an array that is at a higher index than the size of the array. • And many more…
index.html • To change the size of the applet that appears in the browser, you may need to change the index.html file. <HTML> <HEAD> <TITLE> Simple Applet Example </TITLE> </HEAD> <BODY> <APPLET code="BasicGraphicsSystem" width=501 height=511> Your browser does not support Java, so nothing is displayed. </APPLET> </BODY> </HTML>
Writing Robust and Extensible Code • I may ask you to change something subtly and recompile it tomorrow. Will your code respond well and “do the right thing,” or is it brittle?
Testing • Writing test cases to make sure something works correctly before moving on.
Framebuffers • “The framebuffer is a part of RAM in a computer allocated to hold the graphics information for one frame or picture. This information typically consists of color values for every pixel (point that can be displayed) on the screen.” • Wikipedia • Assignment 1 is a simple simulated framebuffer.
Update loops • To move from static graphics to animated graphics, it is necessary for the code to take action repeatedly. • Assignment 1 introduces you to a simple update loop. • (Also called the main loop or main event loop.)
Time Keeping • 2 models • Real world time – based on world time such as System.currentTimeMillis(); • Virtual world time – based on virtual time such as timeCounter++; • Which model does the Assignment 1 code use?
Animation • Traditional animation principles still apply to real-time computer animation (if you want them to): • Anticipation • Follow Through • Squash & Stretch (with conservation of mass)
2D graphics – GUIs, etc. • AWT vs. Swing • “"Swing" refers to the new library of GUI controls (buttons, sliders, checkboxes, etc.) that replaces the somewhat weak and inflexible AWT controls.” • From http://www.apl.jhu.edu/~hall/java/Swing-Tutorial/
Java2D • “In Java 1.2, the paintComponent method is supplied with a Graphics2D object (a subclass of Graphics), which contains a much richer set of drawing operations. It includes pen widths, dashed lines, image and gradient color fill patterns, the use of arbitrary local fonts, a floating point coordinate system, and a number of coordinate transformation operations.” • From (http://www.apl.jhu.edu/~hall/java/Java2D-Tutorial.html)
OpenGL (or JOGL) vs. DirectX • Both vertex based graphics APIs • A range of different capabilities. • My group uses JOGL because it works on multiple operating systems.
JOGL • https://jogl.dev.java.net/ • “The JOGL Project hosts a reference implementation of the Java bindings for OpenGL API, and is designed to provide hardware-supported 3D graphics to applications written in Java. It is part of a suite of open-source technologies initiated by the Game Technology Group at Sun Microsystems.”
Static vs. Dynamic Intersection • Collision checks can be performed at discrete time steps, simple & efficient but can cause problems if steps are not much smaller than velocities (penetration, innacurate collision directions, and completely missing collisons, etc.) • Dynamic checks take into current trajectory of objects. More complex to check but can solve above problems
Autonomous Cinematography • In a virtual world, who decides where the camera goes? • Some of the same problems as film cinematography – expressiveness, appearance of continuity, etc. • Some additional problems – interactivity, continuity of time (esp. when networked)
camPos & lookAt • Where the camera is and where it is looking • Requires linear algebra (vectors, dot products, etc.) • Camera updates like a character