isGLExtensionSupported

    技术2022-05-20  65

    http://forum.openscenegraph.org/viewtopic.php?t=7846

     

    However, in the recent thread you refer to, my code was in a Camera

    post-draw callback which doesn't get a RenderInfo as a parameter, it gets a

    Camera as a parameter. So, I get the contextID with the following:

    camera.getGraphicsContext()->getState()->getContextID(). This might look

    like a hack, as you said, but it isn't.

     

    But how should YOU get the contextID?

     

    >From your post, it sounds like you need to get the contextID from your

    Viewer. A Viewer could manage many contexts. It has the concept of a current

    context, but this is protected so you can't access it. However, you can get

    a std::vector of GraphicsContexts from your Viewer. See

    osgViewer::ViewerBase::getContexts(...). After you figure out which

    GraphicsContext you are interested in, you can call

    getState()->getContextID() on that GraphicsContext.

     

    osg::isGLExtensionSupported(gc->getState()->getContextID(), "GL_ARB_multitexture") || osg::isGLExtensionSupported(gc->getState()->getContextID(), "GL_EXT_multitexture")

     


    最新回复(0)