当前位置: 首页>>代码示例>>C++>>正文


C++ GLContext::Renderer方法代码示例

本文整理汇总了C++中GLContext::Renderer方法的典型用法代码示例。如果您正苦于以下问题:C++ GLContext::Renderer方法的具体用法?C++ GLContext::Renderer怎么用?C++ GLContext::Renderer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GLContext的用法示例。


在下文中一共展示了GLContext::Renderer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: switch

GLint
WebGLRenderbuffer::GetRenderbufferParameter(GLenum target, GLenum pname) const {
    GLContext* gl = mContext->gl;

    switch (pname) {
        case LOCAL_GL_RENDERBUFFER_STENCIL_SIZE: {
            if (NeedsDepthStencilEmu(mContext->gl, InternalFormatForGL())) {
                if (gl->WorkAroundDriverBugs() &&
                    gl->Renderer() == GLContext::RendererTegra)
                {
                    return 8;
                }

                ScopedBindRenderbuffer autoRB(gl, mSecondaryRB);

                GLint i = 0;
                gl->fGetRenderbufferParameteriv(target, pname, &i);
                return i;
            }
            // Fall through otherwise.
        }
        case LOCAL_GL_RENDERBUFFER_WIDTH:
        case LOCAL_GL_RENDERBUFFER_HEIGHT:
        case LOCAL_GL_RENDERBUFFER_RED_SIZE:
        case LOCAL_GL_RENDERBUFFER_GREEN_SIZE:
        case LOCAL_GL_RENDERBUFFER_BLUE_SIZE:
        case LOCAL_GL_RENDERBUFFER_ALPHA_SIZE:
        case LOCAL_GL_RENDERBUFFER_DEPTH_SIZE: {
            GLint i = 0;
            gl->fGetRenderbufferParameteriv(target, pname, &i);
            return i;
        }
    }

    MOZ_ASSERT(false, "This function should only be called with valid `pname`.");
    return 0;
}
开发者ID:ak352,项目名称:mozilla-central,代码行数:37,代码来源:WebGLRenderbuffer.cpp

示例2: HTMLCanvasElement


//.........这里部分代码省略.........
    // allow forcing GL and not EGL/ANGLE
    if (PR_GetEnv("MOZ_WEBGL_FORCE_OPENGL")) {
        preferEGL = false;
        useANGLE = false;
        useOpenGL = true;
    }
#endif


#ifdef ANDROID
    // bug 736123, blacklist WebGL on Adreno
    //
    // The Adreno driver in WebGL context creation, specifically in the first MakeCurrent
    // call on the newly created OpenGL context.
    //
    // Notice that we can't rely on GfxInfo for this blacklisting,
    // as GfxInfo on Android currently doesn't know the GL strings, which are,
    // AFAIK, the only way to identify Adreno GPUs.
    //
    // Somehow, the Layers' OpenGL context creation doesn't crash, and neither does
    // the global GL context creation. So we currently use the Renderer() id from the
    // global context. This is not future-proof, as the plan is to get rid of the global
    // context soon with OMTC. We need to replace this by getting the renderer id from
    // the Layers' GL context, but as with OMTC the LayerManager lives on a different
    // thread, this will have to involve some message-passing.
    if (!forceEnabled) {
        GLContext *globalContext = GLContextProvider::GetGlobalContext();
        if (!globalContext) {
            // make sure that we don't forget to update this code once the globalContext
            // is removed
            NS_RUNTIMEABORT("No global context anymore? Then you need to update "
                            "this code, or force-enable WebGL.");
        }
        int renderer = globalContext->Renderer();
        if (renderer == gl::GLContext::RendererAdreno200 ||
            renderer == gl::GLContext::RendererAdreno205)
        {
            GenerateWarning("WebGL blocked on this Adreno driver!");
            return NS_ERROR_FAILURE;
        }
    }
#endif

    // if we're forcing osmesa, do it first
    if (forceOSMesa) {
        gl = gl::GLContextProviderOSMesa::CreateOffscreen(gfxIntSize(width, height), format);
        if (!gl || !InitAndValidateGL()) {
            GenerateWarning("OSMesa forced, but creating context failed -- aborting!");
            return NS_ERROR_FAILURE;
        }
        GenerateWarning("Using software rendering via OSMesa (THIS WILL BE SLOW)");
    }

#ifdef XP_WIN
    // if we want EGL, try it now
    if (!gl && (preferEGL || useANGLE) && !preferOpenGL) {
        gl = gl::GLContextProviderEGL::CreateOffscreen(gfxIntSize(width, height), format);
        if (!gl || !InitAndValidateGL()) {
            GenerateWarning("Error during ANGLE OpenGL ES initialization");
            return NS_ERROR_FAILURE;
        }
    }
#endif

    // try the default provider, whatever that is
    if (!gl && useOpenGL) {
开发者ID:Bmetz,项目名称:mozilla-central,代码行数:67,代码来源:WebGLContext.cpp


注:本文中的GLContext::Renderer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。