Reputation: 810
I write an Wavefront OBJ loader and it works, but FPS drop to ~3 after 500 polygons, 1000 polygons equal to ~10sec delay, and 2000+ polygons equal to freeze and crash.
my C++/Qt application load 1 Million polygons around ~15-20 FPS, I'm suspicious of PyOpengl(ctypes) and PyQt(sip) wrappers.
has anyone tried to load high-res models into PyOpengl and PyQt application to help me out?
Edit: I used "vertex buffer objects" for OBJ loader, so have nothing to do with CPU.
Upvotes: 1
Views: 2733
Reputation: 810
Performance Tips for Python + OpenGL, from http://pyopengl.sourceforge.net/ctypes/using.html
Python is (currently) a fairly slow language due to the incredible generality of it's execution model. This means that certain approaches to coding OpenGL that would work well in a language such a C or C++ will be painfully slow in Python. The key idea to remember is that, as much as possible, you want to push the work of iteration and repetition into the OpenGL implementation (which is implemented in C and/or Hardware).
There are two major approaches taken to accomplishing this:
- Use array-based geometry
- Use display-lists
I solve the performance issue by using Ctypes, Just write an small wrapper around my C++ app (now mostly C) and use PyQt for GUI and GL widget. -- I get 10 FPS for ~1 Million polygons, performance rocks and highly recommended!!
Upvotes: 4