Hi Floh,

Im already using emscripten SDL2 port. Im importing it here:

#include <SDL2/SDL.h>
#include <SDL2/SDL_opengl.h>


And using command line params:

['-O2', '-s', 'USE_SDL=2', '-s', 'USE_SDL_IMAGE=2', '-s', 'USE_SDL_TTF=2', 
'-s', 'USE_SDL_MIXER=2', '-s', "SDL2_IMAGE_FORMATS='["png"]'", '-s', 
'USE_WEBGL2=1', '--preload-file', 'assets']

I think that it is not the problem, because when i remove all -s USE_SDL2*, 
i got:

 *fatal error: **'SDL2/SDL.h' file not found*

So i think that im using emscripten SDL2.

If i use *-s USE_SDL=2 *i think that im using SDL2 port for emscripten, no?

Thanks.



On Friday, January 25, 2019 at 5:57:24 PM UTC-2, Floh wrote:
>
> > Where you are saying that im using 3.2? Because of this?
>
> Yes, but maybe WebGL2 isn't even supported in the built-in SDL wrapper, at 
> least I don't see it mentioned here:
>
>
> https://github.com/emscripten-core/emscripten/blob/1c1bbe27858ee2d939761d0450051a5a4a905f17/src/library_sdl.js#L396-L407
>
> The emscripten-ports SDL2 version may be the better option (unless you're 
> using that already), this has fairly recent changes, so seems to be 
> maintained:
>
> https://github.com/emscripten-ports/SDL2
>
> The emscripten documentation may also provide some helpful hints:
>
>
> https://kripken.github.io/emscripten-site/docs/porting/multimedia_and_graphics/OpenGL-support.html
>
> Cheers!
>
> On Friday, 25 January 2019 16:22:54 UTC+1, Paulo Coutinho wrote:
>>
>> Hi,
>>
>> Where you are saying that im using 3.2? Because of this?
>>
>> SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
>> SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
>>
>> I tried put 3/0, 2/0, 2/2. But the problems is exactly the same.
>>
>> I don't understand why its happen.
>>
>> Thanks.
>>
>>
>> On Thursday, January 24, 2019 at 9:29:34 PM UTC-2, Floh wrote:
>>>
>>> Ah... check out the answer I wrote in the ImGui github issue thread.
>>>
>>> I think there's 2 problems:
>>>
>>> You're telling SDL to create a 3.2 Core Profile GL context, which is a 
>>> desktop GL version. You'd need to find out what the emscripten SDL port 
>>> does in that case (it looks like it is not creating a WebGL2 context but a 
>>> WebGL1 context), even than it's not guaranteed that all GL 3.2 API calls 
>>> translate to WebGL2 (which is GLES 3.0), so some code changes may be 
>>> necessary.
>>>
>>> Second problem is that your shader code is for 3.2 Core Profile GL, this 
>>> won't work in WebGL or WebGL2, the shader code needs to be rewritten to be 
>>> GLES2 or GLES3 compatible.
>>>
>>> So basically, the C code and shader code needs to be ported to GLES3.0 
>>> (shader code being more important because that's definitely not translated 
>>> by the emscripten GL wrapper, the C code may be taken care of by 
>>> emscripten's "desktop GL emulation", as long as you can convince SDL to 
>>> create a WebGL2 context).
>>>
>>> Cheers!
>>>
>>> On Thursday, 24 January 2019 21:46:00 UTC+1, Paulo Coutinho wrote:
>>>>
>>>> Hi,
>>>>
>>>> After try a lot i don't have other option instead of put here. I think 
>>>> imgui dont work nativelly with emscripten or im doing something wrong.
>>>>
>>>>
>>>> I tried use opengl2 and opengl3 but both generate error with emscripten.
>>>>
>>>>
>>>> Im trying to use opengl3 at least, and when i run, i got:
>>>>
>>>>
>>>> [image: image] 
>>>> <https://user-images.githubusercontent.com/395096/51707233-d57b5380-2007-11e9-9d53-1628c439dee7.png>
>>>>
>>>>
>>>> I don't know how to solve it. I tried a lot of params in emscripten 
>>>> compiler, but nothing. I tried the forum on google groups, but nothing.
>>>>
>>>>
>>>> My source code:
>>>>
>>>> https://github.com/ezored/sample-wasm/blob/imgui/source/local/dependency-app/build/source/cpp/canvas/main.cpp
>>>>
>>>>
>>>> Without imgui it is working here:
>>>> http://public.ezored.com/sample-wasm/wasm-canvas/Release/index.html
>>>>
>>>>
>>>>
>>>> Thanks for any help.
>>>>
>>>>
>>>>
>>>> On Thursday, January 17, 2019 at 3:41:00 PM UTC-2, Paulo Coutinho wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> Im trying make an example of using imgui inside a sample of my tool 
>>>>> ezored (http://www.ezored.com) with emscripten.
>>>>>
>>>>> Im using emscripten 1.38.22, sdl2, opengl2 and this imgui example as 
>>>>> reference:
>>>>>
>>>>> https://github.com/ocornut/imgui/blob/master/examples/example_sdl_opengl2/main.cpp
>>>>>
>>>>> But i have some problems. 
>>>>>
>>>>>
>>>>>    1. What i really need for imgui and sdl2 and wasm? I put some 
>>>>>    TODOs because my project is working with that TODO lines, 
>>>>>    "SDL_GL_SetAttribute", "SDL_GL_SwapWindow", and other marked with 
>>>>> TODO. If 
>>>>>    anyone can help me the main.cpp file is here:
>>>>>    
>>>>>    
>>>>> https://github.com/ezored/sample-wasm/blob/imgui/source/local/dependency-app/build/source/cpp/canvas/main.cpp
>>>>>    
>>>>>    Only need search for "TODO: WE NEED IT FOR WASM?".
>>>>>    
>>>>>    My working example without these specific opengl functions is here:
>>>>>    http://public.ezored.com/sample-wasm/    (CANVAS EXAMPLE)
>>>>>    
>>>>>    2. Based on my main.cpp file im getting compilation error:
>>>>>    
>>>>>    error: undefined symbol: glColorPointer
>>>>>    
>>>>>    warning: To disable errors for undefined symbols use `-s 
>>>>>    ERROR_ON_UNDEFINED_SYMBOLS=0`
>>>>>    
>>>>>    error: undefined symbol: glDisableClientState
>>>>>    
>>>>>    error: undefined symbol: glEnableClientState
>>>>>    
>>>>>    error: undefined symbol: glOrtho
>>>>>    
>>>>>    error: undefined symbol: glPolygonMode
>>>>>    
>>>>>    error: undefined symbol: glPopAttrib
>>>>>    
>>>>>    error: undefined symbol: glPopMatrix
>>>>>    
>>>>>    error: undefined symbol: glPushAttrib
>>>>>    
>>>>>    error: undefined symbol: glPushMatrix
>>>>>    
>>>>>    error: undefined symbol: glTexCoordPointer
>>>>>    
>>>>>    Error: Aborting compilation due to previous errors
>>>>>    
>>>>>    shared:ERROR: '/Users/paulo/Developer/emsdk/node/8.9.1_64bit/bin/node 
>>>>>    /Users/paulo/Developer/emsdk/emscripten/1.38.22/src/compiler.js 
>>>>>    /tmp/tmpBF_WjX.txt 
>>>>>    
>>>>> /Users/paulo/Developer/emsdk/emscripten/1.38.22/src/library_pthread_stub.js'
>>>>>  
>>>>>    failed (1)
>>>>>    
>>>>>
>>>>> Can anyone help me finish this example?
>>>>>
>>>>> Thanks.
>>>>>
>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to