Skip to content
This repository has been archived by the owner on Dec 2, 2019. It is now read-only.

Almost getting this to work with Emscripten & libSDL2 #319

Open
define-private-public opened this issue Jan 8, 2017 · 3 comments
Open

Comments

@define-private-public
Copy link

I'm very close to getting nuklear to compile out to a HTML5 & JS application using Emscript and the sdl_opengl3 demo file. I'm only running into an issue with emcc with glMapBuffer() and glUnmapBuffer(). I don't think they exist in GLES or WebGL, and that's what's causing the issue. Is there something else I could swap them out with?

@dumblob
Copy link
Contributor

dumblob commented Jan 8, 2017

Take a look at #164 where these calls were replaced.

@xlab
Copy link

xlab commented Jan 8, 2017

glMapBuffer can be replaced with glMapBufferRange for GLES 3.0.
glUnmapBuffer exists in GLES 3.0

@DeXP
Copy link
Contributor

DeXP commented Sep 12, 2017

Agreed with @dumblob , cwkx's solution works. I used it in my Nuklear+ library ( nuklear_sdl_gles2.h file ). It works on Emscripten, Linux and Android. Also, it's pure OpenGL ES2, does not use VAO extension. I will PR it as demo here some later.

So:

  1. Rewrite the shaders
  2. Remove some glBindVertexArray(0);
  3. Replace glMapBuffer with malloc, and glUnmapBuffer with glBufferSubData+free.

I took image loader code from here. You can take my ready nkc_stb_image.h.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants