We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › Text corrupted on resize
Page Index Toggle Pages: 1
Text corrupted on resize (Read 878 times)
Text corrupted on resize
Jul 18th, 2009, 11:00am
 
Hi all,

I am having a problem with text becoming filled in rectangles whenever the window is resized. Other graphics are ok. I am using processing 1.0.5.

I have tried multiple computers and multiple code. I found another post with a different issue, and tried their example code below and it does the same thing. Anyone else have the same problem? Is there a workaround or am I doing something wrong?

Thanks


Code:
import javax.media.opengl.*;
import processing.opengl.*;

void setup() {
size(310,310,OPENGL);
PFont myFont = createFont("Sans", 16);
textFont(myFont);
frame.setResizable(true);
}

void draw() {

background(10);
stroke(153);
noFill();
rect(1,1,width-3,height-3);
fill(150);
for (int i=0;i<width;i+=10) {
int h;
if (i % 100 == 0) h = 20;
else if (i % 50 == 0) h = 10;
else h = 5;
line(i,10,i,h+10);
}
for (int i=0;i<width;i+=100) {
if (i==0) textAlign(LEFT);
else textAlign(CENTER);
text(""+i,i,30);
}
textAlign(RIGHT);
text("Current Size = "+width+"x"+height,width-15,height-20);
}
Re: Text corrupted on resize
Reply #1 - Jul 18th, 2009, 11:04am
 
I forgot to mention, it works fine with JAVA2d and P2D, it is only when I switch to opengl does the text become corrupted.
Re: Text corrupted on resize
Reply #2 - Jul 18th, 2009, 1:31pm
 
you could try
Code:
textMode(SCREEN); 



or expriment with the other text modes (look in the http://processing.org/reference/textMode_.html reference)
Page Index Toggle Pages: 1