Comments (4)
I think this is probably an assumption that one is using WebGL in emscripten, but afaict it doesn't rely on it (Emscripten_CreateWindow has an #ifdef SDL_VIDEO_OPENGL_EGL
in there, so you can create an SDL Window without it creating a GL context.
I think we probably just need some preprocessor checks in SDL_emscriptenopengles.c to fix this, assuming we don't need any extra specific magic for WebGPU support on top of this.
from sdl.
Do we even need to create an SDL window to use Emscripten with the canvas? I mean last time I checked the event system doesn't work without initialising the video subsystem so I think I have to create a window.
from sdl.
You have to create an SDL window if you want to get SDL events and other things, but I think the canvas exists on the page already, so you can probably just mess with it via JavaScript (and probably have to at least a little to set up WebGPU, I presume).
Anyhow, the build issue I will fix, but my initial look at the code suggests SDL won't actually try to initialize WebGL unless you use SDL_WINDOW_OPENGL when creating a window, so this is strictly a linking issue that needs to be resolved.
(And in the short term, it's safe to just link that part of Emscripten in, it just won't actually be used.)
from sdl.
If someone comes across this problem, you need give these linker flags to get rid of a bunch of linker errors to OpenGL functions:
append_compiler_flags("-sMIN_WEBGL_VERSION=2")
append_compiler_flags("-sMAX_WEBGL_VERSION=2")
Then you need to link the Javascript html5_webgl.js library, or -sAUTO_JS_LIBRARIES=1.
This is what you need if you call SDL_createwindow.
This took me an entire day to figure out, working with this sort of stuff without documentation is so hard.
from sdl.
Related Issues (20)
- SDL_GetHint does not work when not calling SDL_Init HOT 1
- main callbacks return enum values? HOT 1
- Missing Pen backends HOT 4
- SDL_AcquireCameraFrame returns frames at a higher FPS than specified on macOS 14.6.1 HOT 3
- SDL_ConvertSurfaceAndColorspace does not correctly palettize surfaces HOT 6
- SDL_Log not working on Windows with debugger attached HOT 10
- [SDL2] Gamepad Motion Sensors via Bluetooth don't work until you launch another SDL App with working Motion Sensors or swap older SDL2.dll files HOT 2
- Updates on dropping Apple frameworks not available on iOS? HOT 7
- Embed a SDL window by NativeControlHost control in AvaloniaUI, mouse cursor don't restore to default on Linux x11. HOT 1
- Feature request SDL_EVENT_FINGER_CANCELLED
- MFC window, pop a sdl window, break! HOT 1
- Decide and Document how planar data is stored in / accessed from Surfaces
- Always prefer downscaling in SDL_GetSurfaceImage HOT 3
- [SDL2] VITA: Can't create any render at all HOT 2
- [macos] HIDAPI device disconnected while opening
- testcamera prints irrelevant debug message on exit (Windows) HOT 1
- All standard SDL properties should be namespaced HOT 2
- SDL_EnumerateDirectory fails if it hits a file currently in use HOT 3
- SDL_WarpMouseInWindow has buggy behaviour on wayland HOT 3
- How does SDL2 implement testffmpeg.c HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdl.