Directly activate a WebGL context from JS
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 38/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- javascript, wasm
调研方向
Start with test/browser/test_preinitialized_webgl_context.c and trace the existing preinitializedWebGLContext and emscripten_webgl_context_create() path. Compare that behavior with the --pre-js makeWebGL2ContextCurrent extension described here. Done should establish whether direct activation and multiple dynamically created WebGL contexts can be supported through a clear, tested API.
由索引模型根据 Issue 内容生成。
描述
Using an already existing WebGL context requires a somewhat confusing dance with preinitializedWebGLContext.
To activate a GL context (as in https://github.com/emscripten-core/emscripten/blob/25c255b66fe553a4bff3761cbeb7add8f1583d25/test/browser/test_preinitialized_webgl_context.c):
- set
preinitalizedWebGLContexton module creation - call
emscripten_webgl_context_create(), necessarily passing a valid canvas element reference and context attributes. These arguments will not really be used, this function returns (a handle to) thepreinitializedWebGLContext. - call
emscripten_webgl_make_context_current(handle)
This appears more confusing than necessary. Also, this process does not seem to allow using the module with more than one WebGL context. This is something that we'd like to, to reuse our module to render into multiple (dynamically created) canvases.
To work around this, we've extended the Module with this --pre-js file.
// Activates the given WebGL context for rendering. Does _not_ register a context handle for the context and thus it cannot be referenced from WASM.
Module.makeWebGL2ContextCurrent = (ctx) => {
GL.currentContext = {
handle: -1, // unused?
attributes: {}, // unused?
version: 2,
GLctx: ctx
};
Module['ctx'] = GLctx = GL.currentContext?.GLctx;
}
With this, we don't need any of the steps 1. - 3. above; we only call module.makeWebGL2ContextCurrent(gl) for our canvas and proceed to call into the WASM to render.
Questions:
- Is there a pre-existing functionality that already achieves what our --pre-js extension does?
- If not, would it be useful to add this to emscripten directly?
- 主要语言
- C++
- 星标
- 27.8k
- 派生
- 3.6k
- 平均合并
- 1 天 3 小时
- 30 天内合并 PR
- 179
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
emscripten-core/emscripten 的其他 Issue
-
`other.test_cmake_cxx_import_std` fails on CMake 3.30–4.0.2 due to missing `CMAKE_EXPERIMENTAL_CXX_IMPORT_STD` UUIDs可能已有人在做 @subhaushsingh 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 85/100
emscripten-core/emscripten#28160 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
emscripten-core/emscripten#27994 · 2 条评论 ·
维护者通常 1 天内回复
-
LEGACY_GL_EMULATION: generated fixed-function fragment shaders use mediump — fp16 overflow where mediump is half precision可能已有人在做 @TheTomBritton 于 13 天前认领。 未关闭Desktop OpenGL emulation
难度 2/5 1-3 小时 新手友好度 78/100
emscripten-core/emscripten#27948 · 4 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 64/100
emscripten-core/emscripten#27906 · 1 条评论 ·
维护者通常 1 天内回复
-
run_python, run_python_compiler could readlink -f可能已有人在做 @kapouer 于 128 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 74/100
emscripten-core/emscripten#27211 · 1 条评论 ·
维护者通常 1 天内回复
查看 emscripten-core/emscripten 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 62/100
mw00/project-maya#877 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
llvm/offload-test-suite#1703 ·
维护者通常 1 天内回复
-
backlog bug
难度 2/5 1-3 小时 新手友好度 86/100
EchoTools/nevr-runtime#2154 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
BGI-shenzhen/PopLDdecay#25 ·