Re: [PyOpenGL-Users] size limit of vertex array?
Brought to you by:
mcfletch
From: Roland E. <r.e...@gm...> - 2010-07-13 16:07:22
|
Ian, Here is the code to create the list of vertices: self.vertices = [] self.normals = [] self.nbrindices = 0 unit = 1.0 y = 0.0 rows = 8 columns = 8 z_center_delta = unit * (float(rows) / 2.0) x_center_delta = unit * (float(columns) / 2.0) for i in range(rows): delta_z = (unit * float(i)) - z_center_delta for j in range(columns): delta_x = (unit * float(j)) - x_center_delta self.vertices += [0.0 + delta_x, y, 0.0 + delta_z, 0.0 + delta_x, y, unit + delta_z, unit + delta_x, y, unit + delta_z, unit + delta_x, y, 0.0 + delta_z] self.normals += [0.0, +1.0, 0.0, 0.0, +1.0, 0.0, 0.0, +1.0, 0.0, 0.0, +1.0, 0.0] self.nbrindices = len(self.vertices) / 3 self.indices = range(self.nbrindices) In addition to creating the squares, the code try also to center the plane on the origin. Next is the code used for the rendering: glPolygonMode(GL_FRONT_AND_BACK, GL_FILL) glEnableClientState(GL_VERTEX_ARRAY) glEnableClientState(GL_NORMAL_ARRAY) glVertexPointer(3, GL_FLOAT, 0, self.vertices) # Specify the vertex list to be used to draw the object glNormalPointer(GL_FLOAT, 0, self.normals) # Specify the normals list to be used to draw the object glDrawElements(GL_QUADS, self.nbrindices, GL_UNSIGNED_BYTE, self.indices) glDisableClientState(GL_VERTEX_ARRAY) glDisableClientState(GL_NORMAL_ARRAY) Thanks for the help, Roland. Le 07/13/10 16:39, Ian Mallett a écrit : > Hi, > > The bounds of a vertex array or VBO object should ultimately be > constrained by the amount of RAM and video memory you have. I've > personally used vertex arrays of larger size than 64*4*3, so > something's wrong. > > What specifically goes wrong when you add more? Can we see some code? > > Ian |