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

Slides:



Advertisements
Similar presentations
AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.
Advertisements

Introduction to Programming
Processing Lecture. 1 What is processing?
Variables and Operators
IAT 334 Java using Processing ______________________________________________________________________________________ SCHOOL OF INTERACTIVE ARTS + TECHNOLOGY.
Client Side Programming Using Java Applet Outcomes: You will be expected to know: – Java Applets and HTML file; –bytecode and platform independent programs;
1 Java Basics. 2 Compiling A “compiler” is a program that translates from one language to another Typically from easy-to-read to fast-to-run e.g. from.
IAT 800 Foundations of Computational Art and Design Lecture 2.
IAT 800 Foundations of Computational Art and Design ______________________________________________________________________________________ SCHOOL OF INTERACTIVE.
Outline Java program structure Basic program elements
Lecture 3 IAT 800. Sept 15, Fall 2006IAT 8002 Suggestions on learning to program  Spend a lot of time fiddling around with code –Programming is something.
CSE 131 Computer Science 1 Module 1: (basics of Java)
Java: Chapter 1 Computer Systems Computer Programming II Aug
LCC 6310 Computation as an Expressive Medium Lecture 1.
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 10 Fall 2010.
CSCI 273: Processing An Introduction. Programming Languages –An abstract "human understandable" language for telling the computer what to do –The abstract.
Java: Chapter 1 Computer Systems Computer Programming II.
Intro to Java & Processing. Review CS is about problem-solving CS is about problem-solving To write programs you must To write programs you must –Be able.
Introduction to Programming David Goldschmidt, Ph.D. Computer Science The College of Saint Rose Java Fundamentals (Comments, Variables, etc.)
CSC204 – Programming I Lecture 4 August 28, 2002.
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
CSE 131 Computer Science 1 Module 1: (basics of Java)
How to Create a Videogame By: Connor McCann. Java Java is one of many programming languages Java is used to run web browsers and most PC video games I.
CSCI Processing CSCI Introduction to Algorithm Design An Introduction.
Netprog: Java Intro1 Crash Course in Java. Netprog: Java Intro2 Why Java? Network Programming in Java is very different than in C/C++ –much more language.
______________________________________________________________________________________ SCHOOL OF INTERACTIVE ARTS + TECHNOLOGY [SIAT] |
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 10 Fall 2010.
2-D Shapes, Color, and simple animation. 7 Basic Shapes Ellipse :: ellipse() Arc :: arc() Line :: line() Point :: point() Rectangle :: rect() Triangle.
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
Often being different. Control flow By default Java (and therefore Processing) executes lines of a program one after the other –Doesn’t matter what happened.
LCC 6310 Computation as an Expressive Medium Lecture 2.
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004 Drawing pictures … It’s not art, it’s fun.
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
11 Making Decisions in a Program Session 2.3. Session Overview  Introduce the idea of an algorithm  Show how a program can make logical decisions based.
Introduction to Processing David Meredith Aalborg University Art &Technology, 3rd Semester Programming.
Information and Computer Sciences University of Hawaii, Manoa
Basic concepts of C++ Presented by Prof. Satyajit De
Pixels, Colors and Shapes
Content Programming Overview The JVM A brief look at Structure
“Under the hood”: Angry Birds Maze
Learning to Program D is for Digital.
Chapter 3 Syntax, Errors, and Debugging
Introduction to Python
Key Ideas from day 1 slides
Objectives You should be able to describe: Interactive Keyboard Input
CS216: Program and Data Representation
Data types and variables
Chapter 2 First Java Programs
LCC 6310 Computation as an Expressive Medium
C Basics.
Programming Language Concepts (CIS 635)
Lesson One: The Beginning Chapter 1: Pixels Learning Processing Daniel Shiffman Presentation by Donald W. Smith Graphics from
Tutorial C#.
Processing and Drawing CSE 120 Winter 2018
Code Elements and Processing Coordinate System
Introduction to Algorithm Design
Fundamentals of Programming
Code Elements and Processing Coordinate System
Sridhar Narayan Java Basics Sridhar Narayan
LCC 6310 Computation as an Expressive Medium
Focus of the Course Object-Oriented Software Development
Tonga Institute of Higher Education IT 141: Information Systems
Lawrence Snyder University of Washington, Seattle
Lecture 13 Introduction to High-Level Programming (S&G, §§7.1–7.6)
Tonga Institute of Higher Education IT 141: Information Systems
LCC 6310 Computation as an Expressive Medium
LCC 6310 Computation as an Expressive Medium
IAT 800 Foundations of Computational Art and Design
LCC 6310 Computation as an Expressive Medium
LCC 6310 Computation as an Expressive Medium
Presentation transcript:

IAT 265 Multimedia Programming for Art and Design ______________________________________________________________________________________ SCHOOL OF INTERACTIVE ARTS + TECHNOLOGY [SIAT] |

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

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

May 10, 2016IAT D CAD: Twister

May 10, 2016IAT CAD: Gallery

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

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

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

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

Cassie deGit – Tutoring System May 10, 2016IAT 26510

Carlo Misajon- TableTop Game May 10, 2016IAT 26511

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

 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

May 10, 2016IAT 26514

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

May 10, 2016IAT 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

May 10, 2016IAT 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?!?

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

May 10, 2016IAT 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

May 10, 2016IAT 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"

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

May 10, 2016IAT 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

May 10, 2016IAT 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

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

May 10, 2016IAT 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

May 10, 2016IAT 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 –Play with the examples

May 10, 2016IAT 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

May 10, 2016IAT Drawing in Processing  Automatic creation of display window  Window has a coordinate system for drawing x y

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

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

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

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

May 10, 2016IAT 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

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

 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

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

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

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

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 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

Creating an int variable May 10, 2016IAT // 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

Assigned values must match the type May 10, 2016IAT 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

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

The “primitive” types int – integers between -2,147,483,648 and 2,147,483,647 float – floating point numbers (e.g , -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

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

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

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

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

Some boolean expressions May 10, 2016IAT 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;

Example Try changing the values of drawRect and drawAnX May 10, 2016IAT 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); }

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

IAT 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

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