I'm having a strange issue when I try to create a large VertexList of
lines.  My ultimate goal is to render the normal vectors for a heightmap,
but for now I just want to get it working with basic "up" vectors.  I'm
getting an "invalid value" error when I call vertexList.draw( GL_LINES ) for
certain sizes of VertexList.  A list of 4096 lines (64x64) fails, but 4160
lines (64x65) works fine.

The best explanation would be example code, so I attached a basic pyglet app
that renders a 64x65 grid of lines.  Changing the number of columns to 64,
for example, throws the error.  Other values, like 1 row of 32 columns, also
fails.

Thoughts?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

import pyglet
from pyglet.gl import *

rows = 64
columns = 65            # changing this to 64 causes an "invalid value" 
exception to be thrown on vertexList.draw( GL_LINES )

verts, colors = [], []
for y in xrange(rows):
        for x in xrange(columns):
                verts += (x,y,0,x,y,1)
                colors += (255,255,0,255,255,0)
                
vertexList = pyglet.graphics.vertex_list( len(verts)/3,
        ('v3f/static', verts),
        ('c3B/static', colors) )

window = pyglet.window.Window()

glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
glRotatef( -60, 1, 0, 0)
glTranslatef( -32, 16, -24 )

@window.event
def on_resize(width, height):
        glViewport(0, 0, width, height)
        glMatrixMode(GL_PROJECTION)
        glLoadIdentity()
        gluPerspective(90.0, width / float(height), 1.0, 100000.0)
        return pyglet.event.EVENT_HANDLED
                
@window.event
def on_draw():
        window.clear()
        vertexList.draw( GL_LINES )
                
pyglet.app.run()

Reply via email to