missing two lines.. anyone see why?

Hi,

I am trying to draw a pianoroll (similar to piano notes) with the following python class:


class EtGrid(Gclass):
    """ Equal Tempered Grid, useful in revealing pitch values
    Optionally show the midi note number of each section
    """
    def __init__(self, low = 48, high = 72):
        self.low = low
        self.high = high
        self.nNotes = high - low
        self.semiSize = 1. / self.nNotes
        self.blackNotes = [1, 3, 6, 8, 10]
        self.lineNotes = [0, 5]
    def draw(self):
        n = 0
        while n <  self.nNotes:
            if (n%12) in self.lineNotes:
                glColor(0,0,0)
                glBegin(GL_LINE_STRIP)
                glVertex2f(0, n*self.semiSize)
                glVertex2f(1, n*self.semiSize)
                glEnd()
            if (n%12) in self.blackNotes:
                glColor4f(0,0,0,.5)
            else:
                glColor4f(1,1,1,.5)
            glBegin(GL_QUADS)
            glVertex2f(0, n*self.semiSize)
            glVertex2f(0, (n+1)*self.semiSize)
            glVertex2f(1, (n+1)*self.semiSize)
            glVertex2f(1, n*self.semiSize)
            glEnd()
            n += 1
# end class EtGrid

The resulting display can be seen here: http://mtg.upf.edu/files/personal/pianogrid.png

The problem is that I do not have a separator line at note 5 and 12, which I don’t know why. Does anyone else?

Thanks for the help,
Rich

The image link is broken.

Oops, it should work now.

Move your line drawing after the quad drawing code. The quads are covering your previously drawn lines.

actually, I don’t see the seporator at 5 and mod(5)… and if I move the line drawing code below the quad drawing, I don’t see anything.

I was messing around with moving the lines until they were seen. Changing their z location doesn’t change anything, but increasing y does. With the line code first, all I have to do is add a small value to see all the lines (not just the line at mod(0)), whereas if the line drawing is after the quad drawing, I have to add at least 1 to see the lines.

It is weird to me… must be something in my logic but I don’t see it.

well, thanks for the help,
Rich