SlideShare a Scribd company logo
1 of 63
Download to read offline
a gentle introduction to
   openFrameworks


            Becky Stewart
      becky@theleadingzero.com
      beckystewart on slideshare
2 rules for this session
If you ever feel overwhelmed with
    information, feel free to say
If you ever feel overwhelmed with
    information, feel free to say

     “Just tell me what to type.”
If you ever feel overwhelmed with
      information, feel free to say

       “Just tell me what to type.”



If you ever want to know more or know
           why, feel free to say
If you ever feel overwhelmed with
      information, feel free to say

       “Just tell me what to type.”



If you ever want to know more or know
           why, feel free to say

         “I want to know more.”
what we will cover
• How is openFrameworks different from
  Processing?

• The structure of oF.
• Basic C++ concepts to get you going.
• Create a new openFrameworks application.
• Add your own variables and functions.
The magic behind
Processing and Arduino
Code You’ve               Instructions for
 Written         ?           Computer

              Compiler   Executable Program
                 +        (e.g. .exe or .app)
               Linker
                 +
               Loader
Interactive
       Development
     Environment (IDE)


Code You’ve                     Instructions for
 Written                 ?         Computer

                    Compiler   Executable Program
                       +        (e.g. .exe or .app)
                     Linker
                       +
                     Loader
An IDE like Processing or
Arduino includes

• text   editor

• compiler   and linker

• other   tools to help you
openFrameworks does not have it’s own IDE.

On Mac you use XCode.
To learn oF you need to know 3 things:

• How to use an IDE
• How to write C++ code
• How to use openFrameworks libraries
To learn oF you need to know 3 things:

• How to use an IDE
• How to write C++ code
• How to use openFrameworks libraries
                   By far the easiest part.
oF anatomy
openFrameworks


          apps       addons         libs


myapps   addonsExamples       examples


                          polygonExample


                    polygonExample.xcodeproj
Exercise


Open polygonExample and run it.
Why do we have 3 files?
main.cpp



testApp.cpp



 testApp.h
testApp.cpp and testApp.h
2 tbsp olive oil or sun-dried tomato oil from
            the jar                                             1 tsp dried oregano or a small handful of
                                                                fresh leaves, chopped
            6 rashers of smoked streaky bacon,
            chopped                                             1 tsp dried thyme or a small handful of
                                                                fresh leaves, chopped
            2 large onions, chopped
                                                                Drizzle balsamic vinegar
            3 garlic cloves, crushed
                                                                12-14 sun-dried tomato halves, in oil
            1kg/2¼lb lean minced beef
                                                                Salt and freshly ground black pepper
            2 large glasses of red wine
                                                                A good handful of fresh basil leaves, torn
            2x400g cans chopped tomatoes                        into small pieces
            1x290g jar antipasti marinated mushrooms,           800g-1kg/1¾-2¼lb dried spaghetti
            drained
                                                                Lots of freshly grated parmesan, to serve
            2 fresh or dried bay leaves
1. Heat the oil in a large, heavy-based saucepan and fry the bacon until golden over a medium heat. Add the
   onions and garlic, frying until softened. Increase the heat and add the minced beef. Fry it until it has
   browned, breaking down any chunks of meat with a wooden spoon. Pour in the wine and boil until it has
   reduced in volume by about a third. Reduce the temperature and stir in the tomatoes, drained
   mushrooms, bay leaves, oregano, thyme and balsamic vinegar.
2. Either blitz the sun-dried tomatoes in a small blender with a little of the oil to loosen, or just finely chop
   before adding to the pan. Season well with salt and pepper. Cover with a lid and simmer the Bolognese
   sauce over a gentle heat for 1-1½ hours until it's rich and thickened, stirring occasionally. At the end of
   the cooking time, stir in the basil and add any extra seasoning if necessary.
3. Remove from the heat to 'settle' while you cook the spaghetti in plenty of boiling salted water (for the time
   stated on the packet). Drain and divide between warmed plates. Scatter a little parmesan over the
   spaghetti before adding a good ladleful of the Bolognese sauce, finishing with a scattering of more cheese
   and a twist of black
  http://www.bbc.co.uk/food/recipes/spaghettibolognese_67868
2 tbsp olive oil or sun-dried tomato oil from
            the jar                                             1 tsp dried oregano or a small handful of
                                                                fresh leaves, chopped
            6 rashers of smoked streaky bacon,
            chopped                                             1 tsp dried thyme or a small handful of
                                                                fresh leaves, chopped
            2 large onions, chopped
                                                                Drizzle balsamic vinegar
            3 garlic cloves, crushed
                                                                12-14 sun-dried tomato halves, in oil
            1kg/2¼lb lean minced beef
                                                                Salt and freshly ground black pepper
            2 large glasses of red wine
                                                                A good handful of fresh basil leaves, torn
            2x400g cans chopped tomatoes                        into small pieces
            1x290g jar antipasti marinated mushrooms,           800g-1kg/1¾-2¼lb dried spaghetti
            drained
                                                                Lots of freshly grated parmesan, to serve
            2 fresh or dried bay leaves
1. Heat the oil in a large, heavy-based saucepan and fry the bacon until golden over a medium heat. Add the
   onions and garlic, frying until softened. Increase the heat and add the minced beef. Fry it until it has
   browned, breaking down any chunks of meat with a wooden spoon. Pour in the wine and boil until it has
   reduced in volume by about a third. Reduce the temperature and stir in the tomatoes, drained
   mushrooms, bay leaves, oregano, thyme and balsamic vinegar.
2. Either blitz the sun-dried tomatoes in a small blender with a little of the oil to loosen, or just finely chop
   before adding to the pan. Season well with salt and pepper. Cover with a lid and simmer the Bolognese
   sauce over a gentle heat for 1-1½ hours until it's rich and thickened, stirring occasionally. At the end of
   the cooking time, stir in the basil and add any extra seasoning if necessary.
3. Remove from the heat to 'settle' while you cook the spaghetti in plenty of boiling salted water (for the time
   stated on the packet). Drain and divide between warmed plates. Scatter a little parmesan over the
   spaghetti before adding a good ladleful of the Bolognese sauce, finishing with a scattering of more cheese
   and a twist of black
  http://www.bbc.co.uk/food/recipes/spaghettibolognese_67868
2 tbsp olive oil or sun-dried tomato oil from
            the jar                                             1 tsp dried oregano or a small handful of
                                                                fresh leaves, chopped
            6 rashers of smoked streaky bacon,
            chopped                                             1 tsp dried thyme or a small handful of
                                                                fresh leaves, chopped
            2 large onions, chopped
                                                                Drizzle balsamic vinegar
            3 garlic cloves, crushed
                                                                12-14 sun-dried tomato halves, in oil
            1kg/2¼lb lean minced beef
                                                                Salt and freshly ground black pepper
            2 large glasses of red wine
                                                                A good handful of fresh basil leaves, torn
            2x400g cans chopped tomatoes                        into small pieces
            1x290g jar antipasti marinated mushrooms,           800g-1kg/1¾-2¼lb dried spaghetti
            drained
                                                                Lots of freshly grated parmesan, to serve
            2 fresh or dried bay leaves
1. Heat the oil in a large, heavy-based saucepan and fry the bacon until golden over a medium heat. Add the
   onions and garlic, frying until softened. Increase the heat and add the minced beef. Fry it until it has
   browned, breaking down any chunks of meat with a wooden spoon. Pour in the wine and boil until it has
   reduced in volume by about a third. Reduce the temperature and stir in the tomatoes, drained
   mushrooms, bay leaves, oregano, thyme and balsamic vinegar.
2. Either blitz the sun-dried tomatoes in a small blender with a little of the oil to loosen, or just finely chop
   before adding to the pan. Season well with salt and pepper. Cover with a lid and simmer the Bolognese
   sauce over a gentle heat for 1-1½ hours until it's rich and thickened, stirring occasionally. At the end of
   the cooking time, stir in the basil and add any extra seasoning if necessary.
3. Remove from the heat to 'settle' while you cook the spaghetti in plenty of boiling salted water (for the time
   stated on the packet). Drain and divide between warmed plates. Scatter a little parmesan over the
   spaghetti before adding a good ladleful of the Bolognese sauce, finishing with a scattering of more cheese
   and a twist of black
  http://www.bbc.co.uk/food/recipes/spaghettibolognese_67868
2 tbsp olive oil or sun-dried tomato oil from
                                                                       1 tsp dried oregano or a small handful of
            the jar
            6 rashers of smoked streaky bacon,
                                                                We would be very irritated if
                                                                       fresh leaves, chopped
            chopped                                            there was an ingredient needed,
                                                                       1 tsp dried thyme or a small handful of
                                                                       fresh leaves, chopped
            2 large onions, chopped
            3 garlic cloves, crushed                              that wasn’t included here.
                                                                       Drizzle balsamic vinegar
                                                                       12-14 sun-dried tomato halves, in oil
            1kg/2¼lb lean minced beef
                                                                       Salt and freshly ground black pepper
            2 large glasses of red wine
                                                                       A good handful of fresh basil leaves, torn
            2x400g cans chopped tomatoes                               into small pieces
            1x290g jar antipasti marinated mushrooms,                  800g-1kg/1¾-2¼lb dried spaghetti
            drained
                                                                       Lots of freshly grated parmesan, to serve
            2 fresh or dried bay leaves
1. Heat the oil in a large, heavy-based saucepan and fry the bacon until golden over a medium heat. Add the
   onions and garlic, frying until softened. Increase the heat and add the minced beef. Fry it until it has
   browned, breaking down any chunks of meat with a wooden spoon. Pour in the wine and boil until it has
   reduced in volume by about a third. Reduce the temperature and stir in the tomatoes, drained
   mushrooms, bay leaves, oregano, thyme and balsamic vinegar.
2. Either blitz the sun-dried tomatoes in a small blender with a little of the oil to loosen, or just finely chop
   before adding to the pan. Season well with salt and pepper. Cover with a lid and simmer the Bolognese
   sauce over a gentle heat for 1-1½ hours until it's rich and thickened, stirring occasionally. At the end of
   the cooking time, stir in the basil and add any extra seasoning if necessary.
3. Remove from the heat to 'settle' while you cook the spaghetti in plenty of boiling salted water (for the time
   stated on the packet). Drain and divide between warmed plates. Scatter a little parmesan over the
   spaghetti before adding a good ladleful of the Bolognese sauce, finishing with a scattering of more cheese
   and a twist of black
  http://www.bbc.co.uk/food/recipes/spaghettibolognese_67868
2 tbsp olive oil or sun-dried tomato oil from
                                                                       1 tsp dried oregano or a small handful of
            the jar
            6 rashers of smoked streaky bacon,
                                                                We would be very irritated if
                                                                       fresh leaves, chopped
            chopped                                            there was an ingredient needed,
                                                                       1 tsp dried thyme or a small handful of
                                                                       fresh leaves, chopped
            2 large onions, chopped
            3 garlic cloves, crushed                              that wasn’t included here.
                                                                       Drizzle balsamic vinegar
                                                                       12-14 sun-dried tomato halves, in oil
            1kg/2¼lb lean minced beef
          The units used to describe the amount
            2 large glasses of red wine
                                                                       Salt and freshly ground black pepper
                                                                       A good handful of fresh basil leaves, torn
           of the ingredients varies according to
            2x400g cans chopped tomatoes
            1x290g jar antipasti marinated mushrooms,
                                                                       into small pieces
                                                                       800g-1kg/1¾-2¼lb dried spaghetti
            the culture of the person cooking.
            drained
                                                                       Lots of freshly grated parmesan, to serve
            2 fresh or dried bay leaves
1. Heat the oil in a large, heavy-based saucepan and fry the bacon until golden over a medium heat. Add the
   onions and garlic, frying until softened. Increase the heat and add the minced beef. Fry it until it has
   browned, breaking down any chunks of meat with a wooden spoon. Pour in the wine and boil until it has
   reduced in volume by about a third. Reduce the temperature and stir in the tomatoes, drained
   mushrooms, bay leaves, oregano, thyme and balsamic vinegar.
2. Either blitz the sun-dried tomatoes in a small blender with a little of the oil to loosen, or just finely chop
   before adding to the pan. Season well with salt and pepper. Cover with a lid and simmer the Bolognese
   sauce over a gentle heat for 1-1½ hours until it's rich and thickened, stirring occasionally. At the end of
   the cooking time, stir in the basil and add any extra seasoning if necessary.
3. Remove from the heat to 'settle' while you cook the spaghetti in plenty of boiling salted water (for the time
   stated on the packet). Drain and divide between warmed plates. Scatter a little parmesan over the
   spaghetti before adding a good ladleful of the Bolognese sauce, finishing with a scattering of more cheese
   and a twist of black
  http://www.bbc.co.uk/food/recipes/spaghettibolognese_67868
2 tbsp olive oil or sun-dried tomato oil from
                                                                       1 tsp dried oregano or a small handful of
            the jar
            6 rashers of smoked streaky bacon,
                                                                We would be very irritated if
                                                                       fresh leaves, chopped
            chopped                                            there was an ingredient needed,
                                                                       1 tsp dried thyme or a small handful of
                                                                       fresh leaves, chopped
            2 large onions, chopped
            3 garlic cloves, crushed                              that wasn’t included here.
                                                                       Drizzle balsamic vinegar
                                                                       12-14 sun-dried tomato halves, in oil
            1kg/2¼lb lean minced beef
          The units used to describe the amount
            2 large glasses of red wine
                                                                       Salt and freshly ground black pepper
                                                                       A good handful of fresh basil leaves, torn
           of the ingredients varies according to
            2x400g cans chopped tomatoes
            1x290g jar antipasti marinated mushrooms,
                                                                       into small pieces
                                                                       800g-1kg/1¾-2¼lb dried spaghetti
            the culture of the person cooking.
            drained
                                                                       Lots of freshly grated parmesan, to serve
            2 fresh or dried bay leaves
1. Heat the oil in a large, heavy-based saucepan and fry the bacon until golden over a medium heat. Add the
   onions and garlic, frying until softened. Increase the heat and add the minced beef. Fry it until it has
   browned, breaking down any chunks of meat with a wooden spoon. Pour in the wine and boil until it has
   reduced in volume by about a third. Reduce the temperature and stir in the tomatoes, drained
                       It’s easier to follow the directions when
   mushrooms, bay leaves, oregano, thyme and balsamic vinegar.

                          you don’t have to list the amounts of
2. Either blitz the sun-dried tomatoes in a small blender with a little of the oil to loosen, or just finely chop
   before adding to the pan. Season well with salt and pepper. Cover with a lid and simmer the Bolognese
                              ingredients within the directions.
   sauce over a gentle heat for 1-1½ hours until it's rich and thickened, stirring occasionally. At the end of
   the cooking time, stir in the basil and add any extra seasoning if necessary.
3. Remove from the heat to 'settle' while you cook the spaghetti in plenty of boiling salted water (for the time
   stated on the packet). Drain and divide between warmed plates. Scatter a little parmesan over the
   spaghetti before adding a good ladleful of the Bolognese sauce, finishing with a scattering of more cheese
   and a twist of black
  http://www.bbc.co.uk/food/recipes/spaghettibolognese_67868
Processing


         float   x;
         float   y;
         float   width;
         float   height;


         x = 150;
         y = 100;
         width = 90;
         height = 80;

         ellipse(x, y, width, height);
Processing


         float   x;
         float   y;        ingredients or variables
         float   width;
         float   height;


         x = 150;
         y = 100;
         width = 90;
         height = 80;

         ellipse(x, y, width, height);
Processing


         float   x;
         float   y;        ingredients or variables
         float   width;
         float   height;


         x = 150;
         y = 100;
         width = 90;       directions or algorithm
         height = 80;

         ellipse(x, y, width, height);
Processing
        data type

          float   x;
          float   y;        ingredients or variables
          float   width;
          float   height;


          x = 150;
          y = 100;
          width = 90;       directions or algorithm
          height = 80;

          ellipse(x, y, width, height);
Processing
        data type    variable name
          float   x;
          float   y;        ingredients or variables
          float   width;
          float   height;


          x = 150;
          y = 100;
          width = 90;       directions or algorithm
          height = 80;

          ellipse(x, y, width, height);
Declaration vs Initialisation
As in a recipe, ingredients need
to be listed at the top so you
know what to buy.

In code, it’s so the compiler
knows how much memory to
reserve. This is called declaring.
Declaration vs Initialisation
As in a recipe, ingredients need
to be listed at the top so you
know what to buy.

In code, it’s so the compiler
knows how much memory to
reserve. This is called declaring.


     int myInt;

       Reserve space for
           an int
Declaration vs Initialisation
As in a recipe, ingredients need     We don’t have to know what
to be listed at the top so you       value will be stored in myInt
know what to buy.                    right away.
In code, it’s so the compiler        We can choose a value later.
knows how much memory to             This is called initialising.
reserve. This is called declaring.


     int myInt;

       Reserve space for
           an int
Declaration vs Initialisation
As in a recipe, ingredients need     We don’t have to know what
to be listed at the top so you       value will be stored in myInt
know what to buy.                    right away.
In code, it’s so the compiler        We can choose a value later.
knows how much memory to             This is called initialising.
reserve. This is called declaring.


     int myInt;                          myInt = 15;

       Reserve space for                Store the value 15 in the
           an int                      space reserved for myInt

                                      15
Need to declare before or at the same time
as initialisation.
Need to declare before or at the same time
as initialisation.

myInt = 3;
int myInt;
Need to declare before or at the same time
as initialisation.

myInt = 3;                 int myInt;
int myInt;                 myInt = 3;
Need to declare before or at the same time
as initialisation.

myInt = 3;                     int myInt;
int myInt;                     myInt = 3;


 Can’t use a variable before it is initialised.
Need to declare before or at the same time
    as initialisation.

    myInt = 3;                     int myInt;
    int myInt;                     myInt = 3;


     Can’t use a variable before it is initialised.

int myInt;
myInt = myInt + 7;
Need to declare before or at the same time
    as initialisation.

    myInt = 3;                     int myInt;
    int myInt;                     myInt = 3;


     Can’t use a variable before it is initialised.

int myInt;                    int myInt = 3;
myInt = myInt + 7;            myInt = myInt + 7;
To create a variable
1.Decide what the data type should be.

                                 float
                                 int
                                 char
To create a variable
1.Decide what the data type should be.
      to create a float type
                                 float
                                 int
                                 char
To create a variable
1.Decide what the data type should be.
      to create a float type
                                 float
       to create an int type     int
                                 char
To create a variable
1.Decide what the data type should be.
      to create a float type
                                 float
       to create an int type     int
       to create a char type     char
To create a variable
1.Decide what the data type should be.
      to create a float type
                                 float
       to create an int type     int
       to create a char type     char

2.Decide on a name for your variable. Remember the rules.
To create a variable
1.Decide what the data type should be.
      to create a float type
                                 float
       to create an int type     int
       to create a char type     char

2.Decide on a name for your variable. Remember the rules.
                    float scale;
                    int redValue;
                    char finalMark;
To create a variable
1.Decide what the data type should be.
      to create a float type
                                 float
       to create an int type     int
       to create a char type     char

2.Decide on a name for your variable. Remember the rules.
                    float scale;             you get to choose
                    int redValue;                the name
                    char finalMark;
To create a variable
1.Decide what the data type should be.
       to create a float type
                                    float
        to create an int type       int
       to create a char type        char

2.Decide on a name for your variable. Remember the rules.
                     float scale;                you get to choose
                     int redValue;                   the name
                     char finalMark;

3.If you already know what the value of that variable is, then go ahead
  and set the value.
To create a variable
1.Decide what the data type should be.
       to create a float type
                                    float
        to create an int type       int
       to create a char type        char

2.Decide on a name for your variable. Remember the rules.
                     float scale;                you get to choose
                     int redValue;                   the name
                     char finalMark;

3.If you already know what the value of that variable is, then go ahead
  and set the value.
                  float scale = 0.5;
                  int redValue = 199;
                  char finalMark = ‘B’;
To create a variable
1.Decide what the data type should be.
       to create a float type
                                    float
        to create an int type       int
        to create a char type       char

2.Decide on a name for your variable. Remember the rules.
                     float scale;                 you get to choose
                     int redValue;                    the name
                     char finalMark;

3.If you already know what the value of that variable is, then go ahead
  and set the value.                                if you don’t know the
                  float scale = 0.5;               value yet, stop at step 2.
                  int redValue = 199;               but remember to end
                  char finalMark = ‘B’;                each line with a ;
In Processing, the declarations are at the top
of the file.

In openFrameworks, the declarations are in a
separate file (testApp.h, the header file).

This file is included in main.cpp.
main functions
Every program has a main function.
It’s the starting point.
It’s hidden in Processing, but exposed in
openFrameworks in main.cpp.

Defines:
     the window size
           ofAppGlutWindow window;
           ofSetupOpenGL(&window, 1024,768, OF_WINDOW);


       and your application class
           ofRunApp( new testApp());
Exercise

Create a copy of emptyExample in your myapps folder.
Rename the folder and .xcodeproj file.
Open the project.
Rename the target.
Make sure it builds and runs.
openFrameworks
• Really similar functionality as Processing.
• Fully documented here:
• http://www.openframeworks.cc/documentation
Exercise

Open your new empty project.
Create a purple circle in the center of the window.
Move the center of the circle to where you click
within the window.
Why do I use oF over
     Processing?
• Speed
• Accessibility of low level information
• Debugger
• C++
• Version control
what is OOP?
it sounds sticky
main.cpp
                 myApp
           myApp.cpp myApp.h




oscHandler.h              textButton.h
  oscHandler                textButton
oscHandler.cpp            textButton.cpp
main.cpp
                 myOtherApp
    myOtherApp.cpp      myOtherApp.h




oscHandler.h                  textButton.h
  oscHandler                    textButton
oscHandler.cpp                textButton.cpp

More Related Content

Similar to A Gentle Introduction to openFrameworks

Similar to A Gentle Introduction to openFrameworks (20)

MzTEK Programming - Part 1
MzTEK Programming - Part 1MzTEK Programming - Part 1
MzTEK Programming - Part 1
 
sicilian feast
sicilian feastsicilian feast
sicilian feast
 
Spaghetti sauces
Spaghetti saucesSpaghetti sauces
Spaghetti sauces
 
Summer Salads - Laura Baddish
Summer Salads - Laura BaddishSummer Salads - Laura Baddish
Summer Salads - Laura Baddish
 
COLD-SOUP-PRESENTATION-FOR-PRESEMNTATION-ONLY
COLD-SOUP-PRESENTATION-FOR-PRESEMNTATION-ONLYCOLD-SOUP-PRESENTATION-FOR-PRESEMNTATION-ONLY
COLD-SOUP-PRESENTATION-FOR-PRESEMNTATION-ONLY
 
LINGUINI WITH PRAWNS AQUAMARIS
LINGUINI WITH PRAWNS AQUAMARISLINGUINI WITH PRAWNS AQUAMARIS
LINGUINI WITH PRAWNS AQUAMARIS
 
Receta de cocina
Receta de cocinaReceta de cocina
Receta de cocina
 
Best Homemade Vegan/Plant Based Recipe Book
Best Homemade Vegan/Plant Based Recipe BookBest Homemade Vegan/Plant Based Recipe Book
Best Homemade Vegan/Plant Based Recipe Book
 
Traditional polish food
Traditional polish foodTraditional polish food
Traditional polish food
 
Materiales
MaterialesMateriales
Materiales
 
Perez restaurant
Perez restaurantPerez restaurant
Perez restaurant
 
6322763-Vegetarian-Recipe
6322763-Vegetarian-Recipe6322763-Vegetarian-Recipe
6322763-Vegetarian-Recipe
 
Menú
MenúMenú
Menú
 
Gourmet gardensalads recipes-pdf
Gourmet gardensalads recipes-pdfGourmet gardensalads recipes-pdf
Gourmet gardensalads recipes-pdf
 
Recipe of tarhana soup
Recipe of tarhana soupRecipe of tarhana soup
Recipe of tarhana soup
 
2764_26_v4
2764_26_v42764_26_v4
2764_26_v4
 
Healthy & flavorful 5 day dinner plan
Healthy & flavorful 5 day dinner planHealthy & flavorful 5 day dinner plan
Healthy & flavorful 5 day dinner plan
 
Gourmed Healthy diet products
 Gourmed Healthy diet products Gourmed Healthy diet products
Gourmed Healthy diet products
 
Fitness Recipe Book- Eat Better, Be Heathy
Fitness Recipe Book- Eat Better, Be HeathyFitness Recipe Book- Eat Better, Be Heathy
Fitness Recipe Book- Eat Better, Be Heathy
 
Fricando
FricandoFricando
Fricando
 

Recently uploaded

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 

Recently uploaded (20)

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 

A Gentle Introduction to openFrameworks

  • 1. a gentle introduction to openFrameworks Becky Stewart becky@theleadingzero.com beckystewart on slideshare
  • 2. 2 rules for this session
  • 3. If you ever feel overwhelmed with information, feel free to say
  • 4. If you ever feel overwhelmed with information, feel free to say “Just tell me what to type.”
  • 5. If you ever feel overwhelmed with information, feel free to say “Just tell me what to type.” If you ever want to know more or know why, feel free to say
  • 6. If you ever feel overwhelmed with information, feel free to say “Just tell me what to type.” If you ever want to know more or know why, feel free to say “I want to know more.”
  • 7. what we will cover
  • 8. • How is openFrameworks different from Processing? • The structure of oF. • Basic C++ concepts to get you going. • Create a new openFrameworks application. • Add your own variables and functions.
  • 10. Code You’ve Instructions for Written ? Computer Compiler Executable Program + (e.g. .exe or .app) Linker + Loader
  • 11. Interactive Development Environment (IDE) Code You’ve Instructions for Written ? Computer Compiler Executable Program + (e.g. .exe or .app) Linker + Loader
  • 12. An IDE like Processing or Arduino includes • text editor • compiler and linker • other tools to help you
  • 13. openFrameworks does not have it’s own IDE. On Mac you use XCode.
  • 14. To learn oF you need to know 3 things: • How to use an IDE • How to write C++ code • How to use openFrameworks libraries
  • 15. To learn oF you need to know 3 things: • How to use an IDE • How to write C++ code • How to use openFrameworks libraries By far the easiest part.
  • 17. openFrameworks apps addons libs myapps addonsExamples examples polygonExample polygonExample.xcodeproj
  • 19. Why do we have 3 files?
  • 22. 2 tbsp olive oil or sun-dried tomato oil from the jar 1 tsp dried oregano or a small handful of fresh leaves, chopped 6 rashers of smoked streaky bacon, chopped 1 tsp dried thyme or a small handful of fresh leaves, chopped 2 large onions, chopped Drizzle balsamic vinegar 3 garlic cloves, crushed 12-14 sun-dried tomato halves, in oil 1kg/2¼lb lean minced beef Salt and freshly ground black pepper 2 large glasses of red wine A good handful of fresh basil leaves, torn 2x400g cans chopped tomatoes into small pieces 1x290g jar antipasti marinated mushrooms, 800g-1kg/1¾-2¼lb dried spaghetti drained Lots of freshly grated parmesan, to serve 2 fresh or dried bay leaves 1. Heat the oil in a large, heavy-based saucepan and fry the bacon until golden over a medium heat. Add the onions and garlic, frying until softened. Increase the heat and add the minced beef. Fry it until it has browned, breaking down any chunks of meat with a wooden spoon. Pour in the wine and boil until it has reduced in volume by about a third. Reduce the temperature and stir in the tomatoes, drained mushrooms, bay leaves, oregano, thyme and balsamic vinegar. 2. Either blitz the sun-dried tomatoes in a small blender with a little of the oil to loosen, or just finely chop before adding to the pan. Season well with salt and pepper. Cover with a lid and simmer the Bolognese sauce over a gentle heat for 1-1½ hours until it's rich and thickened, stirring occasionally. At the end of the cooking time, stir in the basil and add any extra seasoning if necessary. 3. Remove from the heat to 'settle' while you cook the spaghetti in plenty of boiling salted water (for the time stated on the packet). Drain and divide between warmed plates. Scatter a little parmesan over the spaghetti before adding a good ladleful of the Bolognese sauce, finishing with a scattering of more cheese and a twist of black http://www.bbc.co.uk/food/recipes/spaghettibolognese_67868
  • 23. 2 tbsp olive oil or sun-dried tomato oil from the jar 1 tsp dried oregano or a small handful of fresh leaves, chopped 6 rashers of smoked streaky bacon, chopped 1 tsp dried thyme or a small handful of fresh leaves, chopped 2 large onions, chopped Drizzle balsamic vinegar 3 garlic cloves, crushed 12-14 sun-dried tomato halves, in oil 1kg/2¼lb lean minced beef Salt and freshly ground black pepper 2 large glasses of red wine A good handful of fresh basil leaves, torn 2x400g cans chopped tomatoes into small pieces 1x290g jar antipasti marinated mushrooms, 800g-1kg/1¾-2¼lb dried spaghetti drained Lots of freshly grated parmesan, to serve 2 fresh or dried bay leaves 1. Heat the oil in a large, heavy-based saucepan and fry the bacon until golden over a medium heat. Add the onions and garlic, frying until softened. Increase the heat and add the minced beef. Fry it until it has browned, breaking down any chunks of meat with a wooden spoon. Pour in the wine and boil until it has reduced in volume by about a third. Reduce the temperature and stir in the tomatoes, drained mushrooms, bay leaves, oregano, thyme and balsamic vinegar. 2. Either blitz the sun-dried tomatoes in a small blender with a little of the oil to loosen, or just finely chop before adding to the pan. Season well with salt and pepper. Cover with a lid and simmer the Bolognese sauce over a gentle heat for 1-1½ hours until it's rich and thickened, stirring occasionally. At the end of the cooking time, stir in the basil and add any extra seasoning if necessary. 3. Remove from the heat to 'settle' while you cook the spaghetti in plenty of boiling salted water (for the time stated on the packet). Drain and divide between warmed plates. Scatter a little parmesan over the spaghetti before adding a good ladleful of the Bolognese sauce, finishing with a scattering of more cheese and a twist of black http://www.bbc.co.uk/food/recipes/spaghettibolognese_67868
  • 24. 2 tbsp olive oil or sun-dried tomato oil from the jar 1 tsp dried oregano or a small handful of fresh leaves, chopped 6 rashers of smoked streaky bacon, chopped 1 tsp dried thyme or a small handful of fresh leaves, chopped 2 large onions, chopped Drizzle balsamic vinegar 3 garlic cloves, crushed 12-14 sun-dried tomato halves, in oil 1kg/2¼lb lean minced beef Salt and freshly ground black pepper 2 large glasses of red wine A good handful of fresh basil leaves, torn 2x400g cans chopped tomatoes into small pieces 1x290g jar antipasti marinated mushrooms, 800g-1kg/1¾-2¼lb dried spaghetti drained Lots of freshly grated parmesan, to serve 2 fresh or dried bay leaves 1. Heat the oil in a large, heavy-based saucepan and fry the bacon until golden over a medium heat. Add the onions and garlic, frying until softened. Increase the heat and add the minced beef. Fry it until it has browned, breaking down any chunks of meat with a wooden spoon. Pour in the wine and boil until it has reduced in volume by about a third. Reduce the temperature and stir in the tomatoes, drained mushrooms, bay leaves, oregano, thyme and balsamic vinegar. 2. Either blitz the sun-dried tomatoes in a small blender with a little of the oil to loosen, or just finely chop before adding to the pan. Season well with salt and pepper. Cover with a lid and simmer the Bolognese sauce over a gentle heat for 1-1½ hours until it's rich and thickened, stirring occasionally. At the end of the cooking time, stir in the basil and add any extra seasoning if necessary. 3. Remove from the heat to 'settle' while you cook the spaghetti in plenty of boiling salted water (for the time stated on the packet). Drain and divide between warmed plates. Scatter a little parmesan over the spaghetti before adding a good ladleful of the Bolognese sauce, finishing with a scattering of more cheese and a twist of black http://www.bbc.co.uk/food/recipes/spaghettibolognese_67868
  • 25. 2 tbsp olive oil or sun-dried tomato oil from 1 tsp dried oregano or a small handful of the jar 6 rashers of smoked streaky bacon, We would be very irritated if fresh leaves, chopped chopped there was an ingredient needed, 1 tsp dried thyme or a small handful of fresh leaves, chopped 2 large onions, chopped 3 garlic cloves, crushed that wasn’t included here. Drizzle balsamic vinegar 12-14 sun-dried tomato halves, in oil 1kg/2¼lb lean minced beef Salt and freshly ground black pepper 2 large glasses of red wine A good handful of fresh basil leaves, torn 2x400g cans chopped tomatoes into small pieces 1x290g jar antipasti marinated mushrooms, 800g-1kg/1¾-2¼lb dried spaghetti drained Lots of freshly grated parmesan, to serve 2 fresh or dried bay leaves 1. Heat the oil in a large, heavy-based saucepan and fry the bacon until golden over a medium heat. Add the onions and garlic, frying until softened. Increase the heat and add the minced beef. Fry it until it has browned, breaking down any chunks of meat with a wooden spoon. Pour in the wine and boil until it has reduced in volume by about a third. Reduce the temperature and stir in the tomatoes, drained mushrooms, bay leaves, oregano, thyme and balsamic vinegar. 2. Either blitz the sun-dried tomatoes in a small blender with a little of the oil to loosen, or just finely chop before adding to the pan. Season well with salt and pepper. Cover with a lid and simmer the Bolognese sauce over a gentle heat for 1-1½ hours until it's rich and thickened, stirring occasionally. At the end of the cooking time, stir in the basil and add any extra seasoning if necessary. 3. Remove from the heat to 'settle' while you cook the spaghetti in plenty of boiling salted water (for the time stated on the packet). Drain and divide between warmed plates. Scatter a little parmesan over the spaghetti before adding a good ladleful of the Bolognese sauce, finishing with a scattering of more cheese and a twist of black http://www.bbc.co.uk/food/recipes/spaghettibolognese_67868
  • 26. 2 tbsp olive oil or sun-dried tomato oil from 1 tsp dried oregano or a small handful of the jar 6 rashers of smoked streaky bacon, We would be very irritated if fresh leaves, chopped chopped there was an ingredient needed, 1 tsp dried thyme or a small handful of fresh leaves, chopped 2 large onions, chopped 3 garlic cloves, crushed that wasn’t included here. Drizzle balsamic vinegar 12-14 sun-dried tomato halves, in oil 1kg/2¼lb lean minced beef The units used to describe the amount 2 large glasses of red wine Salt and freshly ground black pepper A good handful of fresh basil leaves, torn of the ingredients varies according to 2x400g cans chopped tomatoes 1x290g jar antipasti marinated mushrooms, into small pieces 800g-1kg/1¾-2¼lb dried spaghetti the culture of the person cooking. drained Lots of freshly grated parmesan, to serve 2 fresh or dried bay leaves 1. Heat the oil in a large, heavy-based saucepan and fry the bacon until golden over a medium heat. Add the onions and garlic, frying until softened. Increase the heat and add the minced beef. Fry it until it has browned, breaking down any chunks of meat with a wooden spoon. Pour in the wine and boil until it has reduced in volume by about a third. Reduce the temperature and stir in the tomatoes, drained mushrooms, bay leaves, oregano, thyme and balsamic vinegar. 2. Either blitz the sun-dried tomatoes in a small blender with a little of the oil to loosen, or just finely chop before adding to the pan. Season well with salt and pepper. Cover with a lid and simmer the Bolognese sauce over a gentle heat for 1-1½ hours until it's rich and thickened, stirring occasionally. At the end of the cooking time, stir in the basil and add any extra seasoning if necessary. 3. Remove from the heat to 'settle' while you cook the spaghetti in plenty of boiling salted water (for the time stated on the packet). Drain and divide between warmed plates. Scatter a little parmesan over the spaghetti before adding a good ladleful of the Bolognese sauce, finishing with a scattering of more cheese and a twist of black http://www.bbc.co.uk/food/recipes/spaghettibolognese_67868
  • 27. 2 tbsp olive oil or sun-dried tomato oil from 1 tsp dried oregano or a small handful of the jar 6 rashers of smoked streaky bacon, We would be very irritated if fresh leaves, chopped chopped there was an ingredient needed, 1 tsp dried thyme or a small handful of fresh leaves, chopped 2 large onions, chopped 3 garlic cloves, crushed that wasn’t included here. Drizzle balsamic vinegar 12-14 sun-dried tomato halves, in oil 1kg/2¼lb lean minced beef The units used to describe the amount 2 large glasses of red wine Salt and freshly ground black pepper A good handful of fresh basil leaves, torn of the ingredients varies according to 2x400g cans chopped tomatoes 1x290g jar antipasti marinated mushrooms, into small pieces 800g-1kg/1¾-2¼lb dried spaghetti the culture of the person cooking. drained Lots of freshly grated parmesan, to serve 2 fresh or dried bay leaves 1. Heat the oil in a large, heavy-based saucepan and fry the bacon until golden over a medium heat. Add the onions and garlic, frying until softened. Increase the heat and add the minced beef. Fry it until it has browned, breaking down any chunks of meat with a wooden spoon. Pour in the wine and boil until it has reduced in volume by about a third. Reduce the temperature and stir in the tomatoes, drained It’s easier to follow the directions when mushrooms, bay leaves, oregano, thyme and balsamic vinegar. you don’t have to list the amounts of 2. Either blitz the sun-dried tomatoes in a small blender with a little of the oil to loosen, or just finely chop before adding to the pan. Season well with salt and pepper. Cover with a lid and simmer the Bolognese ingredients within the directions. sauce over a gentle heat for 1-1½ hours until it's rich and thickened, stirring occasionally. At the end of the cooking time, stir in the basil and add any extra seasoning if necessary. 3. Remove from the heat to 'settle' while you cook the spaghetti in plenty of boiling salted water (for the time stated on the packet). Drain and divide between warmed plates. Scatter a little parmesan over the spaghetti before adding a good ladleful of the Bolognese sauce, finishing with a scattering of more cheese and a twist of black http://www.bbc.co.uk/food/recipes/spaghettibolognese_67868
  • 28. Processing float x; float y; float width; float height; x = 150; y = 100; width = 90; height = 80; ellipse(x, y, width, height);
  • 29. Processing float x; float y; ingredients or variables float width; float height; x = 150; y = 100; width = 90; height = 80; ellipse(x, y, width, height);
  • 30. Processing float x; float y; ingredients or variables float width; float height; x = 150; y = 100; width = 90; directions or algorithm height = 80; ellipse(x, y, width, height);
  • 31. Processing data type float x; float y; ingredients or variables float width; float height; x = 150; y = 100; width = 90; directions or algorithm height = 80; ellipse(x, y, width, height);
  • 32. Processing data type variable name float x; float y; ingredients or variables float width; float height; x = 150; y = 100; width = 90; directions or algorithm height = 80; ellipse(x, y, width, height);
  • 33. Declaration vs Initialisation As in a recipe, ingredients need to be listed at the top so you know what to buy. In code, it’s so the compiler knows how much memory to reserve. This is called declaring.
  • 34. Declaration vs Initialisation As in a recipe, ingredients need to be listed at the top so you know what to buy. In code, it’s so the compiler knows how much memory to reserve. This is called declaring. int myInt; Reserve space for an int
  • 35. Declaration vs Initialisation As in a recipe, ingredients need We don’t have to know what to be listed at the top so you value will be stored in myInt know what to buy. right away. In code, it’s so the compiler We can choose a value later. knows how much memory to This is called initialising. reserve. This is called declaring. int myInt; Reserve space for an int
  • 36. Declaration vs Initialisation As in a recipe, ingredients need We don’t have to know what to be listed at the top so you value will be stored in myInt know what to buy. right away. In code, it’s so the compiler We can choose a value later. knows how much memory to This is called initialising. reserve. This is called declaring. int myInt; myInt = 15; Reserve space for Store the value 15 in the an int space reserved for myInt 15
  • 37. Need to declare before or at the same time as initialisation.
  • 38. Need to declare before or at the same time as initialisation. myInt = 3; int myInt;
  • 39. Need to declare before or at the same time as initialisation. myInt = 3; int myInt; int myInt; myInt = 3;
  • 40. Need to declare before or at the same time as initialisation. myInt = 3; int myInt; int myInt; myInt = 3; Can’t use a variable before it is initialised.
  • 41. Need to declare before or at the same time as initialisation. myInt = 3; int myInt; int myInt; myInt = 3; Can’t use a variable before it is initialised. int myInt; myInt = myInt + 7;
  • 42. Need to declare before or at the same time as initialisation. myInt = 3; int myInt; int myInt; myInt = 3; Can’t use a variable before it is initialised. int myInt; int myInt = 3; myInt = myInt + 7; myInt = myInt + 7;
  • 43. To create a variable 1.Decide what the data type should be. float int char
  • 44. To create a variable 1.Decide what the data type should be. to create a float type float int char
  • 45. To create a variable 1.Decide what the data type should be. to create a float type float to create an int type int char
  • 46. To create a variable 1.Decide what the data type should be. to create a float type float to create an int type int to create a char type char
  • 47. To create a variable 1.Decide what the data type should be. to create a float type float to create an int type int to create a char type char 2.Decide on a name for your variable. Remember the rules.
  • 48. To create a variable 1.Decide what the data type should be. to create a float type float to create an int type int to create a char type char 2.Decide on a name for your variable. Remember the rules. float scale; int redValue; char finalMark;
  • 49. To create a variable 1.Decide what the data type should be. to create a float type float to create an int type int to create a char type char 2.Decide on a name for your variable. Remember the rules. float scale; you get to choose int redValue; the name char finalMark;
  • 50. To create a variable 1.Decide what the data type should be. to create a float type float to create an int type int to create a char type char 2.Decide on a name for your variable. Remember the rules. float scale; you get to choose int redValue; the name char finalMark; 3.If you already know what the value of that variable is, then go ahead and set the value.
  • 51. To create a variable 1.Decide what the data type should be. to create a float type float to create an int type int to create a char type char 2.Decide on a name for your variable. Remember the rules. float scale; you get to choose int redValue; the name char finalMark; 3.If you already know what the value of that variable is, then go ahead and set the value. float scale = 0.5; int redValue = 199; char finalMark = ‘B’;
  • 52. To create a variable 1.Decide what the data type should be. to create a float type float to create an int type int to create a char type char 2.Decide on a name for your variable. Remember the rules. float scale; you get to choose int redValue; the name char finalMark; 3.If you already know what the value of that variable is, then go ahead and set the value. if you don’t know the float scale = 0.5; value yet, stop at step 2. int redValue = 199; but remember to end char finalMark = ‘B’; each line with a ;
  • 53. In Processing, the declarations are at the top of the file. In openFrameworks, the declarations are in a separate file (testApp.h, the header file). This file is included in main.cpp.
  • 55. Every program has a main function. It’s the starting point. It’s hidden in Processing, but exposed in openFrameworks in main.cpp. Defines: the window size ofAppGlutWindow window; ofSetupOpenGL(&window, 1024,768, OF_WINDOW); and your application class ofRunApp( new testApp());
  • 56. Exercise Create a copy of emptyExample in your myapps folder. Rename the folder and .xcodeproj file. Open the project. Rename the target. Make sure it builds and runs.
  • 58. • Really similar functionality as Processing. • Fully documented here: • http://www.openframeworks.cc/documentation
  • 59. Exercise Open your new empty project. Create a purple circle in the center of the window. Move the center of the circle to where you click within the window.
  • 60. Why do I use oF over Processing? • Speed • Accessibility of low level information • Debugger • C++ • Version control
  • 61. what is OOP? it sounds sticky
  • 62. main.cpp myApp myApp.cpp myApp.h oscHandler.h textButton.h oscHandler textButton oscHandler.cpp textButton.cpp
  • 63. main.cpp myOtherApp myOtherApp.cpp myOtherApp.h oscHandler.h textButton.h oscHandler textButton oscHandler.cpp textButton.cpp