Yue Posted June 9, 2018 Share Posted June 9, 2018 self.entity:SetClearColor(12, 183, 242, 1 ) -- Color white. Error. Color Sky Blue not render. self.entity:SetClearColor(255, 0, 0, 1 ) -- Ok, Color Red. I'm trying to set the background color of the camera, but it doesn't work, what am I doing wrong? Quote Link to comment Share on other sites More sharing options...
gamecreator Posted June 9, 2018 Share Posted June 9, 2018 I'm not sure off the top of my head but try using values between 0 and 1 instead of 0 and 255. 1 Quote Link to comment Share on other sites More sharing options...
Solution GorzenDev Posted June 9, 2018 Solution Share Posted June 9, 2018 make sure your entity is actually a camera. tolua.cast(self.entity,"Camera") as gamecreator said color in code always use normalized values 0-1 if thats a problem you can always do sometihng like self.entity:SetClearColor(12 / 255, 183 / 255, 242 / 255, 1.0) self.entity:SetClearColor(255 / 255, 0.0, 0.0, 1.0) 1 Quote Link to comment Share on other sites More sharing options...
tipforeveryone Posted June 10, 2018 Share Posted June 10, 2018 You can create a simple function which helps you to convert 0-255 to 0-1 function rgba(r,g,b,a) --red green blue alpha, it is like CSS local rgba_value = Vec4(r/255,g/255,b/255,a) return rgba_value end --make this function global then you can use entity:SetColor(rgba(142,36,64,0.8)) 1 Quote Link to comment Share on other sites More sharing options...
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.