Re: [PyOpenGL-Users] size limit of vertex array?
Brought to you by:
mcfletch
From: Alejandro S. <as...@gm...> - 2010-07-13 21:49:03
|
Hi Roland, I completely agree with Ian on this one. glDrawArrays seems more appropriate for the way you are composing your arrays. IMO, this should not be setting any constraints on how many vertices you can supply to the GL tough. How much RAM does your video card have? Alejandro.- On Tue, Jul 13, 2010 at 1:22 PM, Ian Mallett <geo...@gm...> wrote: > My recommendation: use glDrawArrays(...). > > #Init: > > self.vertices = [] > self.normals = [] > self.nbrindices = 0 > unit = 1.0 > y = 0.0 > rows = 2 > 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]] > > #Draw: > glPolygonMode(GL_FRONT_AND_BACK,GL_LINE) > > > 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 > > glDrawArrays(GL_QUADS,0,len(self.vertices)) > > > glDisableClientState(GL_VERTEX_ARRAY) > glDisableClientState(GL_NORMAL_ARRAY) > > Ian > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > _______________________________________________ > PyOpenGL Homepage > http://pyopengl.sourceforge.net > _______________________________________________ > PyOpenGL-Users mailing list > PyO...@li... > https://lists.sourceforge.net/lists/listinfo/pyopengl-users > > -- Alejandro Segovia Azapian Director, Algorithmia: Visualization & Acceleration http://web.algorithmia.net |