Presentation is loading. Please wait.

Presentation is loading. Please wait.

IAT 265 Multimedia Programming for Art and Design ______________________________________________________________________________________ SCHOOL OF INTERACTIVE.

Similar presentations


Presentation on theme: "IAT 265 Multimedia Programming for Art and Design ______________________________________________________________________________________ SCHOOL OF INTERACTIVE."— Presentation transcript:

1 IAT 265 Multimedia Programming for Art and Design ______________________________________________________________________________________ SCHOOL OF INTERACTIVE ARTS + TECHNOLOGY [SIAT] | WWW.SIAT.SFU.CA

2 May 10, 2016IAT 2652 Overview  Go over the syllabus  Brief introduction to me and my work  Art, programming and Java

3 May 10, 2016IAT 2653 Background  Ph.D. in Computing Science  Research –Visual Analytics –Virtual Environments –Health Informatics –Two-Handed 3D Interfaces for 3D Free-Form Surface Design Scientific visualization Information visualization –Bioinformatics Visualization  Teaching –Videogame Design & Programming, VA

4 May 10, 2016IAT 2654 3D CAD: Twister

5 May 10, 2016IAT 2655 3. CAD: Gallery

6 TA  Ankit Gupta –PhD student in SIAT –Visual Analytics and Health Informatics expert –He doesn’t always wear a tie May 10, 2016IAT 2656

7 Myths about 265  Survey said…  Too much of the same stuff as CMPT 166 and IAT 167 –Fixed! We address this throughout the term by getting to the new stuff more quickly May 10, 2016IAT 2657

8 Myths about 265  Useless for my awesome design/media career –True! in 1992!  What is the primary medium of information delivery today? –The internet is fundamentally a medium is implemented, controlled, delivered by computer programs –Who do you want in control of that? You or some Computer Science geek who doesn’t know Jack? May 10, 2016IAT 2658

9 Myths about 265  Nobody wants programming  Take a look at these 309W Portfolios May 10, 2016IAT 2659

10 Cassie deGit – Tutoring System May 10, 2016IAT 26510

11 Carlo Misajon- TableTop Game May 10, 2016IAT 26511

12 Bruce Beh – Twitter-Powered Vending machine May 10, 2016IAT 26512

13  I interviewed Facebook staff: –“We want people who have good design chops who know about system design and can write code”  Grad students –“We need people who can do deep scientific inquiry into what people need and how Facebook can fulfill that need” May 10, 2016IAT 26513

14 May 10, 2016IAT 26514

15 What  What you will do –4-5 assignments (50 %) In these individual assignments, you will build code to deliver a walking animal and have it be displayed on a common platform –Quizzes 15% –Exam 30% –Clicker (TopHat) 5% May 10, 2016IAT 26515

16 May 10, 2016IAT 26516 Programming languages  Abstract, “human understandable” language for telling computer what to do  The abstract language must be translated into the low level language “understood” by the machine  This translation is accomplished by an interpreter or compiler  We will be learning the compiled language Java

17 May 10, 2016IAT 26517 A simple Java program for ( int i = 0 ; i < 10 ; i++ ) { println( i ); } Just prints the numbers 0 to 9 on the screen Human readable?!?

18 May 10, 2016IAT 26518 “Human readable” is relative Java compiler translates this into… for (int i = 0; i < 10; i++) { println(i); }

19 May 10, 2016IAT 26519 Java VM assembly code public static void main(java.lang.String[]); Code: 0: iconst_0 1: istore_1 2: goto 30 5: getstatic 8: new 11: dup 12: ldc 14: invokespecial #23 17: iload_1 18: invokevirtual #27 21: invokevirtual #31 24: invokevirtual #34 27: iinc 1, 1 30: iload_1 31: bipush 10 33: if_icmplt 5 36: return test.PrintLoop(); Code: 0: aload_0 1: invokespecial #43; 4: return

20 May 10, 2016IAT 26520 Object Oriented vs. Procedural Languages Procedural (e.g. C) –We create some data representing an image (array of pixels to draw on the screen) –We write a procedure than can be passed the image and will draw it Object Oriented (e.g. Java) –We create a class that contains an image AND a procedure to draw it –The data and the behavior (ability to draw) are in one "container"

21 May 10, 2016IAT 26521 A couple of Java’s relatives  Smalltalk 80 –Alan Kay and the Dynabook (PARC)  C++ –Managing big C programs: Bjarne Stroustrup

22 May 10, 2016IAT 26522 Java  Designers started with C++ –Smaller –Simpler –Safer  Programming embedded systems –Toasters, microwave ovens, TV set top boxes Reliability very important--avoid costly recalls  Web programming –Incorporated into web browsers at critical moment

23 May 10, 2016IAT 26523 The virtual machine  Since Java was designed to run on embedded systems, it was designed around a virtual machine –“Write once, run everywhere” x86 Windows OS X x64 Processor Phone OS Java VM “Java OS” PCMacCell Phone Java Machine

24 Developing Programs  We will start with Processing  Then, we will transition to NetBeans using the Processing library. May 10, 2016IAT 26524

25 May 10, 2016IAT 26525 Processing  Processing is built on top of Java  Supports script-like coding –Easy to get simple programs up fast –But allows transition to full Java programming  Has built-in methods and classes to make drawing easy  Easy to export program

26 May 10, 2016IAT 26526 Playing around  To learn how to program it is necessary to play around with code!!! –Don’t just wait for me or the TA to show you things  Processing makes this easy –Use the Reference in the Help menu –or www.processing.org/reference –Play with the examples

27 May 10, 2016IAT 26527 Saving your work  You should install Processing on your own machine –Do this for Thursday  Processing saves all projects in a directory you can select via preferences

28 May 10, 2016IAT 26528 Drawing in Processing  Automatic creation of display window  Window has a coordinate system for drawing x y 050 100 0 50 100

29 Let’s draw a point: point() point(x,y) – draws a point at the location x, y Let’s try it: point(50, 50) Unexpected token: null – what ??  Compiler errors appear in the bottom pane All lines must be terminated with a semicolon ; May 10, 2016IAT 26529

30 Drawing several points point( 30, 20 ); point( 85, 20 ); point( 85, 75 ); point( 30, 75 ); May 10, 2016IAT 26530

31 Drawing more shapes line(x1, y1, x2, y2); triangle(x1, y1, x2, y2, x3, y3); rect(x, y, width, height); rectMode() – CORNER, CORNERS, CENTER ellipse(x, y, width, height); ellipseMode() – CENTER, CENTER_RADIUS, CORNER, CORNERS Don’t use these draw modes!!! rectMode(), ellipseMode() May 10, 2016IAT 26531

32 Controlling color and line Colors represented as Red Green Blue (RGB) values Each one ranges from 0 to 255 background(R,G,B); – set the background color stroke(R,G,B); – set the colors of the outline (default black) noStroke(); – no outline drawing around shapes fill(R,G,B); – set the fill color for shapes (default white) noFill(); – don’t fill the shapes (background shows through) strokeWeight(w); – line width for outlines (default 1) May 10, 2016IAT 26532

33 May 10, 2016IAT 26533 Comments  Comments are non-program text you put in the file to describe to others (and yourself) what you’re doing  Important for being able to look back at your code and understand it  Single-line comments begin with //  Multi-line comments begin with /* and end with */ Commenting and uncommenting lines is useful for figuring out code

34 Syntax  The study of the principles and rules for constructing sentences in natural languages  Computer languages are Formal Languages –Strict rules for well-formed statements –Well-defined meaning for well-formed statements So well defined, a machine can do it May 10, 2016IAT 26534

35  The formal meaning of well-formed statements  As we move forward in the term, we will 1.Describe correct syntax 2.Describe basic semantics 3.Explore the use of these tools for Design Semantics May 10, 2016IAT 26535

36 Drawing primitives  What are the different syntax parts of a drawing primitive? line( 0, 0, 50, 50 ); May 10, 2016IAT 26536 method name parentheses contain arguments arguments, parameters

37 The drawing commands are methods  Methods are reusable commands –Like a little machine that does work for you –Let’s you reuse code without typing it over and over  The arguments tell the method precisely what to do  We’ll see later that you can define your own methods! May 10, 2016IAT 26537

38 Variables  A variable is a named box for storing a value  You can put values in a variable by using the assignment operator (aka “=“ ) e.g. x = 1;  To use the value stored in a variable, just use the variable’s name e.g. line( x, 0, 50, 50); May 10, 2016IAT 26538

39 Variables have a type  You must tell Processing (Java) what kinds of values can go in the box  You do this by giving a variable a type May 10, 2016IAT 26539 int x; // variable x can hold integers (int) int y; // variable y can hold integers (int) x = 20; // store 20 in x y = 30; // store 30 in y point(x, y); // use the values of x and y to draw a point

40 Creating an int variable May 10, 2016IAT 26540 // Single int int anInt; // Put a value in the int anInt = 3; // Type error! anInt = “hello”; CodeEffect Name: anInt, Type: int 3 “hello” Can’t shove “hello” into an int

41 Assigned values must match the type May 10, 2016IAT 26541 int x; // variable x can hold integers (int) int y; // variable y can hold integers (int) x = 1.5; // store 1.5 in x causes an error!!! y = 30; // store 30 in y point(x, y); // use the values of x and y to draw a point

42 Why Types?  Tells system (and you) what kind of values to expect  System uses type to detect errors int pi = 3.14 ; //  error: 3.14 not an int May 10, 2016IAT 26542

43 The “primitive” types int – integers between -2,147,483,648 and 2,147,483,647 float – floating point numbers (e.g. 3.1415927, -2.34) char – a single character (e.g. ‘c’) byte – integers between -128 and 127 boolean – holds the values true or false color – holds a color (red, green, blue, alpha) color is a Processing type May 10, 2016IAT 26543

44 Can combine declaring and assigning  Declaring a variable means telling Processing its type int x;  Assigning a value to a variable means putting a value in the named box x = 1;  You can declare and assign at the same time int x = 1, y = 2;  But only declare a variable once, otherwise you get an error May 10, 2016IAT 26544

45 Print and println  When working with variables, it is often convenient to look at their values  print() and println() print to the bottom processing pane –They do the same thing, except println starts a new line after printing May 10, 2016IAT 26545

46 Control flow  By default Processing (Java) executes the lines of a method one after the other –Sequential control flow –Unconditional – doesn’t matter what happens in the world  Often we want which steps are executed to depend on what else has happened  That is, we want conditional control flow –This is necessary in order to make anything that is interactive May 10, 2016IAT 26546

47 If if statements introduce conditional execution if ( ) { // do this code } have one of two values: true or false May 10, 2016IAT 26547

48 Some boolean expressions May 10, 2016IAT 26548 anInteger == 1 true if variable anInteger is equal to 1 x > 20 true if variable x is greater than 20 1 == 2 true if 1 is equal to 2, it’s not so this is false ! is the not operator – reverses true and false so, ! (1 == 2) is true This is not a boolean expression: int anInteger = 1;

49 Example Try changing the values of drawRect and drawAnX May 10, 2016IAT 26549 strokeWeight(2); // draw with heavier line stroke(200, 0, 0); // draw with red line boolean drawRect = true; boolean drawAnX = true; if (drawRect) { fill(0, 200, 0); // fill with green rect(30, 30, 40, 40); } if (drawAnX) { line(0, 0, 100, 100); line(100, 0, 0, 100); }

50  Programming languages have pluggable parts if ( ) { // do this code } Compose programs from pluggable parts Composition May 10, 2016IAT 26550 Plug in a boolean Plug in a some code

51 IAT 26551 What do you think of this? “Which means that those computer scientists who invented these technologies … are the important artists of our time, maybe the only artists who are truly important and who will be remembered from this historical period.” Lev Manovich May 10, 2016

52 IAT 26552 Why program?  Relationship between art and CS –Should new media artists program? Why? –What about collaboration?  Computation as a medium May 10, 2016


Download ppt "IAT 265 Multimedia Programming for Art and Design ______________________________________________________________________________________ SCHOOL OF INTERACTIVE."

Similar presentations


Ads by Google