Render a SceneGraph with PyOpenGL

旧时模样 提交于 2019-12-24 05:30:44

问题


I'm using OpenGLContext to load a VRML file into a SceneGraph object. Unfortunately, for the life of me I can't find any example showing how to render the SceneGraph.

I've created a context with testcontext.getInteractive(), but now what? How do I render a SceneGraph?


回答1:


It's quite poorly documented. All that needs to be done is create a context class and set its sg field, like so:

def MyContext(BaseContext):
    def OnInit(self):
        self.sg = ... load your scene graph here ...

    def OnRender(self, mode):
        return

And that's it, the scene is rendered properly.




回答2:


Take a look at: http://pyopengl.sourceforge.net/context/tutorials/shader_1.xhtml It steps you through the process with some thorough explanations.



来源:https://stackoverflow.com/questions/17331694/render-a-scenegraph-with-pyopengl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!