I’m not entirely sure what you’re asking. Do you wish to convert this code to pure Panda code? Or do you wish to inject custom (py)OpenGL code into a Panda application?
For the latter, you can use draw callbacks. A sample program for them is in this post: