concordiaCS
YaBB Newbies
Offline
Posts: 4
PImage Problem
Oct 25th , 2006, 10:31pm
Hi Hope I am posting in the correct thread - I am trying to include an image that will displayed constantly in the same location for the entire period of use of the applet. On setup the title displays, once the applet enters the draw routine, I can no longer see the title. Because of the background() (which I need). Further more, when I disable the background(), my title has been traslated and scaled to another area of the display and is affected by the what is done in drawTitleImg.drawC(); http://www.swpspce.net/c.png <- illustrates what I would like to achieve. http://www.swpspce.net/a.png <- illustrates my current problem thanks in advance for any assistance angelo private DrawHeader drawTitleImg; private PImage guiTitleImg; void setup() { size(800, 600, OPENGL); guiTitleImg = loadImage("titleBC.gif"); image(guiTitleImg, 10, 10); noStroke(); rect(10,72,340,240); drawTitleImg = new DrawHeader(); } void draw() { drawTitleImg.drawC(); pushMatrix(); translate(0,0,0); image(guiTitleImg, 10, 10); noStroke(); rect(360,72,430,430); rect(10,72,340,240); popMatrix(); } private class DrawHeader { private PImage guiTitleImg; public DrawHeader() { } public void drawC() { //background(0,153,255); float cameraY = height/2.0; //float fov = mouseX/float(width) * PI/2; float fov = PI/2; float cameraZ = cameraY / tan(fov / 2.0); float aspect = float(width)/float(height); perspective(fov, aspect, cameraZ/10.0, cameraZ*10.0); pushMatrix(); translate(width/2, height/2, 0); rotateX(-TWO_PI/6); rotateY(TWO_PI/3 + mouseX/float(height) * TWO_PI); rotateZ(TWO_PI/3 + mouseY/float(height) * TWO_PI); fill(#0066AA, 255); stroke(#0066FF, 125); box(100); translate(0, 0, 0); rotateX(-TWO_PI/6); rotateY(TWO_PI/3 + mouseX/float(width) * TWO_PI); rotateZ(TWO_PI/3 + mouseY/float(height) * TWO_PI); fill(#0066AA, 125); stroke(#0066FF, 125); box(100); popMatrix(); } } //End drawHeader