1
$\begingroup$

I'm wondering if there was any way for me to use PyOpenGL in Blender's Python API? I would rather not use BGL, because I would like to render a lot of 3D objects and immediate mode is rather limiting...

It might help if I'm describing the project I'm working on. I would like to write an add-on that would allow you to work with Blender seamlessly from the Vive. I'm using OpenVR to control with the Vive and OpenGL to render to the Vive. So far, displaying things went pretty well. However, the issue is the usage of PyOpenGL in Blender. It involves the creation of a window for OpenGL to work with (GLUT), resulting in the Blender interface freezing. As a result, I can't modify the model or anything while the addon is running. In addition, if I close the window, Blender also closes, which is inconvenient.

$\endgroup$
1
$\begingroup$

I can see two approaches:

  1. Upgrade blender's python API to support interactive PyOpenGL auxiliary windows
  2. Upgrade blender with built-in Vive support

I suspect #2 will be cleaner. #1 would allow people with less understanding of blender's guts to do some nifty stuff, but it would probably require a core blender coder the same level of expertise and time to accomplish as #2.

There is also the problem of user input. When you have the Vive on your head you have access to a pair of upgraded mice, but you do not have the keyboard. There are solutions, but the paradigm does not exactly mesh with the existing UI.

$\endgroup$
  • $\begingroup$ I'm okay with the limits of the VR version since there is no keyboard usage. VR applications are generally a trade off between the cool factor and the practical factor. I'll have to change the UI in the Vive, but the important thing is to get a window without freezing Blender. Could you give more details as to how I can do your suggestions? $\endgroup$ – EmilyOskett May 17 '17 at 21:28
  • $\begingroup$ Unfortunately both of those options are are a little beyond my expertise. Even if I were to write Mary Sue fanfic about this, my avatar would take 6 months to accomplish the mission. $\endgroup$ – Mutant Bob May 18 '17 at 18:11
  • $\begingroup$ Haha that's fine. I actually found a hack that's an easy fix. If you create a separate window when you're creating a Blender menu (SHIFT-LEFTCLICK-DRAG when you click the corner tab to create a new menu), turn that window into the Python editor, and then run the code from there, everything works great! I'm a bit new to StackExchange, so I'm unfamiliar with the protocol - should I accept your answer even though it didn't solve my problem? $\endgroup$ – EmilyOskett May 19 '17 at 18:51
  • $\begingroup$ No. It would probably be better to create a new answer that details the answer to the question so that other people can understand it and use it. $\endgroup$ – Mutant Bob May 19 '17 at 20:18
0
$\begingroup$

I found a hack.

If you create a separate window when you're creating a Blender menu (SHIFT-LEFTCLICK-DRAG when you click the corner tab to create a new menu), turn that window into the Python editor, and then run the code from there, everything works great!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.