FAQ
Cover
\
Build
\
Source
\
Bugs
\
Reference
\
Libraries
\
Tools
The bugs database has moved
here
.
Bug 594 : offscreen buffers fail with texture mapping
Last modified: 2007-10-10 12:26
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:
hevonen
Assigned To:
fry
Attachment
Type
Created
Size
Actions
Description
: Opened: 2007-07-11 07:57
Offscreen buffers don't do texturemapping at all and I haven't found
workaround yet. Example code is below:
---
PGraphics warpbuffer;
size(500, 500, P3D);
warpbuffer = createGraphics(500, 500, P3D);
PImage tmptexture = createImage(100,100,RGB);
for(int i = 0; i < tmptexture.pixels.length; i++) {
tmptexture.pixels[i] = color(random(0,255));
}
beginShape();
textureMode(NORMALIZED);
texture(tmptexture);
vertex(20, 10, 0, 0);
vertex(200, 20, 1, 0);
vertex(190, 210, 1, 1);
vertex(10, 200, 0, 1);
endShape();
warpbuffer.beginDraw();
warpbuffer.beginShape();
warpbuffer.textureMode(NORMALIZED);
warpbuffer.texture(tmptexture);
warpbuffer.vertex(20, 10, 0, 0);
warpbuffer.vertex(200, 20, 1, 0);
warpbuffer.vertex(190, 210, 1, 1);
warpbuffer.vertex(10, 200, 0, 1);
warpbuffer.endShape();
warpbuffer.endDraw();
image(warpbuffer,200,200);
Additional Comment
#1 From fry 2007-07-11 13:25
this is a dupe of some other stuff, but provides a helpful example for
tracking down the issue. the problem is that the alpha channel of the
shapes that are drawn is not being set properly. you can actually add the
following to the code and it'll work:
for (int i = 0; i < warpbuffer.pixels.length; i++) {
warpbuffer.pixels[i] |= 0xFF000000;
}
this will simply set the warpbuffer to be completely opaque, and show the
image.
Additional Comment
#2 From hevonen 2007-07-11 14:58
(In reply to
comment #1
)
> this will simply set the warpbuffer to be completely opaque, and show the
> image.
Ohhoh, thanks! I didn't know it was about alpha.
Additional Comment
#3 From fry 2007-10-10 12:26
fixed for 0127. this should also fix a number of other problems with
createGraphics().