Bug 268 : P3D images are distorted under rotations while OPENGL images are not.
Last modified: 2006-01-04 11:32




Status:
RESOLVED
Resolution:
DUPLICATE of bug 103
Priority:
P2
Severity:
normal

 

Reporter:
backspaces
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2006-01-03 13:15
The following script results in different rendering during rotations depending on whether or
not the size() procedure is called with P3D or OPENGL.

The script imports an image, then lets the user rotate around the x & y axes by clicking and
dragging. A box is drown at 0,0 as a reference. When run with "wintype" set to P3D, the
image stretches and warps during rotations, and the box moves to different parts of the
image rather than staying at 0,0.

When wintype is set to OPENGL, the problem goes away.

import processing.opengl.*;

PImage img;
String wintype = P3D; // OPENGL or P3D

void setup() {
img = loadImage("http://iwin.nws.noaa.gov/iwin/images/ecir.jpg");
size(int(img.width*1.5), int(img.height*1.5), wintype); // OPENGL or P3D
framerate(15);
drawScene(0,0);
}

void draw() {
if (mousePressed) {
drawScene((mouseY - height/2)*.01,(mouseX - width/2)*.01);
}
}
void drawScene(float xrot, float yrot) {
background(0);
translate(width/2, height/2);
rotateX(xrot);
rotateY(yrot);
image(img, -img.width/2, -img.height/2);
box(20,20,40);
}
Additional Comment #1 From fry 2006-01-04 11:32


*** This bug has been marked as a duplicate of 103 ***