This may or may not prove to be significant for you, but I found better performance on my hardware using batches of indexed GL_TRIANGLES, rather than GL_TRIANGLE_STRIPS or GL_TRIANGLE_FANS. I didn't try GL_QUADS though.
The fewer batches you can render, the better - so if your cubes don't move or rotate independently of each other, then rendering them all in a single batch object will be much faster. On Nov 4, 5:34 am, Lunpa <[EMAIL PROTECTED]> wrote: > I've been teaching myself opengl recently, and I've hit a wall, which > is what to do with bottlenecks, or let alone, figure out what is > causing them. > > I wrote a short program (based off of the pyglet "hene" port of the > nehe lesson1 base case) to illustrate what is vexing me, or atleast as > best as I can pin it down; > > I have a function called "call", which is called from the on_draw > event of the window, and the function contains the following code: > > def call(self): > if not self.__compiled: > glNewList(self.__dl, GL_COMPILE) > > r = 5 > ci = 0 > span = range(r*-4, (r*4)+1, 4) > for x in span: > for y in span: > draw_cube(x, 0, y, ci) > ci +=1 > if ci > 1: > ci = 0 > glEndList() > self.__compiled = True > > glCallList(self.__dl) > > the "draw_cube" function just calls a glBegin(GL_QUADS), 24 > glVertex3f's, and the glEnd() > > When I run this program with just the basecode (eg, I have the call > function commented out), > the thing can do well over 60 fps (spikes over 100, sporadically). > > When I have the function in the code, the code plummets to an average > of 20fps. > > What do I need to do to be able to draw more than a handful of > polygons without dramatic slowdowns??? > > ps: my gpu is an intel 945gm; not exactly a powerhouse, but the code > has been tested on other machines with similar results. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
