We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm trying to simulate a card being flipped with some text on it. nothing shows with text() using P3D or OPENGL. I read that I might need to add a text to the data file. how do I do this? where do I copy it from?
float angle = 0;
void setup() {
size(500,500,P3D);
camera(400,-200,700,
0,0,0,
0,1,0);
text("Hey", 20,60,-10);
}
void draw() {
if (angle < 3) {
angle =angle +0.1;
fill(150,150,150);
background(255);
rectMode(CORNER);
rotateY(angle);
box(150,350,2);
textSize(30);
color(255,0,0);
text("Hey", 20,60,-10);
delay(100);
println(angle);
if (angle >= 2.9){ angle =0;}
}
}
Comments
Actually, I think your 3D code is fine. the problem is that you're not settling the text color correctly. The color() function just returns a color, it doesn't set the display color for text. You need to call fill() for that. When I make that one change, your text starts to show up for me. It might not have exactly the relationship to the plane that you think it should, though. I might think about using a PGraphics object to draw both the rectangle and the text and then rotating that in 3D to make things simpler.
You are correct on both points. Text now shows and it will not give the effect I was looking for. Thanks sorry about the code formatting. I will look at PGraphics
How can I only show the text on one side of the card after it is flipped?
How about 2 PImages for front & back.
Then decide which 1 to display based on current angle? :-\"
The sketch opens but nothing show up regardless of whether I click the mouse or hit a key. If I change a fill parameter say #FF0000 to #C700FF , I get an error message Could not run the sketch (Target VM failed to initialize). For more information, read revisions.txt and Help ? Troubleshooting.
Perhaps a SMOOTH = 8 is too high for your system! (O_O) Lower that and try again. :D
Anyways, I've posted an adapted version of it online. Check it out: (^_^)
http://studio.processingtogether.com/sp/pad/export/ro.9oKy5N3D6zFZT/latest
I tried with SMOOTH = 6,4,2 and with reduced frame rate with no success. I think it is a computer software issue. Here is the complete output.
for Java