Help! Why does this simple math return 0.0?
in
Android Processing
•
1 month ago
So I've struck upon a problem I can't fathom. I'm writing a sketch that draws to an off-screen OPENGL buffer and then resizes that buffer to display at the correct resolution.
Excerpt:
void setup() {
//doing stuff
appFrameBuffer = createGraphics(1280, 800, OPENGL);
dispWidth = appFrameBuffer.width * (height / appFrameBuffer.height);
}
void drawFrame() {
//drawing to buffer
imageMode(CENTER);
image(appFrameBuffer, width/2, height/2, dispWidth, height);
}
The variable dispWidth always gets filled with 0.0 even if I use real ints instead of vars.
Can anyone offer a suggestion?
Excerpt:
void setup() {
//doing stuff
appFrameBuffer = createGraphics(1280, 800, OPENGL);
dispWidth = appFrameBuffer.width * (height / appFrameBuffer.height);
}
void drawFrame() {
//drawing to buffer
imageMode(CENTER);
image(appFrameBuffer, width/2, height/2, dispWidth, height);
}
The variable dispWidth always gets filled with 0.0 even if I use real ints instead of vars.
Can anyone offer a suggestion?
1