"Cannot cast from float to PGraphicsOpenGL"

Post your questions here and we'll all try to help.
Post Reply
faherty94
Posts: 1
Joined: Wed May 03, 2017 19:53

"Cannot cast from float to PGraphicsOpenGL"

Post by faherty94 »

Hello!

For my final year project I am creating an interactive table that uses processing. The set up of the table uses a projector and a mirror to cast an image up onto a sheet of perspex. The one problem we have is the throw of the projector is too wide so we need to use a program like resolume to warp the image. I have downloaded Spout and got the demo file working fine with resolume however when I try to convert my code for spout in order for it to send to resolume and I keep getting this error "Cannot cast from float to PGraphicsOpenGL"

Does anyone have any idea what my problem might be? I am new to all of this so please go easy on me! :)

I've attached my code below!

Code: Select all

//
//          Spout Sender
//
//      Demonstrates drawing onto the Processing
//      screen and sending out as a shared texture
//      to a Spout receiver.
//
//      Based on a Processing example sketch by by Dave Bollinger
//      http://processing.org/examples/texturecube.html
//
//      See Spout.pde for function details
//

// DECLARE A SPOUT OBJECT HERE
Spout spout;

import TUIO.*;
import gifAnimation.*;
// declare a TuioProcessing client
TuioProcessing tuioClient;

// these are some helper variables which are used
// to create scalable graphical feedback
float cursor_size = 400;
float object_size = 60; //the square representing the fiducial
float table_size = 900; // size of the feedback
float scale_factor = 1;
float angle;
PFont font;

//FADE INS
float fadeinA = 0;
float fadeinB = 0;
float fadeinC = 0;
float fadeinD = 0;
float UfadeinA = 0;
float UfadeinB = 0;
float UfadeinC = 0;
float UfadeinD = 0;

float Ufadein1A = 0;
float Ufadein1B = 0;
float Ufadein1C = 0;

float fadein1A = 0;
float fadein1B = 0;
float fadein1C = 0;

float Ufadein3A = 0;
float Ufadein3B = 0;
float Ufadein3C = 0;

float fadein3A = 0;
float fadein3B = 0;
float fadein3C = 0;

float Ufadein4A = 0;
float Ufadein4B = 0;
float Ufadein4C = 0;

float fadein4A = 0;
float fadein4B = 0;
float fadein4C = 0;

float Ufadein5A = 0;
float Ufadein5B = 0;
float Ufadein5C = 0;

float fadein5A = 0;
float fadein5B = 0;
float fadein5C = 0;
// Timer for hints

float timer= 0;  
boolean Point1Hint = false;
boolean Point2Hint = false;
boolean Point3Hint = false;
boolean Point4Hint = false;
boolean Point5Hint = false;
boolean Point6Hint = false;

//Turn off screen
float StandbyTimer = 0;
PShape StandbyRect;

String[] controlName;
int[] controlType;
float[] controlValue;
String[] controlText;
String UserText = "";

//  float = Data type for floating-point numbers, e.g. numbers that have a decimal point.

boolean verbose = false; // print console debug messages
boolean callback = true; // updates only after callbacks

/////////////////////////// POINT1
float Point1=0;
PShape Point1HintCircle; 
PImage Point1AImg;
PImage Point1BImg;
PImage Point1CImg; 
float P1Mark = 0;
PImage P1Marker;

Gif Point1Red;

String Point1ATxt = "Designed by William Burges and consecrated in 1870, the current cathedral is built on the site of at least two previous structures dedicated to Finbarr of Cork The first dated from the 7th century, with works continuing through the 12th century. This building was damaged during the Siege of Cork (1690), and a new structure was built in 1735. " ;
String Point1BTxt = "The Current version from 1860 exceeded its initial budget of £15k, bringing the total cost to almost £100. The style of the building is Early French, Burges's favoured period. Burges oversaw all aspects of the design, including the architecture of the building, the statuary, the stained glass and the internal decoration. The result is \"undoubtedly Burges's greatest work in ecclesiastical architecture\"" ; 
String Point1CTxt = "Noteworthy features of its magnificent interior include stained glass windows depicting scenes from the Old and New Testaments, marble mosaics from the Pyrenees while the the sanctuary ceiling portrays Christ, surrounded by angels. The building contains more than 1,260 sculptures, a particularly ornate pulpit and even a 24-lb cannonball, a legacy of the Siege of Cork in 1690.";

// UpsideDown Point1
float UPoint1;

float UP1Mark = 0;
PImage UP1Marker;

Gif Point1Blue;

////////////////////////// POINT2
float Point2=0;
PShape Point2HintCircle; 
PImage Point2AImg;
PImage Point2BImg;
PImage Point2Grey;
float P2G = 0;

float P2Mark = 0;
PImage P2Marker;

Gif Point2Red;


String Point2ATxt = "Grand Parade was originally a channel of the River Lee. The original Hiberno-Norse settlement of Cork grew up on its west bank. By 1726, buildings had developed on the east bank, but the river channel remained in place. In a 1774 map, the northern portion of the street between Oliver Plunkett Street and Daunt Square had been reclaimed, but the southern portion was still a dock. Finally, by 1801, the river channel had completely disappeared and the street was fully present. The elevated doors can still be seen today on the buildings as a reminder of the old river." ;
String Point2BTxt = "The tram system was built by Cork Electric Tramways and Lighting Company in the 19th century throughout Cork. The ease of access to transport in Cork was detrimental to a boom in the cities infrastructure. The tram lines running through grand parade started in St. Patrick’s Street and ran to Douglas and Black Rock." ; 

// UpsideDown Point2
float UPoint2;

float UP2Mark = 0;
PImage UP2Marker;
Gif Point2Blue;

/////////////////////////////////////POINT3
float Point3=0;
PShape Point3HintCircle; 
PImage Point3AImg;
PImage Point3BImg;
PImage Point3CImg; 
float P3Mark= 0;
PImage P3Marker;
Gif Point3Red;

String Point3ATxt = "Philip de Barry invited the Dominicans to Cork in 1229 and the order built a church called St Mary's of the Isle. Some stones from the medieval church are set into the walls of the present Dominican priory on Pope's Quay. The foundation stone of the present St Mary's was laid in 1832 and on 20 October 1839 the church was officially opened" ;
String Point3BTxt = "Built in the first half of the nineteenth century, this church was designed by Cork architect Kearns Deane, and the portico was added by Deane and Woodward. The imposing scale of the building makes it a notable addition to the quayside, which is accentuated by the elevated position of the church" ; 
String Point3CTxt = "The fine interior is attributed to John Pyne Hurley, the baldacchino is attributed to Scannell of Cork, while the pulpit and high altar were designed by George Goldie and added in the 1880s. This church forms part of an interesting group of Roman Catholic buildings with the related priory buildings to the north." ; 

// UpsideDown Point3
float UPoint3;

float UP3Mark= 0;
PImage UP3Marker;
Gif Point3Blue;


///////////////////////////////POINT4
float Point4=0;
PShape Point4HintCircle; 
PImage Point4AImg;
PImage Point4BImg;
PImage Point4CImg; 
PImage Point4Grey;
float  P4Mark = 0;
PImage P4Marker;
float P4G = 0;
Gif Point4Red;

String Point4ATxt = "The centre of Cork city is built on marshy islands in the tidal estuary of the river Lee. Channels of the river originally separated these islands, and some of these channels were spanned in the eighteenth century to form the principal streets of Cork city centre. Among these is Saint Patrick's Street." ;
String Point4BTxt = "Parts of Patrick Street were extensively damaged during the Irish War of Independence in the \"Burning of Cork\". It followed an ambush by the IRA of a Briitish patrol in the city. The Black and Tans retaliated by setting fire to several buildings in the city. " ; 
String Point4CTxt = "There was substantial disruption to services and destruction of some tramcars during The Burning of Cork in December 1920. The events which occurred to the driver, John Hurley, conductor Alex Garvey and passengers on tramcar no 3 were recorded in the Cork Examiner:" ; 
String Point4DTxt = "Passengers by the last tram to St. Luke's Cross, which left the Statue at 9 p.m. on Saturday, had a rather eventful journey. The car had got about 60 or 70 yards beyond Empress Place police barracks when a number of men in police uniform, carrying carbines and accompanied by Auxiliaries in plain clothes, held it up. They ordered all the passengers off at the point of revolvers. Male passengers were somewhat roughly handled and then ordered to line up for search. Some few were inclined to run and a voice rang out: \"I'll shoot anyone who runs.\" All then stopped but some shots were fired in the air while the searches were being conducted. In some cases when the search was completed the person searched was ordered home, getting a bit of a rough send-off. The tramcar was then broken in by the police and a rifle shot was discharged, the smell of powder permeating the air. The tramcar was brought back to the Statue by the driver and conductor who when it neared there were ordered off. It was later set on fire and completely destroyed.";


// UpsideDown Point4
float UPoint4;

Gif Point4Blue;

float  UP4Mark = 0;
PImage UP4Marker;


///////////////////////////////////////POINT 5
float Point5=0;
PShape Point5HintCircle; 
PImage Point5AImg;
PImage Point5BImg;
Gif Point5Red;

float  P5Mark = 0;
PImage P5Marker;
float P5G = 0;

String Point5ATxt = "The Custom House was built in 1818 and was designed by the architect Abraham Hargrave. 1882 it became the headquarters of the Cork Harbour Commissioners, now known as the Port of Cork Company. Its elegant boardroom, where the meetings of the members of the company are held, was constructed in 1906." ;
String Point5BTxt = "It became known as the ‘new’ Custom House. Its main work dealt with inland revenue. In 1882 it became the headquarters of the Cork Harbour Commissioners. The old Custom House in Emmet Place is now part of the complex of buildings which houses the Crawford Municipal Art Gallery." ; 


// UpsideDown Point5
float UPoint5;

Gif Point5Blue;


float  UP5Mark = 0;
PImage UP5Marker;




PShape rectangle;
PShape Lsquare;
PShape Rsquare;


PShape TestCircle1;
PShape TestCircle2;
PShape TestCircle3;
PShape Whitespace;

PImage img;


PImage TheMap;

// GIFS
Gif BlueStart;
Gif RedStart;

  
float Map = 0;
float y = 0;


float g = 0;

// Vars for rotations
float UAngle;
float Angle;




void setup() {

 // GUI setup
  noCursor();
  size(displayWidth,displayHeight);
  
  noStroke();
  fill(255, 255, 255);
 
 
  
  
   BlueStart = new Gif(this, "T2SBlue.gif");
  BlueStart.loop();
  
  RedStart = new Gif(this, "T2SRed.gif");
  RedStart.loop();
  

  Point1Blue= new Gif(this, "FBBlue.gif");
  Point1Blue.play();
  
  Point1Red= new Gif(this, "FBRed.gif");
  Point1Red.play();
  
  
    Point2Red = new Gif(this, "GPred.gif");
  Point2Red.play();
  
  Point2Blue = new Gif(this, "GPblue.gif");
  Point2Blue.play();
  

  Point4Red= new Gif(this, "PSRed.gif");
  Point4Red.play();
  
  Point4Blue = new Gif(this, "PSBlue.gif");
  Point4Blue.play();
  

  rectangle = createShape(RECT,100,300,100,50);
  rectangle.setStroke(color(255));
  rectangle.setStrokeWeight(4);
  rectangle.setFill(color(127));
  
  // periodic updates
  if (!callback) {
    frameRate(60);
    loop();
  }  // or callback updates 
  
  font = createFont("Arial", 18);
  scale_factor = height/table_size; 
  
  // height stores the height of the display window that is set in the size() call
  
  // finally we create an instance of the TuioProcessing client
  // since we add "this" class as an argument the TuioProcessing class expects
  // an implementation of the TUIO callback methods in this class (see below)
  tuioClient  = new TuioProcessing(this);
  

  
 
  
   tint(255, 127);
  StandbyRect = createShape(RECT,0,0, displayWidth, displayHeight);
  StandbyRect.setFill(color(0,0,0));
  StandbyRect.setStroke(false);
  
  
  tint(255, 255);
  Whitespace = createShape(RECT, 0, 0, displayWidth, displayHeight);
  Whitespace.setFill(color(254,197,87));
  Whitespace.setStroke(false);

 // IMAGES FOR POINT1
 Point1AImg = loadImage("Point1AImg.jpg");
 Point1BImg = loadImage("Point1BImg.png");
 Point1CImg = loadImage("Point1CImg.png");
 
 TheMap = loadImage("Map.png");

 
 // IMAGES FOR POINT2
   Point2AImg = loadImage("Point2AImg.png");
   Point2BImg = loadImage("Point2AImg.png");
     
   
   Point2Grey = loadImage("Grey3.png");
   
   P2Marker = loadImage("RedMark.png");
   UP2Marker= loadImage("BlueMark.png");
   
 //IMAGES FOR POINT3
 Point3AImg = loadImage("Point3AImg.png");
 Point3BImg = loadImage("Point3BImg.png");
 Point3CImg = loadImage("Point3CImg.png");
 


 //IMAGES FOR POINT4
 Point4AImg = loadImage("Point4AImg.png");
 Point4BImg = loadImage("Point4BImg.png");
 Point4CImg = loadImage("Point4CImg.png");
 

 Point4Grey = loadImage("Grey3.png");
  
  //IMAGES FOR POINT5
 Point5AImg = loadImage("Point5AImg.png");
 Point5BImg = loadImage("Point5BImg.png");
  
  // CREATE A NEW SPOUT OBJECT HERE
  spout = new Spout();

  // INITIALIZE A SPOUT SENDER HERE
  spout.initSender("Spout Processing", width, height);
  
} 

void draw()  { 


  background(255);
  textFont(font,18*scale_factor);
  float obj_size = object_size*scale_factor; 
  float cur_size = cursor_size*scale_factor; 
  
  ///////////////////////////////////// BEGINNING
    if(Map==0){
    image(RedStart, 520, 450);
    image(BlueStart, 520, -30);
    }
    
 
  ////////////////////////// CITY MAP
    if(Map==1){
     
      shape(Whitespace, 0,0);
     
      TheMap.resize(700,700);
    image(TheMap, 300, 20);
   Point2Grey.resize(180, 180);
   Point4Grey.resize(180,180);
   tint(255, 200);
   if(P2G ==0){
   image(Point2Grey, 550, 400); }
   if(P4G==0){// grand parade
   image(Point4Grey, 700, 300);} // st. patricks
    tint(255, 255);
  }
  //////////////////////////////  Standy mode
  
  if (StandbyTimer <2500){StandbyTimer += 1;};
  
  if (StandbyTimer >= 2500){
    
  }
  
  ///////////////////////////////////////////////////// HINTS
  
 
 /*if (timer < 500 &&Map==1){timer += 1;};
   
   if(timer>=500){
     if(Point1Hint == false){
      shape(Point1HintCircle, 500, 100);}
      if(Point2Hint  == false){
    shape(Point2HintCircle, 600, 400);}
    if(Point3Hint == false){
    shape(Point3HintCircle, 800, 600);}
   }
  */
  if(y==1){
    img.resize(300, 150);
    image(img, 00, 100);
  }
  
  //////////////////////// POINT MEDIA
  
  
  // Point 1 St. Finbarre's
  if(Point1==1){
    if(fadein1A >= 0){fadein1A += 20;};
    tint(255, fadein1A);
    Point1AImg.resize(300, 150);
    image(Point1AImg, 0, 100);
    textSize(10);
    text(Point1ATxt, 10, 300, 300, 150);
    fill(0,0,0);
    tint(255, 255);
    fadeinB = 0;  
    
     image(Point1Red, 240, 450);
  }
  
    if(Point1==2){
    if(fadein1B >= 0){fadein1B += 20;};
    tint(255, fadein1B);
    Point1BImg.resize(300, 150);
    image(Point1BImg, 0, 100);
    textSize(10);
    text(Point1BTxt, 10, 300, 300, 150);
    fill(0,0,0);
    tint(255, 255);
     image(Point1Red, 240, 450);
  }
  
     if(Point1==3){
    if(fadein1C >= 0){fadein1C += 20;};
    tint(255, fadein1C);
    Point1CImg.resize(300, 150);
    image(Point1CImg, 0, 100);
    textSize(10);
    text(Point1CTxt, 10, 300, 300, 150);
    fill(0,0,0);
    tint(255, 255);
     image(Point1Red, 240, 450);
  }
  
  
  if(UPoint1==1){
    translate(1300,700);
      rotate(radians(180));
      
       if (Ufadein1A >= 0){Ufadein1A += 20;};
       tint(255, Ufadein1A);
    Point1AImg.resize(300,150);
    image(Point1AImg, 0, 100);
    fill(#000000, Ufadein1A);
    textSize(10);
    text(Point1ATxt, 10, 300, 300, 150);
    rotate(radians(-180));
 translate(-1300,-700);
 tint(255, 255);
    UfadeinB = 0;
    
      image(Point1Blue, 240, 450);
  }
  
   if(UPoint1==2){
    translate(1300,700);
      rotate(radians(180));
      
       if (Ufadein1B >= 0){Ufadein1B += 20;};
       tint(255, Ufadein1B);
    Point1BImg.resize(300,150);
    image(Point1BImg, 0, 100);
    fill(#000000, Ufadein1B);
    textSize(10);
    text(Point1BTxt, 10, 300, 300, 150);
    rotate(radians(-180));
 translate(-1300,-700);
 tint(255, 255);
  image(Point1Blue, 240, 450);
    
  }
  
   if(UPoint1==3){
    translate(1300,700);
      rotate(radians(180));
      
       if (Ufadein1C >= 0){Ufadein1C += 20;};
       tint(255, Ufadein1C);
    Point1CImg.resize(300,150);
    image(Point1CImg, 0, 100);
    fill(#000000, Ufadein1C);
    textSize(10);
    text(Point1CTxt, 10, 300, 300, 150);
    rotate(radians(-180));
 translate(-1300,-700);
 tint(255, 255);
     image(Point1Blue, 240, 450);
  }
  
  /////////////////////////// POINT 2
  
  if(P2Mark == 1){
  
   image (P2Marker, 550, 400); 
     P2Marker.resize(180,180);
    
  }
  
   if(UP2Mark == 1){
  
   image (UP2Marker, 550, 400); 
     UP2Marker.resize(180,180);
    
  }
  
  if(Point2==1){
    

    if (fadeinA >= 0){fadeinA += 20;};
  tint(255, fadeinA);
  Point2AImg.resize(300, 150);
  image(Point2AImg, 0, 100);
  fill(#000000, fadeinA);
  textSize(10);
  text( Point2ATxt, 10, 300, 300, 150); 
  fill(0, 0, 0);
  tint(255, 255);
  fadeinB=0;
 
  image(Point2Red, 490, 340);
  }
  
  if(Point2==2){
    
    if (fadeinB >= 0){fadeinB += 20;};
       tint(255, fadeinB);
    Point2BImg.resize(300, 150);
   image(Point2BImg, 0, 100);
     fill(#000000, fadeinB);
   textSize(10);
   text(Point2BTxt, 10, 300, 300, 300) ;
   tint(255, 255);
   image(Point2Red, 490, 340);
}

/////////////////////////////////// UPSIDE DOWN POINT 2
  if(UPoint2==1){
    image(Point2Blue, 490, 340);
 
     translate(1300,700);
      rotate(radians(180));
    if (UfadeinA >= 0){UfadeinA += 20;};
  tint(255, UfadeinA);
  Point2AImg.resize(300, 150);
  image(Point2AImg, -50, 100);
  fill(#000000, UfadeinA);
  textSize(10);
  text(Point2ATxt, -50, 300, 300, 150); 
  fill(0, 0, 0);
  tint(255, 255);
  UfadeinB=0;
   
   rotate(radians(-180));

     translate(-1300,-700);
     
      
  }
  
  if(UPoint2==2){
     
     translate(1300,700);
      rotate(radians(180));
    if (UfadeinB >= 0){UfadeinB += 20;};
       tint(255, UfadeinB);
    Point2BImg.resize(300, 150);
   image(Point2BImg, -50, 100);
     fill(#000000, UfadeinB);
   textSize(10);
   text(Point2BTxt, -50, 300, 300, 300) ;
   tint(255, 255);
   

      rotate(radians(-180));
     translate(-1300,-700);
        image(Point2Blue, 490, 340);
}


///////////////////// Point 4

 // Point 1 St. Finbarre's
  if(Point4==1){
    if(fadein4A >= 0){fadein4A += 20;};
    tint(255, fadein4A);
    Point4AImg.resize(300, 150);
    image(Point4AImg, 0, 100);
    textSize(10);
    text(Point4ATxt, 10, 300, 300, 150);
    fill(0,0,0);
    tint(255, 255);
    fadeinB = 0;  
    
     image(Point4Red, 700, 300);
  }
  
    if(Point4==2){
    if(fadein4B >= 0){fadein4B += 20;};
    tint(255, fadein1B);
    Point4BImg.resize(300, 150);
    image(Point4BImg, 0, 100);
    textSize(10);
    text(Point4BTxt, 10, 300, 300, 150);
    fill(0,0,0);
    tint(255, 255);
     image(Point4Red, 700, 300);
  }
  
     if(Point4==3){
    if(fadein4C >= 0){fadein4C += 20;};
    tint(255, fadein4C);
    Point4CImg.resize(300, 150);
    image(Point4CImg, 0, 100);
    textSize(10);
    text(Point4CTxt, 10, 300, 300, 150);
    fill(0,0,0);
    tint(255, 255);
     image(Point4Red, 700, 300);
  }
  
  
  if(UPoint4==1){
    translate(1300,700);
      rotate(radians(180));
      
       if (Ufadein4A >= 0){Ufadein4A += 20;};
       tint(255, Ufadein4A);
    Point4AImg.resize(300,150);
    image(Point4AImg, 0, 100);
    fill(#000000, Ufadein1A);
    textSize(10);
    text(Point4ATxt, 10, 300, 300, 150);
    rotate(radians(-180));
 translate(-1300,-700);
 tint(255, 255);
    UfadeinB = 0;
    
      image(Point4Blue, 700, 300);
  }
  
   if(UPoint4==2){
    translate(1300,700);
      rotate(radians(180));
      
       if (Ufadein4B >= 0){Ufadein4B += 20;};
       tint(255, Ufadein1B);
    Point4BImg.resize(300,150);
    image(Point4BImg, 0, 100);
    fill(#000000, Ufadein4B);
    textSize(10);
    text(Point4BTxt, 10, 300, 300, 150);
    rotate(radians(-180));
 translate(-1300,-700);
 tint(255, 255);
  image(Point4Blue, 700, 300);
    
  }
  
   if(UPoint4==3){
    translate(1300,700);
      rotate(radians(180));
      
       if (Ufadein4C >= 0){Ufadein4C += 20;};
       tint(255, Ufadein4C);
    Point1CImg.resize(300,150);
    image(Point4CImg, 0, 100);
    fill(#000000, Ufadein4C);
    textSize(10);
    text(Point4CTxt, 10, 300, 300, 150);
    rotate(radians(-180));
 translate(-1300,-700);
 tint(255, 255);
     image(Point4Blue, 700, 300);
  }
  

  
  ArrayList<TuioObject> tuioObjectList = tuioClient.getTuioObjectList();
  for (int i=0;i<tuioObjectList.size();i++) {
     TuioObject tobj = tuioObjectList.get(i);
     stroke(204, 122, 97);
     if(tobj.getSymbolID() ==8){
       stroke (135, 165, 214);
     }
     fill(255,255,255);
     pushMatrix();
     translate(tobj.getScreenX(width),tobj.getScreenY(height));
     rotate(tobj.getAngle());
     //rect(-obj_size/2,-obj_size/2,obj_size,obj_size);
         ellipse(-obj_size/2,-obj_size/2,100,100); // this changes the image that follows the fiducial to a white cirle, making it easier for the camera to see the fiducial
    // image(rot8, -obj_size/2, -obj_size/2); // this changes the image that follows the fiducial to a GIF
      
     popMatrix();
     //fill(255);
     //text(""+tobj.getSymbolID(), tobj.getScreenX(width), tobj.getScreenY(height));
     fill(0,0,0); 
   }
   
   ArrayList<TuioCursor> tuioCursorList = tuioClient.getTuioCursorList();
   for (int i=0;i<tuioCursorList.size();i++) {
      TuioCursor tcur = tuioCursorList.get(i);
      ArrayList<TuioPoint> pointList = tcur.getPath();
      
      if (pointList.size()>0) {
        stroke(0,0,255);
        TuioPoint start_point = pointList.get(0);
        for (int j=0;j<pointList.size();j++) {
           TuioPoint end_point = pointList.get(j);
           line(start_point.getScreenX(width),start_point.getScreenY(height),end_point.getScreenX(width),end_point.getScreenY(height));
           start_point = end_point;
        }
        
        stroke(192,192,192);
        fill(192,192,192);
        ellipse( tcur.getScreenX(width), tcur.getScreenY(height),cur_size,cur_size);
        fill(0);
        text(""+ tcur.getCursorID(),  tcur.getScreenX(width)-5,  tcur.getScreenY(height)+5);
      }
   }
   
  ArrayList<TuioBlob> tuioBlobList = tuioClient.getTuioBlobList();
  for (int i=0;i<tuioBlobList.size();i++) {
     TuioBlob tblb = tuioBlobList.get(i);
     stroke(0);
     fill(0);
     pushMatrix();
     translate(tblb.getScreenX(width),tblb.getScreenY(height));
     rotate(tblb.getAngle());
     ellipse(-1*tblb.getScreenWidth(width)/2,-1*tblb.getScreenHeight(height)/2, tblb.getScreenWidth(width), tblb.getScreenWidth(width));
     popMatrix();
     fill(255);
     text(""+tblb.getBlobID(), tblb.getScreenX(width), tblb.getScreenX(width));
   }
    
    // SEND A SHARED TEXTURE HERE
     spout.sendTexture();
  
}

// called when an object is added to the scene
void addTuioObject(TuioObject tobj) {
  if (verbose) println("add obj "+tobj.getSymbolID()+" ("+tobj.getSessionID()+") "+tobj.getX()+" "+tobj.getY()+" "+tobj.getAngle());
}

// called when an object is moved
void updateTuioObject (TuioObject tobj) {
   println("set obj "+tobj.getSymbolID()+" ("+tobj.getSessionID()+") "+" Angle=  "+tobj.getAngle()
          +"x=  " + tobj.getX()+ "Y=  " + tobj.getY() + "Timer = " + timer /*"Rspeed "+""+tobj.getRotationSpeed()+" "+"MAccell  "+""+tobj.getMotionAccel()+" "+"RAccel  "+""+tobj.getRotationAccel()*/);
          
          

//////////////////////////////////////START STUFF
          
 if(tobj.getX()>0.47&&tobj.getX()<0.5&&tobj.getY()>0.75&&tobj.getY()<0.8&&/*tobj.getRotationSpeed()>.30&&*/tobj.getSymbolID()==2  && Map==0){


Map=1;
}

 if(tobj.getX()>0.47&&tobj.getX()<0.5&&tobj.getY()>0.16&&tobj.getY()<0.217&&/*tobj.getRotationSpeed()>.30&&*/tobj.getSymbolID()==8 && Map==0){

Map =1;
}

///////////////////////////////////// MAP 1

if(Map==1&&tobj.getX()>0.35&&tobj.getX()<0.37&&tobj.getY()<.15&&tobj.getY()>.10&&tobj.getRotationSpeed()>.14&&tobj.getSymbolID()==12){
  y=1;
  Point1HintCircle.setFill(color(50, 0, 0));
;};

//----------------------------------------------------POINT 1
if(Map==1&&tobj.getX()>0.21&&tobj.getX()<0.30&&tobj.getY()<.82&&tobj.getY()>.7&&tobj.getSymbolID()==2){
 println("Upsidedown is a go. UPoint1=" + UPoint1);
 
  timer=0;
  Point1Hint = true;
  
  if(Point1<1){
  Angle = tobj.getAngle();
Point1=1;}

if (Angle+2 > 6.1){
  UPoint1=0;}
  
  if(tobj.getAngle()> UAngle + 1 && tobj.getAngle() < Angle + 2){
    Point1 = 2;
    fadein1A=0;
    fadein1C=0;}
    
    if(tobj.getAngle() > Angle + 2 ){
Point1=3;
fadein1B= 0;
}

if(Point1 > 1 && tobj.getAngle() < UAngle + 1 ){
 
  Point1=0;
  
}
    
}
//RESET Map
if(Map==1&&tobj.getSymbolID()==2&&(tobj.getX()<0.21||tobj.getX()>0.30||tobj.getY()>.82||tobj.getY()<.7)){
  Point1=0;
  fadein1A=0;
  fadein1B=0;
  fadein1C=0;
}


//----------------------------------------------------POINT 1 UPSIDE DOWN
if(Map==1&&tobj.getX()>0.21&&tobj.getX()<0.30&&tobj.getY()<.82&&tobj.getY()>.7&&tobj.getSymbolID()==8){
 println("Upsidedown is a go. UPoint1=" + UPoint1);
 
  timer=0;
  Point1Hint = true;
  
  if(UPoint1<1){
  UAngle = tobj.getAngle();
UPoint1=1;}

if (UAngle+2 > 6.1){
  UPoint1=0;}
  
  if(tobj.getAngle()> UAngle + 1 && tobj.getAngle() < UAngle + 2){
    UPoint1 = 2;
    Ufadein1A=0;
    Ufadein1C=0;}
    
    if(tobj.getAngle() > UAngle + 2 ){
UPoint1=3;
Ufadein1B= 0;
}

if(UPoint1 > 1 && tobj.getAngle() < UAngle + 1 ){
 
  UPoint1=0;
  
}
    
}
//RESET Map
if(Map==1&&tobj.getSymbolID()==8&&(tobj.getX()<0.21||tobj.getX()>0.30||tobj.getY()>.82||tobj.getY()<.7)){
  UPoint1=0;
  Ufadein1A=0;
  Ufadein1B=0;
  Ufadein1C=0;
}

//--------------------------------------------------------POINT2
if(Map==1&&tobj.getX()>0.42&&tobj.getX()<0.53&&tobj.getY()<.73&&tobj.getY()>.558&&tobj.getSymbolID()==2){
  println("angle of fiducial = " + tobj.getAngle());
  println("Angle TEST  " + Angle);
  timer=0;
 P2G = 1; 


  if(Point2<1){
  Angle = tobj.getAngle();
}
  Point2=1;
  



if (Angle+2 > 6.1){
  Point2=0;}

if( tobj.getAngle() >= Angle + 1 && tobj.getAngle() <= Angle + 2 ){
  
Point2=2; 
fadeinA = 0;
fadeinC = 0;
}


if(Point2 > 1 && tobj.getAngle() <= Angle + 1 ){
 
  Point2=0;
  
}


}

if(Map==1&&tobj.getSymbolID()==2&&(tobj.getX()<0.42||tobj.getX()>0.53||tobj.getY()>.73||tobj.getY()<.55)){
Point2=0;
fadeinA=0;
fadeinB=0;
fadeinC=0;
if(UP2Mark==0&& P2G >= 1&& UPoint2==0 ){
  P2Mark=1;
}
}


//-------------------------------------------------------- UPSIDE DOWN POINT2
if(Map==1&&tobj.getX()>0.42&&tobj.getX()<0.53&&tobj.getY()<.73&&tobj.getY()>.55&&tobj.getSymbolID()==8){
  println("angle of fiducial = " + tobj.getAngle());
  println("Angle TEST  " + Angle);
  timer=0;
 P2G = 1; 
 
  if(UPoint2<1){
  Angle = tobj.getAngle();
}
  UPoint2=1;
  



if (Angle+2 > 6.1){
  UPoint2=0;}

if( tobj.getAngle() >= Angle + 1 && tobj.getAngle() <= Angle + 2 ){
  
UPoint2=2; 
UfadeinA = 0;
UfadeinC = 0;
}


if(UPoint2 > 1 && tobj.getAngle() <= Angle + 1 ){
 
  UPoint2=0;
  
}


}

if(Map==1&&tobj.getSymbolID()==8&&(tobj.getX()<0.42||tobj.getX()>0.53||tobj.getY()>.73||tobj.getY()<.55)){
UPoint2=0;
UfadeinA=0;
UfadeinB=0;

if(P2Mark==0&& P2G >= 1 && Point2==0 ){
  UP2Mark=1;
}
}

//----------------------------------------------------POINT 4
if(Map==1&&tobj.getX()>0.52&&tobj.getX()<0.6&&tobj.getY()<.58&&tobj.getY()>.40&&tobj.getSymbolID()==2){
 println("Upsidedown is a go. UPoint1=" + UPoint4);
 
  timer=0;
  Point4Hint = true;
  
  if(Point4<1){
  Angle = tobj.getAngle();
Point4=1;}

if (Angle+2 > 6.1){
  UPoint4=0;}
  
  if(tobj.getAngle()> UAngle + 1 && tobj.getAngle() < Angle + 2){
    Point4 = 2;
    fadein4A=0;
    fadein4C=0;}
    
    if(tobj.getAngle() > Angle + 2 ){
Point4=3;
fadein4B= 0;
}

if(Point4> 1 && tobj.getAngle() < UAngle + 1 ){
 
  Point4=0;
  
}
    
}
//RESET Map
if(Map==1&&tobj.getSymbolID()==2&&(tobj.getX()<0.52||tobj.getX()>0.6||tobj.getY()>.58||tobj.getY()<.40)){
  Point4=0;
  fadein4A=0;
  fadein4B=0;
  fadein4C=0;
}


//----------------------------------------------------POINT 4 UPSIDE DOWN
if(Map==1&&tobj.getX()>0.52&&tobj.getX()<0.6&&tobj.getY()<.58&&tobj.getY()>.40&&tobj.getSymbolID()==8){
 println("Upsidedown is a go. UPoint1=" + UPoint1);
 
  timer=0;
  Point4Hint = true;
  
  if(UPoint4<1){
  UAngle = tobj.getAngle();
UPoint4=1;}

if (UAngle+2 > 6.1){
  UPoint4=0;}
  
  if(tobj.getAngle()> UAngle + 1 && tobj.getAngle() < UAngle + 2){
    UPoint4 = 2;
    Ufadein4A=0;
    Ufadein4C=0;}
    
    if(tobj.getAngle() > UAngle + 2 ){
UPoint4=3;
Ufadein4B= 0;
}

if(UPoint4 > 1 && tobj.getAngle() < UAngle + 1 ){
 
  UPoint4=0;
  
}
    
}
//RESET Map
if(Map==1&&tobj.getSymbolID()==8&&(tobj.getX()<0.52||tobj.getX()>0.6||tobj.getY()>.58||tobj.getY()<.40)){
  UPoint4=0;
  Ufadein4A=0;
  Ufadein4B=0;
  spout.sendTexture();Ufadein4C=0;
}

    
  

}


// we have to think about how rotating will change media? The angle cant be used because the fiducial cold be at any angle when it interacts
// Has to be the change in angle. I could set a function to get the fiducials angle when it comes into contact with an interaction point
// Store that angle in a var and change media when the changed angle is a certain amount of degrees bigger than the var 
  
//In order to differentiate who sees what media at what angles, maybe when they do the first twist, I can assign that fiducial an id or variable, 
//and then use the co-ordinates and rotation of that variable to activate media


// called when an object is removed from the scene
void removeTuioObject(TuioObject tobj) {
  if (verbose) println("del obj "+tobj.getSymbolID()+" ("+tobj.getSessionID()+")");
}

// --------------------------------------------------------------
// called when a cursor is added to the scene
void addTuioCursor(TuioCursor tcur) {
  if (verbose) println("add cur "+tcur.getCursorID()+" ("+tcur.getSessionID()+ ") " +tcur.getX()+" "+tcur.getY());
  //redraw();
}

// called when a cursor is moved
void updateTuioCursor (TuioCursor tcur) {
  if (verbose) println("set cur "+tcur.getCursorID()+" ("+tcur.getSessionID()+ ") " +tcur.getX()+" "+tcur.getY()
          +" "+tcur.getMotionSpeed()+" "+tcur.getMotionAccel());
  //redraw();
}

// called when a cursor is removed from the scene
void removeTuioCursor(TuioCursor tcur) {
  if (verbose) println("del cur "+tcur.getCursorID()+" ("+tcur.getSessionID()+")");
  //redraw()
}

// --------------------------------------------------------------
// called when a blob is added to the scene
void addTuioBlob(TuioBlob tblb) {
  if (verbose) println("add blb "+tblb.getBlobID()+" ("+tblb.getSessionID()+") "+tblb.getX()+" "+tblb.getY()+" "+tblb.getAngle()+" "+tblb.getWidth()+" "+tblb.getHeight()+" "+tblb.getArea());
  //redraw();
}

// called when a blob is moved
void updateTuioBlob (TuioBlob tblb) {
  if (verbose) println("set blb "+tblb.getBlobID()+" ("+tblb.getSessionID()+") "+tblb.getX()+" "+tblb.getY()+" "+tblb.getAngle()+" "+tblb.getWidth()+" "+tblb.getHeight()+" "+tblb.getArea()
          +" "+tblb.getMotionSpeed()+" "+tblb.getRotationSpeed()+" "+tblb.getMotionAccel()+" "+tblb.getRotationAccel());
  //redraw()
}

// called when a blob is removed from the scene
void removeTuioBlob(TuioBlob tblb) {
  if (verbose) println("del blb "+tblb.getBlobID()+" ("+tblb.getSessionID()+")");
  //redraw()
}

// --------------------------------------------------------------
// called at the end of each TUIO frame
void refresh(TuioTime frameTime) {
  if (verbose) println("frame #"+frameTime.getFrameID()+" ("+frameTime.getTotalMilliseconds()+")");
  if (callback) redraw();
  
  
}

Joris
Posts: 5186
Joined: Fri May 22, 2009 11:38

Re: "Cannot cast from float to PGraphicsOpenGL"

Post by Joris »

I'd post this in the Spout forum: http://spout.zeal.co/forums/forum/spout/

Zoltán
Team Resolume
Posts: 7603
Joined: Thu Jan 09, 2014 13:08
Location: Székesfehérvár, Hungary

Re: "Cannot cast from float to PGraphicsOpenGL"

Post by Zoltán »

or at least give the line number you get the error at?
stack trace?
Software developer, Sound Engineer,
Control Your show with ”Enter” - multiple Resolume servers at once - SMPTE/MTC column launch
try for free: http://programs.palffyzoltan.hu

Post Reply