Login  Register

Re: Drawing problem when height > width

Posted by Wade Walker on Jan 28, 2011; 10:34pm
URL: https://forum.jogamp.org/Drawing-problem-when-height-width-tp2361172p2368252.html

Your problem could be due to integer division. In this line

glu.gluPerspective(45, width / height, 1, 50000);

if width = 199 and height = 200, then width / height = 0 by integer division. You should do something like this:

glu.gluPerspective(45, ((double)width) / ((double)height), 1, 50000);

Technically only one double cast is needed, because Java will auto-promote the other one