   GLdouble to int?
  hi, What is the best way to round a GLdouble down and convert it to an int?I have tried using floor() but it doesnt seem to work...it always returns 0 
  Casting it to an int rounds it down. int i=(int)d;  //d is a double ;  Edit - uh, right, (int)d works correctly for negative numbers too, my bad.“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”    — Brian W. Kernighan (C programming language co-inventor) [edited by - Fruny on February 11, 2004 1:43:59 PM];  floor should work, it sounds a little suspicious that it always returns 0 -vunless, of course, you call it only on numbers within the range [0,1) ;  björn stroustrup recommendsi = static_cast<int>(d);but hey, whatever skins your chicken.   [edited by - craigatcod3rzdotnet on February 13, 2004 8:05:12 AM]