-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
examples/example_emscripten_wgpu: Initialize and change the size of the viewport and framebuffer according to the size of the canvas #6751
Closed
Closed
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
5aef2d4
refactor(examples/example_emscripten_wgpu): Initialize and change the…
Traveller23 5d3fa96
Merge pull request #1 from ocornut/master
Traveller23 288f416
examples/example_emscripten_wgpu, examples/example_glfw_opengl3: init…
Traveller23 a84bc6d
chore: add examples/example_glfw_opengl3/web/index.html
Traveller23 767a59d
chore: remove 'examples/example_glfw_opengl3/web/index.html' from .gi…
Traveller23 99136a8
docs: remove comments on resolved issue
Traveller23 55a7529
Merge branch 'ocornut:master' into master
Traveller23 499c132
refactor: implicitly resize the GLFW window
Traveller23 0d23b43
chore: delete redundant file examples/example_glfw_opengl3/web/index.…
Traveller23 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<!doctype html> | ||
<html lang="en-us"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"/> | ||
<title>Dear ImGui Emscripten+GLFW+OpenGL3 example</title> | ||
<style> | ||
body { margin: 0; background-color: black } | ||
.emscripten { | ||
position: absolute; | ||
top: 0px; | ||
left: 0px; | ||
margin: 0px; | ||
border: 0; | ||
width: 100%; | ||
height: 100%; | ||
overflow: hidden; | ||
display: block; | ||
image-rendering: optimizeSpeed; | ||
image-rendering: -moz-crisp-edges; | ||
image-rendering: -o-crisp-edges; | ||
image-rendering: -webkit-optimize-contrast; | ||
image-rendering: optimize-contrast; | ||
image-rendering: crisp-edges; | ||
image-rendering: pixelated; | ||
-ms-interpolation-mode: nearest-neighbor; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas> | ||
<script type='text/javascript'> | ||
var Module; | ||
(async () => { | ||
Module = { | ||
preRun: [], | ||
postRun: [], | ||
print: (function() { | ||
return function(text) { | ||
text = Array.prototype.slice.call(arguments).join(' '); | ||
console.log(text); | ||
}; | ||
})(), | ||
printErr: function(text) { | ||
text = Array.prototype.slice.call(arguments).join(' '); | ||
console.error(text); | ||
}, | ||
canvas: (function() { | ||
var canvas = document.getElementById('canvas'); | ||
//canvas.addEventListener("webglcontextlost", function(e) { alert('FIXME: WebGL context lost, please reload the page'); e.preventDefault(); }, false); | ||
return canvas; | ||
})(), | ||
setStatus: function(text) { | ||
console.log("status: " + text); | ||
}, | ||
monitorRunDependencies: function(left) { | ||
// no run dependencies to log | ||
} | ||
}; | ||
window.onerror = function() { | ||
console.log("onerror: " + event); | ||
}; | ||
|
||
// Initialize the graphics adapter | ||
{ | ||
const adapter = await navigator.gpu.requestAdapter(); | ||
const device = await adapter.requestDevice(); | ||
Module.preinitializedWebGPUDevice = device; | ||
} | ||
|
||
{ | ||
const js = document.createElement('script'); | ||
js.async = true; | ||
js.src = "index.js"; | ||
document.body.appendChild(js); | ||
} | ||
})(); | ||
</script> | ||
</body> | ||
</html> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this code really necessary for the opengl3 example? Isn't this code used for webgpu?