DirectEntry color problem --> solved


I got a weird behaviour on setting color on directentry.
When I put two values (one for red, and one for blue for example), I got a DirectEntry object Pink (normal cause I got red + blue), but any value I put in red and blue I got the same pink.
Now, I add a value in green, and I got a directEntry object white, with same behaviour.

Do you have any idea?

class menuconnect(DirectObject):
  def __init__(self):
    self.user = DirectEntry(text = "" ,scale=.05,command=setText,initialText="", numLines = 1,focus=1,relief=2,frameColor=(65,45,193,0.5))
    self.pwd = DirectEntry(text = "" ,scale=.05,command=setText,initialText="", numLines = 1,focus=0,relief=2,frameColor=(65,0,193,0.5),pos=(0,0,-0.2))
    self.btn=DirectButton(text= ("Connect"),command=self.connect,scale=0.08,pos=(0.4,0,-0.4))

Panda’s color ranges from 0 to 1.

I understand now. What a strange choice to use RGB and not the conventionnal 0…255.

I just need to divide per 255.

Thanks, it works!

Welcome to 3D world, where the new convention is 0…1. It’s not Panda-specific. The reason for this is that the colors are the same no matter what the precision is (you can use the same color values in a float buffer, in 32-bits buffer, in an 8-bits buffer, etc.) So all of the color values are floating-point 0…1 everywhere, and passed like this to the GPU, that turns it into the right color values.

It would be silly to use a 0…255 uinteger range, this restricts us to 8-bits per channel.

Yeah you are right. I remember my first project using OpenGL. All was on 0…1 range.

Thanks for the information