8000 compatible with open data context support webgl and canvas for 2d-tas… by knoxHuang · Pull Request #3778 · cocos/cocos-engine · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

compatible with open data context support webgl and canvas for 2d-tas… #3778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions cocos2d/core/platform/CCSys.js
Original file line number Diff line number Diff line change
Expand Up @@ -709,10 +709,18 @@ function initSys () {

sys.localStorage = window.localStorage;

var _supportWebGL = _supportWebp = false;
try {
var _canvas = document.createElement("canvas");
_supportWebGL = _canvas.getContext("webgl");
_supportWebp = _canvas.toDataURL('image/webp').startsWith('data:image/webp');
}
catch (err) { }

sys.capabilities = {
"canvas": true,
"opengl": (sys.browserType !== sys.BROWSER_TYPE_WECHAT_GAME_SUB),
"webp": false
"opengl": !!_supportWebGL,
"webp": _supportWebp
};
sys.__audioSupport = {
ONLY_ONE: false,
Expand Down
8 changes: 3 additions & 5 deletions cocos2d/core/renderer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,9 @@ cc.renderer = module.exports = {
initCanvas (canvas) {
let canvasRenderer = require('./canvas');

if (CC_TEST) {
// It's actually running with original render engine
renderEngine.Texture2D = renderEngine.canvas.Texture2D;
renderEngine.Device = renderEngine.canvas.Device;
}
// It's actually running with original render engine
renderEngine.Texture2D = renderEngine.canvas.Texture2D;
renderEngine.Device = renderEngine.canvas.Device;

this.Texture2D = renderEngine.Texture2D;

Expand Down
Loading
0