well actually im dealing with colors (RGB) and it has value 0-255, and those 
value represented by unsigned char(8 bit) to be able to be placed in the GPU 
memory. the problem is available data represented in float value, 0-1, 1 is the 
most value. now i need to convert this and im not pretty sure how to do it. yes 
i can easily do this:

int rgbValue = floor(inputDecimal * 255);

but those resulting an integer value from 0-255 (which is represented as 32 
bit) 
  
 
any idea?

thanks================================= 
http://www.svnstrk.blogspot.com




________________________________
From: Rob Richardson <[email protected]>
To: [email protected]
Sent: Wed, September 1, 2010 11:03:42 PM
Subject: RE: [c-prog] float value to (unsigned) char

  
Why is it so very few people on this list ask questions with enough
information for us to be able to answer them?

Exactly how do you want to map a decimal value to an unsigned char?
0.01 => 'a', 0.02 => 'b', or something seemingly useless like that?  If
you want to map numbers between 0 and 1 to 256 different characters,
you're going to have to tell us how you want to do the mapping.  Is it
merely breaking up the range into 256 equal parts? 

Or do you want to map your number into a string, so that 0.01 => "0.01",
which is done with a plain ordinary sprintf() function. 

RobR, wrestling with Crystal Reports all day, therefore feeling very
crabby

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf
Of Jos Timanta Tarigan
Sent: Wednesday, September 01, 2010 4:57 PM
To: [email protected]
Subject: [c-prog] float value to (unsigned) char

hi, 

im trying to convert a decimal value from 0-1 to unsigned char. so since
there are 256 value of unsigned char. how can i do that? i mean since
you can only define unsigned char with 'a' or '@' which is not a math
value, how can i convert those 0-1 decimal to unsigned char character?

thanks in advance

=================================
http://www.svnstrk.blogspot.com

[Non-text portions of this message have been removed]

------------------------------------

To unsubscribe, send a blank message to
<mailto:[email protected]>.Yahoo! Groups Links


 


      

[Non-text portions of this message have been removed]

Reply via email to