Giter Club home page Giter Club logo

Comments (4)

icculus avatar icculus commented on September 13, 2024

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.

Please-just-dont avatar Please-just-dont commented on September 13, 2024

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.

icculus avatar icculus commented on September 13, 2024

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.

Please-just-dont avatar Please-just-dont commented on September 13, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.