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 › Help with Texturing
Page Index Toggle Pages: 1
Help with Texturing (Read 511 times)
Help with Texturing
Feb 17th, 2006, 8:47am
 
Sorry if this is a stupid question but I'm still very new at this and have no idea what I'm doing.

I'm trying to apply a texture to a shape I've created. If I load up the code right off the site it works fine.


noStroke();
PImage a = loadImage("myimage.jpg");
textureMode(NORMALIZED);
beginShape();
texture(a);
vertex(10, 20, 0, 0);
vertex(80, 5, 1, 0);
vertex(95, 90, 1, 1);
vertex(40, 95, 0, 1);
endShape();

But if I try and put it into code that loops I just get a black screen. It seems like it should work the same, but it's not. What am I doing wrong?

PImage myimage;

void setup(){
 size(300, 300, P3D);
 noCursor();
 noStroke();
 noFill();
 noLoop();
 textureMode(NORMALIZED);
 myimage = loadImage("myimage.gif");
}

void draw(){
 background(0);

 beginShape(QUADS);
 texture(myimage);
 vertex(10, 20, 0, 0, 0);
 vertex(80, 5, 0, 1, 0);
 vertex(95, 90, 0, 1, 1);
 vertex(40, 95, 0, 0, 1);
 endShape();
}
Re: Help with Texturing
Reply #1 - Feb 17th, 2006, 9:14am
 
Take out noFill() and noLoop()

I know nothing about texturing either but it seems to work.
Page Index Toggle Pages: 1