Re: [PyOpenGL-Users] size limit of vertex array?
Brought to you by:
mcfletch
From: Roland E. <r.e...@gm...> - 2010-07-14 16:56:32
|
Concenring the high CPU usage after some thought and a test, it is mainly due to the while loop in which the OpenGL code run. Roland. Le 07/14/10 14:19, Roland Everaert a écrit : > Hi, > > Its me again still playing with vertex array. > > Using the code showed previously, I have tried to display a plane of > 60 rows and 44 columns. With lighting disabled, no material properties > defined and no normals provided, the rendering of such plane is > performed at 10 FPS. > > In addition, one of the core of the CPU is used at 100% by python what > ever the size of the plane or the number of "objects" rendered. > > Is it normal that python uses so much CPU? > > Does 60 * 44 * 4, hence, 10560 vertices such big for an interactive > application or should I use other techniques (VBO maybe) to render > such amount of vertices or less vertices for such object? (I know that > it depends, mainly, on what I want to do with the plane) > > When using glGetString() to get information on the hardware here are > the information I got: > > NVIDIA Corporation > GeForce 8800 GTX/PCI/SSE2 > 3.2.0 NVIDIA 190.42 > > So it seems that the program is using the graphics card at some point. > > The CPU of the machine is an AMD 64 X2 DualCore 5200+. > > > > Thanks for any advise, > > > Roland > > > > Le 07/14/10 11:49, Roland Everaert a écrit : >> Hi, >> >> With glDrawArrays it works, I had anyway to change the example from: >> >> glDrawArrays(GL_QUADS,0,len(self.vertices)) >> >> To: >> >> glDrawArrays(GL_QUADS,0,len(self.vertices) / 3) >> >> >> Thanks, >> >> >> Roland. >> >> Le 07/13/10 23:48, Alejandro Segovia a écrit : >>> 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... >>> <mailto: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://sprint.com/first> -- >>> http://p.sf.net/sfu/sprint-com-first >>> _______________________________________________ >>> PyOpenGL Homepage >>> http://pyopengl.sourceforge.net >>> _______________________________________________ >>> PyOpenGL-Users mailing list >>> PyO...@li... >>> <mailto:PyO...@li...> >>> https://lists.sourceforge.net/lists/listinfo/pyopengl-users >>> >>> >>> >>> >>> -- >>> Alejandro Segovia Azapian >>> Director, Algorithmia: Visualization & Acceleration >>> http://web.algorithmia.net |