1

How I can write an OpenGl application using Enthought Framework? I created a TasksApplication and I am stuck on this tutorial, I don't know what I can use instead PythonEditor there. I need to create something where I will be able to render.

UPDATE:

I changed the code to

def create(self, parent):
    widget = GLWidget(parent)
    self.control = widget

Where GlWidget is implemented like in this example. And I have a runtime crash. But I am able to run the GL script from the example above.

UPDATE2:

Log file

UPDATE4: Code was updated according to @Robert Kern suggestions. Now it works.

Min Example

MinExample 7z

user14416
  • 2,922
  • 5
  • 40
  • 67
  • I'm afraid that you will have to provide more information about the crash, like copy-pasting the exact traceback. – Robert Kern May 07 '13 at 18:18
  • ok. I uploaded the log. – user14416 May 07 '13 at 18:30
  • I'm not seeing an error that is related to a crash, just some tracebacks from trying to load optional PyOpenGL components. Are there no other messages? Why do you think this is a crash? Does a window show up, then immediately disappear? Or does nothing happen? Can you post a complete minimal example that demonstrates the problem? – Robert Kern May 07 '13 at 18:53
  • 2
    Two things: `Plugin.py` still has `from Task import Visualization` where you should have `from Visualization import Visualization`. And in your `PythonEditorPane` (which it is time to rename) your `create()` method does not assign the `GLWidget` that you instantiated to `self.control`. Fix those two things, and your example works for me. – Robert Kern May 07 '13 at 19:29

1 Answers1

2

The control trait of a TaskPane is just the Qt widget object that you are using. In the example that you link, we happen to be getting it from another PyFace widget that wraps a Qt widget in a similar fashion, so we just grab the control attribute from it. You should just directly use a QGLWidget as the control of your pane. Please consult the Qt documentation for how to use it. You can use PyOpenGL in the paintGL(), etc. methods to do the actual rendering.

Robert Kern
  • 13,118
  • 3
  • 35
  • 32