texture() and vertex() error
in
Programming Questions
•
3 years ago
Hi all,
Getting this error: "You must first call texture() before using u and v coordinates with vertex()".
I'm calling it in the correct order as seen in example after example. I've looked at the old post
here. I've verified all the suggestions in the old forum as correct.
Does anyone have any new suggestions for fixing this issue? Is it a PImage problem? This is driving me crazy...
Thanks,
Max
edit:
sorry i guess i should have done this first... I'm using OPENGL. The image is fairly large - 646KB and takes a second to load. I'm not getting the "can't find image" error either.
PImage texmap;
void setup(){
...
texmap = loadImage("srtm_ramp2.world.5400x2700.jpg");
...
}
...
void drawPlane() {
noStroke();
noFill();
textureMode(NORMALIZED);
beginShape();
texture(texmap);
vertex(-xdim/2, -ydim/2,0,0,0);
vertex(xdim/2, -ydim/2,0,5400,0);
vertex(xdim/2, ydim/2,0,2700, 5400);
vertex(-xdim/2, ydim/2,0, 0,2700);
endShape(CLOSE);
}
It's a fairly large sketch so I don't want to post the whole thing.
1