Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I'm having trouble with RGB values....
#1
I'm trying to make certain colors mixing RGB values but it's not working...

I read James Kinney's guide but it doesnt work for all colors...

Please open this site for example

http://www.ref3.gta.mendelsohn.de/Fil_carcoldat.html

For instance, when I try to make 'Police Car blue' I insert the values 42,119,161. So my codes looks like this:



Code:
SCREEN 13
FOR i = 1 TO 63 STEP 1
    OUT &H3C8, I      'color
    OUT &H3C9, 42      'R%
    OUT &H3C9, 119     'G%
    OUT &H3C9, 161      'B%
     LINE (1,i)-(320,i), i
NEXT I

But instead of that blue on thepage, it comes out with a green. Could someone solve my problem? Thank you very much 8) 8) 8)
quote="na_th_an"]
Greenday, Spice Girls... Can you tell the difference?
[/quote]
Reply
#2
It's because in Windows red, green, and blue go from 0 to 255. It would be the same way if you were using UGL or Future.Library with a true color screen mode. But in VGA 320x200 256 color mode, they go from 0 to 63.

So just divide those numbers by 4.

Also, you're drawing lines from x = 1 to x = 320... just a little reminder: pixels coordinates start at 0 not 1, so the rightmost x would be 319.

Police car blue:[syntax="qbasic"]SCREEN 13
FOR I% = 1 TO 63 STEP 1
OUT &H3C8, I% 'color
OUT &H3C9, 10 'R%
OUT &H3C9, 29 'G%
OUT &H3C9, 40 'B%
LINE (0, I%)-(319, I%), I%
NEXT I%[/syntax]
Reply
#3
It works man Smile thank you!
quote="na_th_an"]
Greenday, Spice Girls... Can you tell the difference?
[/quote]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)