Wow! With this simple thing I instantly got 60fps, thank you so much.

On Friday, October 19, 2012 2:32:58 PM UTC-7, swiftcoder wrote:
>
> On Fri, Oct 19, 2012 at 5:20 PM, Gabriele Lanaro 
> <[email protected]<javascript:>
> > wrote:
>
>> Hi! I'm trying to build a molecular viewer with pyglet and I'm currently 
>> hitting performance problems but I can't figure out how to solve them.
>>
>> My test case contain 7 cylinders (100 triangles each) and 6 spheres (200 
>> triangles each). For each shape (13), I generate triangle vertices and 
>> normals and store those in numpy arrays. At the moment of rendering I use a 
>> call like this:
>>
>>         draw(n, pyglet.gl.GL_TRIANGLES,
>>              ("v3f", self.tri_vertices),
>>              ("n3f", self.tri_normals),
>>              ("c3B", self.tri_color))
>>
>> I run a little test that simply rotates the camera, FPS are ~2. From the 
>> profiler output, sorting by time (time spent in the function, without 
>> subcalls):
>>
>>    ncalls  tottime  percall  cumtime  percall filename:lineno(function)
>>      7605   56.375    0.007   56.529    0.007 
>> /usr/lib/pymodules/python2.7/pyglet/graphics/vertexattribute.py:339(set_region)
>>       169    0.891    0.005    0.895    0.005 
>> /usr/lib/pymodules/python2.7/pyglet/window/__init__.py:1209(clear)
>>         8    0.520    0.065    0.720    0.090 
>> /home/gabriele/workspace/chemlab/chemlab/gletools/shapes.py:125(_generate_vertices)
>>      2535    0.499    0.000   57.639    0.023 
>> /usr/lib/pymodules/python2.7/pyglet/graphics/__init__.py:168(draw)
>>     41707    0.332    0.000    0.332    0.000 
>> /usr/lib/pymodules/python2.7/pyglet/gl/lib.py:85(errcheck)
>>
>> It seems that most of the time is spent in the set_region function but 
>> I'm not sure how to solve this problem. What do you think it's going on? 
>>  
>> The biggest win would be not to push all those vertices across to the GPU 
> every frame. Use batches instead.
>
> -- 
> Tristam MacDonald
> Software Development Engineer, Amazon.com
> http://swiftcoder.wordpress.com/
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/pyglet-users/-/lP8Z4D6abH8J.
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.

Reply via email to