本文介绍了使用PyOpenGL渲染SceneGraph的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用OpenGLContext将VRML文件加载到SceneGraph对象中.不幸的是,对于我一生,我找不到任何显示如何渲染SceneGraph的示例.
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.
我已经用testcontext.getInteractive()
创建了一个上下文,但是现在呢?如何渲染SceneGraph?
I've created a context with testcontext.getInteractive()
, but now what? How do I render a SceneGraph?
推荐答案
它的文献资料很少.所有需要做的就是创建一个上下文类并设置其sg
字段,如下所示:
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.
这篇关于使用PyOpenGL渲染SceneGraph的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!