Is this useful?
BlitzMax Forums/BlitzMax Beginners Area/Is this useful?| 
 | ||
| GL Colors range from 0 to 1.  Hey, this let's me be lazy.  And yes I'm taking baby steps here. :( Print GLColor(200) Function GLColor:Float(RGB:Int) Return RGB / 255.0 End Function | 
| 
 | ||
| well not useful for anything fast ;-) | 
| 
 | ||
| It wouldn't be called every cycle of course.  Just wondering how people are getting the colors they want by using the 0 to 1 values.  Is there a built in converter or are you guys just guessing? | 
| 
 | ||
| This is where an "Inline" option would be handy.  When the overhead of calling a function is more than the function itself, then the compiler would just replace the call with the function.  So. Inline Function AddNumbers:Int(Number1:Int,Number2:Int) Return Number1 + Number2 End Function Print AddNumbers(10,15) Would actually compile down to Print 10+15 | 
| 
 | ||
| True, true. Would love to see this someday | 
| 
 | ||
| The function works perfectly here.  But I see what you're saying.  It wouldn't be optimal in a realtime situation. Instead of calling the glColor function it'd be faster to just do the math ie: glColor3f( 100.0/255.0, 200.0/255.0, 245.0/255.0 ) | 
| 
 | ||
| or do it in your head... you can make a pretty good guess about what fraction of 256 something is quite easily | 
| 
 | ||
| yeah but if you type this glColor3f( 100.0/255.0, 200.0/255.0, 245.0/255.0 ) the compile should calc the values at compile time into a single constant, it shouldn't be doing the divisions at runtime so you are OK unless you replace one of the values with a variable. | 
| 
 | ||
|  Would actually compile down to Print 10+15 Which would in turn compile down to a lazy 'Print 25' because constants were used =] |