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

Almost getting this to work with Emscripten & libSDL2 #319

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

Comments

Projects
None yet
4 participants
@define-private-public

define-private-public commented Jan 8, 2017

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

This comment has been minimized.

Show comment
Hide comment
@dumblob

dumblob Jan 8, 2017

Collaborator

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

Collaborator

dumblob commented Jan 8, 2017

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

@xlab

This comment has been minimized.

Show comment
Hide comment
@xlab

xlab Jan 8, 2017

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

xlab commented Jan 8, 2017

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

@DeXP

This comment has been minimized.

Show comment
Hide comment
@DeXP

DeXP Sep 12, 2017

Contributor

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.

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 join this conversation on GitHub. Already have an account? Sign in to comment