FAQ
Cover
\
Build
\
Source
\
Bugs
\
Reference
\
Libraries
\
Tools
The bugs database has moved
here
.
Bug 1137 : blend() dy coordinate inversion when using OpenGL
Last modified: 2009-02-21 11:19
P
roject:
processing
trash
Version:
unspecified
Co
m
ponent:
android
book
core
libraries
pde
reference
tools
web
Status:
RESOLVED
Resolution:
FIXED -
Pr
i
ority:
P2
Severity:
normal
Platform
All
O
S:
All
Windows
Mac OS
Linux
Other
Reporter:
jjguy
Assigned To:
fry
Attachment
Type
Created
Size
Actions
Screenshot of attached pde; minimal example (4 blend()'s)
image/png
2009-01-25 06:50
32.27 KB
Minimal example (but with 4 blend()'s)
text/plain
2009-01-25 06:51
1.24 KB
Description
: Opened: 2009-01-25 06:45
When using blend() to display an image with OPENGL rendering mode, the y coordinate of the
new image "flips" back and forth between the correct dy, and height-(dy).
For example, in the code below Image "A" appears about where expected -- upper left corner at
(0, 0) with bottom right at (50, 50).
Image "B" however, appears with the y coordinate flipped: the upper left corner is at (0, 500)
(i.e., height-100) with the bottom at (100, 600).
If there were additional blend() directives, the third image would be correct, while the fourth
would again have dy "flipped".
If the render mode is changed to P3D or JAVA2D the behavior is as expected.
I am running Processing 0154 on Max OSX 10.5.6. In the post linked [1], PhiLho reported the
same behavior on Windows XPSP3 with Processing 1.0.1, 0154 and 0135.
import processing.opengl.*;
import javax.media.opengl.*;
PImage img;
void setup() {
size(600,600, OPENGL);
img = createImage(10, 10, RGB);
float md = 0.5*sqrt(sq(img.width/2)+sq(img.height/2));
for (int x = 0; x < img.width; x++) {
for (int y = 0; y < img.height; y++) {
float d = sqrt(sq(x-img.width/2)+sq(y-img.height/2));
img.set(x ,y , color(0, 128-128*d/md, 0));
}
}
}
void draw()
{
background(0);
// image "A" -- smaller
blend(img,
0, 0,
img.width, img.height,
0, 0, //x & y of new image
50, 50, //width & height of new image
ADD);
// image "B" - larger
blend(img,
0, 0,
img.width, img.height,
0, 0, //x & y of new image
100, 100, //width & height of new image
ADD);
}
[1]
http://processing.org/discourse/yabb_beta/YaBB.cgi
?
board=Syntax;action=display;num=1232839894
Additional Comment
#1 From jjguy 2009-01-25 06:50
edit
]
Screenshot of attached pde; minimal example (4 blend()'s)
Additional Comment
#2 From jjguy 2009-01-25 06:51
edit
]
Minimal example (but with 4 blend()'s)
Additional Comment
#3 From fry 2009-02-21 11:19
Found and fixed for 1.0.2, thanks for the report & the example.