[PyOpenGL-Users] DrawArrays for a bunch of (unconnected) lines
Brought to you by:
mcfletch
|
From: Philippe S. <ph...@ph...> - 2005-01-30 14:33:31
|
Hello,
I'm playing with opengl for a tiny chart ploting application,
and facing the following problem:
the line representing the data is displayed, but I cannot
get the horizontal and vertical grid to be displayed.
initialization:
pygame.init()
self.surface = pygame.display.set_mode((self.width, self.height), OPENGL|DOUBLEBUF)
glClearColor(0.0, 0.0, 0.0, 0.0)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
glOrtho(0, 1, 0, 1, 0, 1)
glEnableClientState(GL_VERTEX_ARRAY)
glDisable(GL_LIGHTING)
data drawing loop:
glColor(0.8, 0.8, 0.8, 0.0)
glVertexPointerd(self.gridH)
glDrawArrays(GL_LINES, 1, len(self.gridH))
glVertexPointer(4, GL_DOUBLE, 0, self.gridV)
glDrawArrays(GL_LINES, 1, len(self.gridV))
glColor(0.65, 1.0, 1.0, 0.0)
#glVertexPointer(2, GL_DOUBLE, 0, self.points)
glVertexPointerd(self.points)
glDrawArrays(GL_LINE_STRIP, 1, self.N/2)
pygame.display.flip()
self.gridH and gridV are list of 4 elements tuple [(xa0, ya0, xa1, ya1), ...]
self.points is a simple list.
Also, if I replace glVertexPointerd(self.points) with the line just above it,
nothing is displayed.
I'm a newbie, someone can probably help me!
thanks.
|