We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Problems passing PImage as type in function
Page Index Toggle Pages: 1
Problems passing PImage as type in function (Read 862 times)
Problems passing PImage as type in function
Jun 1st, 2005, 5:00am
 
Hi. Im having an odd issue. Im trying to pass a PImage variable to a function, but am getting this error under OS X:

net.java.games.jogl.GLException: java.lang.reflect.InvocationTargetException

Here is a code sample. Am I simply 'typing' incorrectly?

PImage a,b,c,d;
setup()
{
a = loadImage("http://127.0.0.1/sharecms/multimedia//admin/5.24.05/DSC00150/thumb/sm_DSC00150.JPG");
 b = loadImage("http://127.0.0.1/sharecms/multimedia//admin/5.24.05/DSC00150/thumb/sm_DSC00149.JPG");
 c = loadImage("http://127.0.0.1/sharecms/multimedia//admin/5.24.05/DSC00150/thumb/sm_DSC00148.JPG");
 d = loadImage("http://127.0.0.1/sharecms/multimedia//admin/5.24.05/DSC00150/thumb/sm_DSC00147.JPG");
}

draw()
{
pushMatrix();
  drawNode("event1", -200, a);
popMatrix();

pushMatrix();
  drawNode("event2", -100, b);
popMatrix();

pushMatrix();
  drawNode("event3", -50, c);
popMatrix();

pushMatrix();
  drawNode("event4", 250, d);
popMatrix();
}

void drawNode(String text, int offset, PImage textureImage) // Here is my issue ?
{
 beginShape(LINES);
    vertex(offset, 100, 0);
    vertex(offset, -100, 0);
    vertex(offset, 0, 100);
    vertex(offset, 0,-100);
 endShape();


 noStroke();

 beginShape(QUADS);
   texture(textureImage);
   vertex(offset, 5, 5, 0, 0);
   vertex(offset, 39, 5, 0, 43);
   vertex(offset, 39, 53, 43,58);
   vertex(offset, 5, 53, 43,0);
 endShape();
 stroke(80, 80, 80,100);
 fill(80,80,80,200);
 rotateY(radians(90));
 text(text, 0,0,offset);
 textFont(displayFont, 10); // reset font size..

}
Re: Problems passing PImage as type in function
Reply #1 - Jun 1st, 2005, 7:03am
 
I tried this code, and I don't get any errors: (P0090 Windows XP)
Maybe its another part of your code thats generating the error?
Code:
PImage a, b, c, d; 
PFont displayFont;
void setup() {
size(400, 400, P3D);
a = loadImage("http://localhost/mkv25/graphics/a.jpg");
b = loadImage("http://localhost/mkv25/graphics/b.jpg");
c = loadImage("http://localhost/mkv25/graphics/c.jpg");
d = loadImage("http://localhost/mkv25/graphics/d.jpg");
displayFont = loadFont("AcknowledgeTT-BRK--48.vlw");
textFont(displayFont, 10);
}

void draw() {
pushMatrix();
drawNode("event1", -200, a);
popMatrix();

pushMatrix();
drawNode("event2", -100, b);
popMatrix();

pushMatrix();
drawNode("event3", -50, c);
popMatrix();

pushMatrix();
drawNode("event4", 250, d);
popMatrix();
}

void drawNode(String text, int offset, PImage textureImage) // Here is my issue ?
{
beginShape(LINES);
vertex(offset, 100, 0);
vertex(offset, -100, 0);
vertex(offset, 0, 100);
vertex(offset, 0,-100);
endShape();

noStroke();

beginShape(QUADS);
texture(textureImage);
vertex(offset, 5, 5, 0, 0);
vertex(offset, 39, 5, 0, 43);
vertex(offset, 39, 53, 43, 58);
vertex(offset, 5, 53, 43,0);
endShape();
stroke(80, 80, 80,100);
fill(80,80,80,200);
rotateY(radians(90));
text(text, 0,0,offset);
textFont(displayFont, 10); // reset font size..

}
Re: Problems passing PImage as type in function
Reply #2 - Jun 1st, 2005, 7:08am
 
Yeah, I just figured it out. Im a total ass. My crappity smacking URL was bad. (Note the Encapsulating folder names.. *mutter*). At least once this is hooked up to mysql I wont have issues like that Cheesy

I really,really, really.. wish I had a time machine so I could smack the shit out of myself.

Thanks. That was awefully confusing. Everything is happy now.
Page Index Toggle Pages: 1