sebo-katsura
YaBB Newbies
Offline
Posts: 5
Links in OpenGL
Dec 30th , 2007, 4:19pm
Hi Guys. I need your help. I want create links on my PImages. The problem is that the coordinates of the PImages change with the X and Y Rotation. I have no idea. Thank you for your help! Here the online example: http://www.sebastiankatsura.com/ And here's the code: import processing.opengl.*; float a_rotspeed; float b_rotspeed; PImage brille,sebo,ikarus,shishi; void setup(){ brille = loadImage("brille.png"); sebo = loadImage("sebo.jpg"); ikarus = loadImage("ikarus1.gif"); shishi = loadImage("shishi.gif"); size(500,500,OPENGL); background(255); frameRate(130); } //BILDER----------------------------------------------------- void brille(){ pushMatrix(); image(brille,0,0); translate(0,0,0); popMatrix(); } void sebo(){ pushMatrix(); translate(100,0,-10); rotateY(PI/2); image(sebo,0,0); popMatrix(); } void ikarus(){ pushMatrix(); translate(20,-50,-150); rotateY(PI/-2); //rotateX(PI); image(ikarus,0,0); popMatrix(); } void shishi(){ //rotateX(PI); //rotateY(PI); //rotateZ(PI/2); pushMatrix(); translate(-120,-50,10); image(shishi,0,0); popMatrix(); } //------------------------------------------------- void draw(){ noFill(); background(255); //ANFANG BOX UND BEWEGUNG--------------------- pushMatrix(); translate(width/2,height/2); rotateX(a_rotspeed); rotateY(b_rotspeed); stroke(150,80); box(250); //ENDE BOX UND BEWEGUNG----------------------- brille(); sebo(); ikarus(); shishi(); popMatrix(); if (mouseX<100&&mouseY>100&&mouseY<400){ b_rotspeed-=0.03; } else if (mouseX>400&&mouseY>100&&mouseY<400){ b_rotspeed+=0.03; } if (mouseX>100&&mouseX<400&&mouseY<100){ a_rotspeed+=0.03; } else if (mouseX>100&&mouseX<400&&mouseY>400){ a_rotspeed-=0.03; } }