MrIslomaniac Posted February 12, 2010 Posted February 12, 2010 Why does SetColor(Vec4(150,200,100,255)); return white? =( Dustin Quote
Canardia Posted February 12, 2010 Posted February 12, 2010 Because you have over hundred times overexposed color intensity. You shouldn't use higher values than 1 for any color values. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■
Marleys Ghost Posted February 12, 2010 Posted February 12, 2010 Lumoojas right SetColor(Vec4(1,1,1,1)) would be white, yours is super duper bright white .. try: SetColor(Vec4(0.58,0.78,0.39,1)) See if that works Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head"
Rick Posted February 12, 2010 Posted February 12, 2010 I'm guessing you are thinking it accepts RGB values from range 0-255. There is some formula you can use to convert 0-255 values to what that method needs. I can't remember what it is. Lumooja knows though I'm sure. Quote
Niosop Posted February 12, 2010 Posted February 12, 2010 value/255 Quote Windows 7 x64 - Q6700 @ 2.66GHz - 4GB RAM - 8800 GTX ZBrush - Blender
Canardia Posted February 12, 2010 Posted February 12, 2010 I think it's better to use value/255.0, because it might round to int else, so the result would be 0 or 1 only. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■
Niosop Posted February 12, 2010 Posted February 12, 2010 Yeah, you're right, in C/C++ it would. Quote Windows 7 x64 - Q6700 @ 2.66GHz - 4GB RAM - 8800 GTX ZBrush - Blender
Marleys Ghost Posted February 12, 2010 Posted February 12, 2010 Why would it round to an int ? wouldn't that only happen for multiples of 255 ? or very nearly 255 for rounding up to occur? Edit: ah in C++ ... not my worry then lol Edit:: Unless this happens in Bmax to ? Edit ::: not to worry I do it all on a calculator anyway ... Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head"
Niosop Posted February 12, 2010 Posted February 12, 2010 Just because of typecasting. If you multiply/divide a float by an int I think the result is cast to an int. I usually forget the casting rules, but in general it's a good idea to cast everything to the highest precision type you want to use before performing math operations on them. Quote Windows 7 x64 - Q6700 @ 2.66GHz - 4GB RAM - 8800 GTX ZBrush - Blender
MrIslomaniac Posted February 12, 2010 Author Posted February 12, 2010 Thanks for those fast answers =) you guys are awesome :D Quote
Masterxilo Posted February 12, 2010 Posted February 12, 2010 Wouldn't the "mathlib.h" functions make this conversion simpler? Instead of doing /255.0 for every value, you could just: SetColor(Vec4(150,200,100,255)/Vec4(255)); If you multiply/divide a float by an int I think the result is cast to an int. Nah, not if you divide a float by an int, that result would be a float. The result has always the precision/type of the operator with the highest precision. (int/int -> int, int/float -> float...) Quote Hurricane-Eye Entertainment - Site, blog.
MrIslomaniac Posted February 12, 2010 Author Posted February 12, 2010 Ok heres the next thing: when I do this SetColor(Vec4(0.5,0.5,0.5,1)); DrawRect(0,0,100,100); The texture is a little bit transparent, anyone knows why? P.S. no SetBlend(Alpha) is being used =( Quote
Masterxilo Posted February 12, 2010 Posted February 12, 2010 What do you mean by "a little bit"? And are you sure it's transparency you're seeing? If you draw a texture blended with "0.5-gray", it'll look just like a texture blended with white and a transparency (alpha) of 0.5 on a black background... Quote Hurricane-Eye Entertainment - Site, blog.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.