Let me ask it again slightly differently.I see that Emscripten allows usage
of GLFW right? Fine.I use it.But then I need also GLES2 headers to use the
actual OpenGL API calls?So I include that header and getting those
errors.which come from glext.h which is probably used by GLFW.So how do I
use GLFW and GLES2 headers so that Emscripten can eat those? Btw,for the
demo I I used GLFW headers from Emscripten SDK.

Alternatively,if I got you right,I can just use GLEW within OpenGL 3.2 core
profile limits and only adjusting shaders syntax to that of GLES2?

Thanks.


On Sat, Mar 8, 2014 at 9:25 PM, Michael IV <explomas...@gmail.com> wrote:

> The thing is I don't include that header. It's probably gets included with
> GLFW or something like that.
> On Mar 8, 2014 8:01 PM, "Jukka Jylänki" <juj...@gmail.com> wrote:
>
>> You are mixing GLES2 ( \system\include\GLES2/gl2.h )  and desktop GL (
>> \system\include\GL/glext.h )  headers, that's a big no go! Make sure you
>> include only GLES2 headers when building for Emscripten, if you are
>> planning to stay clear of any emulation paths. If you are converting a
>> desktop GL sample to build for Emscripten, the simplest is to probably
>> #ifdef the native and web cases, so that you don't include desktop GL
>> headers when doing the Emscripten build.
>>
>>
>> 2014-03-08 19:47 GMT+02:00 Michael IV <explomas...@gmail.com>:
>>
>>> Yeah,that was the problem.But now I have another one.If I
>>> include #include <GLES2/gl2.h>
>>> then compiler throws:
>>>
>>> C:\Program Files
>>> (x86)\Emscripten\emscripten\1.12.0\system\include\GLES2/gl2.h:3
>>> 8:26: error:
>>>       typedef redefinition with different types ('khronos_intptr_t' (aka
>>> 'long')
>>>
>>>       vs 'ptrdiff_t' (aka 'int'))
>>> typedef khronos_intptr_t GLintptr;
>>>                          ^
>>> C:\Program Files
>>> (x86)\Emscripten\emscripten\1.12.0\system\include\GL/glext.h:50
>>> 72:19: note:
>>>       previous definition is here
>>> typedef ptrdiff_t GLintptr;
>>>                   ^
>>> In file included from mainGLFW2.cpp:15:
>>> C:\Program Files
>>> (x86)\Emscripten\emscripten\1.12.0\system\include\GLES2/gl2.h:3
>>> 9:26: error:
>>>       typedef redefinition with different types ('khronos_ssize_t' (aka
>>> 'long')
>>>       vs 'ptrdiff_t' (aka 'int'))
>>> typedef khronos_ssize_t  GLsizeiptr;
>>>                          ^
>>> C:\Program Files
>>> (x86)\Emscripten\emscripten\1.12.0\system\include\GL/glext.h:50
>>> 73:19: note:
>>>       previous definition is here
>>> typedef ptrdiff_t GLsizeiptr;
>>>                   ^
>>> 2 errors generated.
>>> ERROR    root: compiler frontend failed to generate LLVM bitcode, halting
>>>
>>>
>>> On Sat, Mar 8, 2014 at 7:18 PM, Jukka Jylänki <juj...@gmail.com> wrote:
>>>
>>>> Yeah, this has the same issue as described in the previous mail - the
>>>> blocking modal while(running) loop is not supported, but you should use
>>>> emscripten_set_main_loop() instead.
>>>>
>>>>
>>>> 2014-03-08 18:59 GMT+02:00 Michael IV <explomas...@gmail.com>:
>>>>
>>>>>  I wrote a test which just clears framebuffer color:
>>>>>
>>>>>
>>>>>
>>>>> #include <stdio.h>
>>>>> #include <stdlib.h>
>>>>>
>>>>>
>>>>> #include <GL/glfw.h>
>>>>> #include <emscripten/emscripten.h>
>>>>>
>>>>> int main( void )
>>>>> {
>>>>> int     width, height, running, x;
>>>>>  double  t;
>>>>>
>>>>> // Initialise GLFW
>>>>> if( !glfwInit() )
>>>>>  {
>>>>> fprintf( stderr, "Failed to initialize GLFW\n" );
>>>>> exit( EXIT_FAILURE );
>>>>>  }
>>>>>
>>>>> // Open OpenGL window
>>>>> if( !glfwOpenWindow( 640, 480, 8,8,8,8, 16,0, GLFW_WINDOW ) )
>>>>>  {
>>>>> fprintf( stderr, "Failed to open GLFW window\n" );
>>>>>
>>>>> glfwTerminate();
>>>>>  exit( EXIT_FAILURE );
>>>>> }
>>>>>
>>>>> glfwSetWindowTitle( "Spinning Triangle" );
>>>>>
>>>>>
>>>>>
>>>>> // Enable sticky keys
>>>>> // glfwEnable( GLFW_STICKY_KEYS );
>>>>>
>>>>> // Enable vertical sync (on cards that support it)
>>>>> //glfwSwapInterval( 1 );
>>>>>
>>>>> // Main loop
>>>>>  running = GL_TRUE;
>>>>> int i = 0;
>>>>> while(running )
>>>>> {
>>>>>  // Get time and mouse position
>>>>> //t = glfwGetTime();
>>>>> //glfwGetMousePos( &x, NULL );
>>>>>
>>>>> // Get window size (may be different than the requested size)
>>>>> //glfwGetWindowSize( &width, &height );
>>>>>  //height = height > 0 ? height : 1;
>>>>>
>>>>> // Set viewport
>>>>> glViewport( 0, 0, width, height );
>>>>>
>>>>> // Clear color buffer
>>>>> glClearColor( 1.0f, 0.0f, 0.0f, 0.0f );
>>>>> glClear( GL_COLOR_BUFFER_BIT );
>>>>>
>>>>>
>>>>>
>>>>> // Swap buffers
>>>>> glfwSwapBuffers();
>>>>>
>>>>> // Check if the ESC key was pressed or the window was closed
>>>>> running = !glfwGetKey( GLFW_KEY_ESC ) &&
>>>>>   glfwGetWindowParam( GLFW_OPENED );
>>>>> }
>>>>>
>>>>> // Close OpenGL window and terminate GLFW
>>>>>  glfwTerminate();
>>>>>
>>>>> exit( EXIT_SUCCESS );
>>>>> }
>>>>>
>>>>>
>>>>> It compiles but when I open it in chrome nothing happens.There is a
>>>>> message "Running" and black stripe.
>>>>>
>>>>>  --
>>>>> 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 emscripten-discuss+unsubscr...@googlegroups.com.
>>>>>
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>  --
>>>> You received this message because you are subscribed to a topic in the
>>>> Google Groups "emscripten-discuss" group.
>>>> To unsubscribe from this topic, visit
>>>> https://groups.google.com/d/topic/emscripten-discuss/1tPcbGwHzc4/unsubscribe
>>>> .
>>>> To unsubscribe from this group and all its topics, send an email to
>>>> emscripten-discuss+unsubscr...@googlegroups.com.
>>>>
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> --
>>> Michael Ivanov
>>> Independent Pixel Commander
>>> onlygraphix.com
>>> Tel:+972 54 4962254
>>>
>>>  --
>>> 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 emscripten-discuss+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "emscripten-discuss" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/emscripten-discuss/1tPcbGwHzc4/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> emscripten-discuss+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>


-- 
Michael Ivanov
Independent Pixel Commander
onlygraphix.com
Tel:+972 54 4962254

-- 
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 emscripten-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to