|
Post by crazynate on Jul 22, 2009 15:37:59 GMT -5
I am upgrading my avatar maker program and i was planning on adding better color options but i didn't want to make a lot of sprites. So i looked through sprite library guide, and i found the sprsetcolor function. At first i thought the format was sprsetcolor(0-255,0-255,0-255) so i made a variable for each color sprsetcolor(colors(0),colors(1),colors(2))
I ran the porgram and changed the value of the variables between 0-255. unfortunately it didnt work the way i had hoped & i only got a few colors. I reread the library guide and found out that 0 = no intensity, 1 = full intensity; so i changed the variables so that they would be 0-1 sprsetcolor(colors(0)/255,colors(1)/255,colors(2)/255)
But once again it didn't work. The red,the green, & the blue were either full intensity or not. Can someone help me because i don't want to spend a lot of time making sprites and the last time i tried using opengl it crashed my computer's video card
|
|
OW
Posts a bit
Posts: 100
|
Post by OW on Jul 22, 2009 22:21:25 GMT -5
Try using the true decimal values of the colors you want.
If you wanted a red color, it would be (200,37,54)
|
|
|
Post by Wayne Rayner on Jul 23, 2009 3:02:04 GMT -5
I am upgrading my avatar maker program and i was planning on adding better color options but i didn't want to make a lot of sprites. So i looked through sprite library guide, and i found the sprsetcolor function. At first i thought the format was sprsetcolor(0-255,0-255,0-255) so i made a variable for each color sprsetcolor(colors(0),colors(1),colors(2)) I ran the porgram and changed the value of the variables between 0-255. unfortunately it didnt work the way i had hoped & i only got a few colors. I reread the library guide and found out that 0 = no intensity, 1 = full intensity; so i changed the variables so that they would be 0-1 sprsetcolor(colors(0)/255,colors(1)/255,colors(2)/255) But once again it didn't work. The red,the green, & the blue were either full intensity or not. Can someone help me because i don't want to spend a lot of time making sprites and the last time i tried using opengl it crashed my computer's video card The way the SprSetColor function work is you use decimals like so SprSetColor (0.3,0.8,0.5) Now I don't know wat color that will be but is will work. I've used it before and it's simple once u get ur head round the problem. I've used decimals to 2 places but I think u can use them further. Wayne Rayner
|
|
|
Post by UNDISCLOSED on Jul 29, 2009 6:54:54 GMT -5
I see what you are doing by deviding the values by 255 to get a decial, but because both numbers are integers the result will be trucated/rouded to an integer. the soloution I used is to declaire colors() as a double. Also instad of using an array you could use a UDT or Structure:
type spritecolor red as double green as double blue as double end type
dim ball as integer = NewSprite(LoadTex("data\ball.png")) dim c as spritecolor c.red = 255 c.green = 150 c.blue = 200
SprSetPos(100,100) SprSetColor(c.red/255, c.green/255, c.blue/255)
|
|
|
Post by Nicky Peter Hollyoake on Jul 29, 2009 16:48:42 GMT -5
Why make them floats?
Dim Red = 200, Green = 125, Blue = 20
SprSetColor (Red / 255.0, Green / 255.0, Blue / 255.0)
Just devide it by a decimal instead.
- Nicky
|
|