• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ WebGLContextAttributes类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中WebGLContextAttributes的典型用法代码示例。如果您正苦于以下问题:C++ WebGLContextAttributes类的具体用法?C++ WebGLContextAttributes怎么用?C++ WebGLContextAttributes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: jsWebGLContextAttributesPreserveDrawingBuffer

JSValue jsWebGLContextAttributesPreserveDrawingBuffer(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSWebGLContextAttributes* castedThis = static_cast<JSWebGLContextAttributes*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    WebGLContextAttributes* imp = static_cast<WebGLContextAttributes*>(castedThis->impl());
    JSValue result = jsBoolean(imp->preserveDrawingBuffer());
    return result;
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:8,代码来源:JSWebGLContextAttributes.cpp


示例2: GenerateWarning

NS_IMETHODIMP
WebGLContext::SetContextOptions(JSContext* aCx, JS::Handle<JS::Value> aOptions)
{
    if (aOptions.isNullOrUndefined() && mOptionsFrozen) {
        return NS_OK;
    }

    WebGLContextAttributes attributes;
    NS_ENSURE_TRUE(attributes.Init(aCx, aOptions), NS_ERROR_UNEXPECTED);

    WebGLContextOptions newOpts;

    newOpts.stencil = attributes.mStencil;
    newOpts.depth = attributes.mDepth;
    newOpts.premultipliedAlpha = attributes.mPremultipliedAlpha;
    newOpts.antialias = attributes.mAntialias;
    newOpts.preserveDrawingBuffer = attributes.mPreserveDrawingBuffer;
    if (attributes.mAlpha.WasPassed()) {
      newOpts.alpha = attributes.mAlpha.Value();
    }

    // enforce that if stencil is specified, we also give back depth
    newOpts.depth |= newOpts.stencil;

#if 0
    GenerateWarning("aaHint: %d stencil: %d depth: %d alpha: %d premult: %d preserve: %d\n",
               newOpts.antialias ? 1 : 0,
               newOpts.stencil ? 1 : 0,
               newOpts.depth ? 1 : 0,
               newOpts.alpha ? 1 : 0,
               newOpts.premultipliedAlpha ? 1 : 0,
               newOpts.preserveDrawingBuffer ? 1 : 0);
#endif

    if (mOptionsFrozen && newOpts != mOptions) {
        // Error if the options are already frozen, and the ones that were asked for
        // aren't the same as what they were originally.
        return NS_ERROR_FAILURE;
    }

    mOptions = newOpts;
    return NS_OK;
}
开发者ID:Sleepwalker2014,项目名称:gecko-dev,代码行数:43,代码来源:WebGLContext.cpp


示例3: toWebGLContextAttributes

WebGLContextAttributes toWebGLContextAttributes(const CanvasContextCreationAttributes& attrs)
{
    WebGLContextAttributes result;
    result.setAlpha(attrs.alpha());
    result.setDepth(attrs.depth());
    result.setStencil(attrs.stencil());
    result.setAntialias(attrs.antialias());
    result.setPremultipliedAlpha(attrs.premultipliedAlpha());
    result.setPreserveDrawingBuffer(attrs.preserveDrawingBuffer());
    result.setFailIfMajorPerformanceCaveat(attrs.failIfMajorPerformanceCaveat());
    return result;
}
开发者ID:joone,项目名称:blink-crosswalk,代码行数:12,代码来源:ContextAttributeHelpers.cpp


示例4: INC_STATS

v8::Handle<v8::Value> V8HTMLCanvasElement::getContextCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.HTMLCanvasElement.context");
    v8::Handle<v8::Object> holder = args.Holder();
    HTMLCanvasElement* imp = V8HTMLCanvasElement::toNative(holder);
    String contextId = toWebCoreString(args[0]);
    RefPtr<CanvasContextAttributes> attrs;
#if ENABLE(3D_CANVAS)
    if (contextId == "experimental-webgl" || contextId == "webkit-3d") {
        attrs = WebGLContextAttributes::create();
        WebGLContextAttributes* webGLAttrs = static_cast<WebGLContextAttributes*>(attrs.get());
        if (args.Length() > 1 && args[1]->IsObject()) {
            v8::Handle<v8::Object> jsAttrs = args[1]->ToObject();
            v8::Handle<v8::String> alpha = v8::String::New("alpha");
            if (jsAttrs->Has(alpha))
                webGLAttrs->setAlpha(jsAttrs->Get(alpha)->BooleanValue());
            v8::Handle<v8::String> depth = v8::String::New("depth");
            if (jsAttrs->Has(depth))
                webGLAttrs->setDepth(jsAttrs->Get(depth)->BooleanValue());
            v8::Handle<v8::String> stencil = v8::String::New("stencil");
            if (jsAttrs->Has(stencil))
                webGLAttrs->setStencil(jsAttrs->Get(stencil)->BooleanValue());
            v8::Handle<v8::String> antialias = v8::String::New("antialias");
            if (jsAttrs->Has(antialias))
                webGLAttrs->setAntialias(jsAttrs->Get(antialias)->BooleanValue());
            v8::Handle<v8::String> premultipliedAlpha = v8::String::New("premultipliedAlpha");
            if (jsAttrs->Has(premultipliedAlpha))
                webGLAttrs->setPremultipliedAlpha(jsAttrs->Get(premultipliedAlpha)->BooleanValue());
        }
    }
#endif
    CanvasRenderingContext* result = imp->getContext(contextId, attrs.get());
    if (!result)
        return v8::Null();
    if (result->is2d())
        return toV8(static_cast<CanvasRenderingContext2D*>(result));
#if ENABLE(3D_CANVAS)
    else if (result->is3d())
        return toV8(static_cast<WebGLRenderingContext*>(result));
#endif
    ASSERT_NOT_REACHED();
    return v8::Null();
}
开发者ID:Treeeater,项目名称:Chromium_on_windows,代码行数:43,代码来源:V8HTMLCanvasElementCustom.cpp


示例5: toWebGraphicsContext3DAttributes

WebGraphicsContext3D::Attributes toWebGraphicsContext3DAttributes(const WebGLContextAttributes& attrs, const WebString& topDocumentURL, Settings* settings, unsigned webGLVersion)
{
    WebGraphicsContext3D::Attributes result;
    result.alpha = attrs.alpha();
    result.depth = attrs.depth();
    result.stencil = attrs.stencil();
    result.antialias = attrs.antialias();
    if (attrs.antialias()) {
        if (settings && !settings->openGLMultisamplingEnabled())
            result.antialias = false;
    }
    result.premultipliedAlpha = attrs.premultipliedAlpha();
    result.failIfMajorPerformanceCaveat = attrs.failIfMajorPerformanceCaveat();

    result.noExtensions = true;
    result.shareResources = false;
    result.preferDiscreteGPU = true;

    result.topDocumentURL = topDocumentURL;

    result.webGL = true;
    result.webGLVersion = webGLVersion;
    return result;
}
开发者ID:joone,项目名称:blink-crosswalk,代码行数:24,代码来源:ContextAttributeHelpers.cpp


示例6: setJSWebGLContextAttributesPreserveDrawingBuffer

void setJSWebGLContextAttributesPreserveDrawingBuffer(ExecState* exec, JSObject* thisObject, JSValue value)
{
    JSWebGLContextAttributes* castedThis = static_cast<JSWebGLContextAttributes*>(thisObject);
    WebGLContextAttributes* imp = static_cast<WebGLContextAttributes*>(castedThis->impl());
    imp->setPreserveDrawingBuffer(value.toBoolean(exec));
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:6,代码来源:JSWebGLContextAttributes.cpp


示例7: setJSWebGLContextAttributesPremultipliedAlpha

void setJSWebGLContextAttributesPremultipliedAlpha(ExecState* exec, JSObject* thisObject, JSValue value)
{
    JSWebGLContextAttributes* castedThis = static_cast<JSWebGLContextAttributes*>(thisObject);
    WebGLContextAttributes* imp = static_cast<WebGLContextAttributes*>(castedThis->impl());
    imp->setPremultipliedAlpha(value.toBoolean(exec));
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:6,代码来源:JSWebGLContextAttributes.cpp


示例8: setJSWebGLContextAttributesAntialias

void setJSWebGLContextAttributesAntialias(ExecState* exec, JSObject* thisObject, JSValue value)
{
    JSWebGLContextAttributes* castedThis = static_cast<JSWebGLContextAttributes*>(thisObject);
    WebGLContextAttributes* imp = static_cast<WebGLContextAttributes*>(castedThis->impl());
    imp->setAntialias(value.toBoolean(exec));
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:6,代码来源:JSWebGLContextAttributes.cpp


示例9: INC_STATS

v8::Handle<v8::Value> V8HTMLCanvasElement::getContextCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.HTMLCanvasElement.context");
    v8::Handle<v8::Object> holder = args.Holder();
    HTMLCanvasElement* imp = V8HTMLCanvasElement::toNative(holder);
    String contextId = toWebCoreString(args[0]);
    RefPtr<CanvasContextAttributes> attrs;
#if ENABLE(WEBGL)
    if (contextId == "experimental-webgl" || contextId == "webkit-3d") {
        attrs = WebGLContextAttributes::create();
        WebGLContextAttributes* webGLAttrs = static_cast<WebGLContextAttributes*>(attrs.get());
        if (args.Length() > 1 && args[1]->IsObject()) {
            v8::Handle<v8::Object> jsAttrs = args[1]->ToObject();
            v8::Handle<v8::String> alpha = v8::String::New("alpha");
            if (jsAttrs->Has(alpha))
                webGLAttrs->setAlpha(jsAttrs->Get(alpha)->BooleanValue());
            v8::Handle<v8::String> depth = v8::String::New("depth");
            if (jsAttrs->Has(depth))
                webGLAttrs->setDepth(jsAttrs->Get(depth)->BooleanValue());
            v8::Handle<v8::String> stencil = v8::String::New("stencil");
            if (jsAttrs->Has(stencil))
                webGLAttrs->setStencil(jsAttrs->Get(stencil)->BooleanValue());
            v8::Handle<v8::String> antialias = v8::String::New("antialias");
            if (jsAttrs->Has(antialias))
                webGLAttrs->setAntialias(jsAttrs->Get(antialias)->BooleanValue());
            v8::Handle<v8::String> premultipliedAlpha = v8::String::New("premultipliedAlpha");
            if (jsAttrs->Has(premultipliedAlpha))
                webGLAttrs->setPremultipliedAlpha(jsAttrs->Get(premultipliedAlpha)->BooleanValue());
            v8::Handle<v8::String> preserveDrawingBuffer = v8::String::New("preserveDrawingBuffer");
            if (jsAttrs->Has(preserveDrawingBuffer))
                webGLAttrs->setPreserveDrawingBuffer(jsAttrs->Get(preserveDrawingBuffer)->BooleanValue());
        }
    }
#endif
    CanvasRenderingContext* result = imp->getContext(contextId, attrs.get());
    if (!result)
        return v8::Null(args.GetIsolate());
    else if (result->is2d()) {
        v8::Handle<v8::Value> v8Result = toV8(static_cast<CanvasRenderingContext2D*>(result), args.Holder(), args.GetIsolate());
        if (InspectorInstrumentation::canvasAgentEnabled(imp->document())) {
            ScriptState* scriptState = ScriptState::forContext(v8::Context::GetCurrent());
            ScriptObject context(scriptState, v8::Handle<v8::Object>::Cast(v8Result));
            ScriptObject wrapped = InspectorInstrumentation::wrapCanvas2DRenderingContextForInstrumentation(imp->document(), context);
            if (!wrapped.hasNoValue())
                return wrapped.v8Value();
        }
        return v8Result;
    }
#if ENABLE(WEBGL)
    else if (result->is3d()) {
        // 3D canvas contexts can hold on to lots of GPU resources, and we want to take an
        // opportunity to get rid of them as soon as possible when we navigate away from pages using
        // them.
        V8PerIsolateData* perIsolateData = V8PerIsolateData::from(args.GetIsolate());
        perIsolateData->setShouldCollectGarbageSoon();

        v8::Handle<v8::Value> v8Result = toV8(static_cast<WebGLRenderingContext*>(result), args.Holder(), args.GetIsolate());
        if (InspectorInstrumentation::canvasAgentEnabled(imp->document())) {
            ScriptState* scriptState = ScriptState::forContext(v8::Context::GetCurrent());
            ScriptObject glContext(scriptState, v8::Handle<v8::Object>::Cast(v8Result));
            ScriptObject wrapped = InspectorInstrumentation::wrapWebGLRenderingContextForInstrumentation(imp->document(), glContext);
            if (!wrapped.hasNoValue())
                return wrapped.v8Value();
        }
        return v8Result;
    }
#endif
    ASSERT_NOT_REACHED();
    return v8::Null(args.GetIsolate());
}
开发者ID:dog-god,项目名称:iptv,代码行数:70,代码来源:V8HTMLCanvasElementCustom.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ WebGLRenderingContext类代码示例发布时间:2022-05-31
下一篇:
C++ WebGLContext类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap