FAQ
Cover
\
Build
\
Source
\
Bugs
\
Reference
\
Libraries
\
Tools
The bugs database has moved
here
.
Bug 642 : width and height are both 0; after use of size()
Last modified: 2007-10-18 05:47
P
roject:
processing
trash
Version:
unspecified
Co
m
ponent:
android
book
core
libraries
pde
reference
tools
web
Status:
RESOLVED
Resolution:
FIXED -
Pr
i
ority:
P1
Severity:
normal
Platform
All
O
S:
All
Windows
Mac OS
Linux
Other
Reporter:
munkel
Assigned To:
fry
Attachment
Type
Created
Size
Actions
Description
: Opened: 2007-10-17 04:28
revision 0128
problem exists on mac and pc version
after setting the size for the applet both systemvariables width and height
have the value 0, when called in the same scope.
void setup()
{
size (800, 600);
println("width: "+ width+" height: " +height);
noLoop();
}
void draw()
{
println("width: "+ width+" height: " +height);
}
OUTPUT:
width: 0 height: 0
width: 200 height: 600
Additional Comment
#1 From fry 2007-10-17 05:17
does the window change to the correct size, however?
Additional Comment
#2 From fry 2007-10-17 05:23
also, what sort of system are you running? for the machines you tested on,
are they single processor, dual core, multiple processors, etc?
i can't reproduce this behavior on my machine but it's just the sort of
problem i was concerned about showing up with this release.
Additional Comment
#3 From munkel 2007-10-17 06:15
yes, window size does change to the correct dimensions.
i'm using a intel T2500 dual core processor under WinXP pro.
unfortunately the mac, where i saw the same bug is no longer available to me.
Additional Comment
#4 From munkel 2007-10-17 06:20
java version 1.6.0
Additional Comment
#5 From fry 2007-10-17 06:29
can you add a println(g.width + " " + g.height) to the same two locations
and see what it produces?
also, your second line, does it really say 200 for the width? or is it 800?
any idea where it's getting that?
Additional Comment
#6 From munkel 2007-10-17 06:38
yes the object g has the correct properties:
void setup()
{
size (800, 600);
println("width: "+ width+" height: " +height);
println(g.width + " " + g.height);
noLoop();
}
void draw()
{
println("width: "+ width+" height: " +height);
println(g.width + " " + g.height);
}
OUTPUT:
width: 0 height: 0
800 600
width: 800 height: 600
800 600
sorry, the output in my first comment was copy/paste mistake.
i took the ouput from an applet with size(200,600);
Additional Comment
#7 From coeyes 2007-10-18 00:25
in revesion 0128,
I have same problem using width,height in setup() method.
here are some cases:
1. just size(640,480) ---> w:0 h:0
2. just size(640,480,P3D) ---> w:0 h:0
3. import processing.opengl.*; and size(640,480) ----> w:100 h:100 (this one is very
weird...)
4. import processing.opengl.*; and size(640,480,OPENGL) -----> w:640 h:480
5. import processing.opengl.*; and size(640,480,P3D) -----> w:640 h:480
this problem is represented in both win and mac except case #3.
in mac, case #3 produce w:100 h:480 (how weird...)
g.width, g.height works correctly.
Additional Comment
#8 From fry 2007-10-18 05:47
fixed for 0129.