Hello,
I was wondering if someone might be able to help me figure out what's going on here.
I'm just making a quad and texturing it - very simple. Works fine until I rotate the quad then everything goes awry.
Try the following code (just replace the jpg with something else - anything will work but a grid gives you a clearer idea that bad things are happening). See what happens when you comment out the rotation and then put it back again.
Ideas anyone?
Quote:float cx, cy, wd, ht;
PGraphics pg;
PImage img;
void setup()
{
size( 500, 500, P3D );
pg = createGraphics( width, height, P3D );
img = loadImage( "uvtemplate001-lg.jpg" );
cx = width/2;
cy = height/2;
wd = 120.0f;
ht = 120.0f;
}
void draw()
{
pg.beginDraw();
pg.background( 128, 32 );
pg.translate( cx, cy, 0.0f );
pg.rotateX( 45 );
pg.textureMode( NORMALIZED );
pg.beginShape(QUADS);
pg.texture( img );
pg.vertex( - wd, - ht, 0.0f, 0, 0 );
pg.vertex( wd, - ht, 0.0f, 1, 0 );
pg.vertex( wd, ht, 0.0f, 1, 1 );
pg.vertex( - wd, ht, 0.0f, 0, 1 );
pg.endShape();
pg.endDraw();
image( pg, 0, 0 );
}
NOTE: the graphics context makes no difference - if you did this without the pg. it still doesn't work...