opengl.glVertex2i(self.left_100 + self.width_100, self.top_100)


First of all, you need to have a opengl.glEnd after you have drawn all of the vertexes.

Yes, I dont paste it by mistake :)

How can I make that square dissapear? I try with opengl.glClear and openGl.Disable, but seems that are not the proper commands, and obviously my opengl knowledge is zero.

What exactly do you mean by disappear? If you don't want it to be drawn, simply don't draw it.

well, I draw it but I want to delete it, I paste the complete class at the end of the email, Im thinking to make it disappear to add a if (self.visible) in the render method to make it disappear.. but dont looks like the proper way to do that, I prefer to do a cls screen ;)

BTW, if you don't know opengl, it would probably be easier for you to use soya.Face. (Take a look at tutorial/modeling-1.py to see how to use it.)

But that face class is not like this, I wanted to use it as a Gui background, actually I can make a rectangular face appear on screen with a call like this :

gui_go = MsgWindow (root, color, None, 1.9, 0.5, 5.3 , 3.0)

with a color background, or in the None if a place a soya.Material it texture it, so I can add some nice background to the gui, it works fine, its autoresizable, but its always rendering itself.

--------------------------------------------------------------------------------------------
class MsgWindow(widget.Widget):
def __init__(self, master = None, color = (1.0, 1.0, 1.0, 0.8), bg_material = None , top=0.1 , left=0.1 , height=0.1, width=0.1 ):
               widget.Widget.__init__(self, master)
               self.real_width = soya.get_screen_width() / 10
               self.real_height = soya.get_screen_height() / 10
               self.color= color
               self.bg_material = bg_material
               self.top = top
               self.left = left
               self.height = height
               self.width = width
               self.top_100 = int(self.top * self.real_height)
               self.left_100 = int(self.left * self.real_width )
               self.width_100 = int(self.width * self.real_width)
               self.height_100 = int(self.height * self.real_height)
       def resize(self, p_x, p_y, p_w, p_h):
               self.real_width = soya.get_screen_width() / 10
               self.real_height = soya.get_screen_height() / 10
               self.top_100 = int(self.top * self.real_height)
               self.left_100 = int(self.left * self.real_width )
               self.width_100 = int(self.width * self.real_width)
               self.height_100 = int(self.height * self.real_height)
       def render(self):
              # if I created the gl rect with texture or colored.
              if (self.bg_material == None):
                       opengl.glEnable(opengl.GL_BLEND)
                       opengl.glColor4f (*self.color)
                       opengl.glBegin(opengl.GL_QUADS)
                       opengl.glVertex2i(self.left_100, self.top_100)
opengl.glVertex2i(self.left_100, self.top_100 + self.height_100) opengl.glVertex2i(self.left_100 + self.width_100, self.top_100 + self.height_100) opengl.glVertex2i(self.left_100 + self.width_100, self.top_100)
              else:
                       self.bg_material.activate()
                       opengl.glEnable(opengl.GL_BLEND)
                       opengl.glBegin(opengl.GL_QUADS)
opengl.glTexCoord2f(0.0, 0.0); opengl.glVertex2i(self.left_100, self.top_100) opengl.glTexCoord2f(1.0, 0.0); opengl.glVertex2i(self.left_100, self.top_100 + self.height_100) opengl.glTexCoord2f(1.0, 1.0); opengl.glVertex2i(self.left_100 + self.width_100, self.top_100 + self.height_100) opengl.glTexCoord2f(0.0, 1.0); opengl.glVertex2i(self.left_100 + self.width_100, self.top_100)
              opengl.glEnd()


Reply via email to